View Source ROR.Matches (ROR v0.1.0)

A structure for storing organization match results from Identify/Affiliation searches

Matches is the equivalent to the ROR.Results struct when checking for affiliation matches with ROR.identify!/2

This struct supports the Enum protocol, so you can directly iterate the matches within

Summary

Functions

Returns a chosen Match (a reliably high-rated match) or nil if one has not been found

Returns a chosen Organization (from within a reliably high-rated match) or nil if one has not been found

Extract a Matches struct, containing Match structs and Organizations, from the JSON returned by the ROR affiliation API.

Lists Matches

Returns the total number of matches

Types

t()

@type t() :: %ROR.Matches{items: [ROR.Match.t()], results: integer(), time: integer()}

Functions

chosen(matches)

@spec chosen(matches :: t()) :: ROR.Match.t() | nil

Returns a chosen Match (a reliably high-rated match) or nil if one has not been found

chosen_organization(matches)

@spec chosen_organization(matches :: t()) :: nil | ROR.Organization.t()

Returns a chosen Organization (from within a reliably high-rated match) or nil if one has not been found

extract(data)

@spec extract(data :: map()) :: t()

Extract a Matches struct, containing Match structs and Organizations, from the JSON returned by the ROR affiliation API.

If you are retrieving records via the ROR module and the REST API you will not need to use this function yourself.

matches(matches)

@spec matches(matches :: t()) :: [ROR.Match.t()]

Lists Matches

number_of_matches(matches)

@spec number_of_matches(matches :: t()) :: integer()

Returns the total number of matches