LIS (Learning Information Services) role vocabulary parser.
Parses role URIs from the standard LIS vocabulary into %Role{} structs.
Covers context roles, context sub-roles, institution roles, system roles
(LIS and LTI), and deprecated URI forms.
Summary
Functions
Attempt to parse a role URI against the LIS vocabularies.
Convert a %Role{} struct to its LIS vocabulary URI.
Functions
@spec parse(String.t()) :: {:ok, Ltix.LaunchClaims.Role.t()} | :error
Attempt to parse a role URI against the LIS vocabularies.
Returns {:ok, %Role{}} for recognized URIs, :error otherwise.
@spec to_uri(Ltix.LaunchClaims.Role.t_without_uri()) :: {:ok, String.t()} | :error
Convert a %Role{} struct to its LIS vocabulary URI.
Examples
iex> alias Ltix.LaunchClaims.Role
iex> Ltix.LaunchClaims.Role.LIS.to_uri(%Role{type: :context, name: :instructor})
{:ok, "http://purl.imsglobal.org/vocab/lis/v2/membership#Instructor"}
iex> alias Ltix.LaunchClaims.Role
iex> Ltix.LaunchClaims.Role.LIS.to_uri(%Role{type: :context, name: :instructor, sub_role: :teaching_assistant})
{:ok, "http://purl.imsglobal.org/vocab/lis/v2/membership/Instructor#TeachingAssistant"}
iex> alias Ltix.LaunchClaims.Role
iex> Ltix.LaunchClaims.Role.LIS.to_uri(%Role{type: :institution, name: :faculty})
{:ok, "http://purl.imsglobal.org/vocab/lis/v2/institution/person#Faculty"}
iex> alias Ltix.LaunchClaims.Role
iex> Ltix.LaunchClaims.Role.LIS.to_uri(%Role{type: :system, name: :sys_admin})
{:ok, "http://purl.imsglobal.org/vocab/lis/v2/system/person#SysAdmin"}
iex> alias Ltix.LaunchClaims.Role
iex> Ltix.LaunchClaims.Role.LIS.to_uri(%Role{type: :system, name: :test_user})
{:ok, "http://purl.imsglobal.org/vocab/lti/system/person#TestUser"}