View Source SmeeView.Aspects.Contact (SmeeView v0.2.1)

Represents and processes <ContactPerson> elements in entity metadata as Aspect structs.

The functions in this module are intended to be applied to individual Aspect structs - for extracting and processing collections of these records please use the matching View module.

Summary

Functions

Returns the company name, if present (it probably isn't!)

Returns the suggested display name of a contact, derived from given name, surname and company.

Returns the email address as a bare email address (without name, not a URL)

Returns the contact's email address as a URL (as it's stored in the metadata, probably)

Returns the contact's givenname, if present

Is this aspect relevant to the IdP role?

Returns the email address and name in RFC5322 name-addr format (name address@domain)

Returns the phone number of the contact, if present.

Returns the phone number of the contact (or nil) as a URL, as it probably isn't stored in the metadata

Returns the associated role for this aspect: :sp, :idp or :all

Is this aspect relevant to the SP role?

Returns the surname of the contact, if present.

Returns the contact type (technical, support, administrative, billing, or other)

Types

@type t() :: %SmeeView.Aspects.Contact{
  company: binary(),
  email: binary(),
  givenname: binary(),
  phone: binary(),
  rtype: binary(),
  surname: binary(),
  type: binary()
}

Functions

@spec company(aspect :: t()) :: binary() | nil

Returns the company name, if present (it probably isn't!)

Contact.company(aspect)
# => "Unseen University"
@spec displayname(aspect :: t()) :: binary()

Returns the suggested display name of a contact, derived from given name, surname and company.

Contact.displayname(contact)
# => "Ponder Stibbons (Unseen University)"
@spec email(aspect :: t()) :: binary() | nil

Returns the email address as a bare email address (without name, not a URL)

Contact.email(contact)
# => "ponders@unseen.edu"
@spec email_url(aspect :: t()) :: binary() | nil

Returns the contact's email address as a URL (as it's stored in the metadata, probably)

Contact.email_url(contact)
# => "mailto:ponders@unseen.edu"
@spec givenname(aspect :: t()) :: binary() | nil

Returns the contact's givenname, if present

Contact.givenname(contact)
# => "Ponder"
@spec idp?(aspect :: t()) :: boolean()

Is this aspect relevant to the IdP role?

Will return true if the aspect has been derived from an IdP role, or is applicable to all roles.

Contact.idp?(aspect)
# => true
@spec name_addr(aspect :: t()) :: binary()

Returns the email address and name in RFC5322 name-addr format (name address@domain)

Contact.name_addr(contact)
# => "Ponder Stibbons <ponders@unseen.edu>"
@spec phone(aspect :: t()) :: binary() | nil

Returns the phone number of the contact, if present.

Contact.phone(contact)
# => "01632960808"
@spec phone_url(aspect :: t()) :: binary() | nil

Returns the phone number of the contact (or nil) as a URL, as it probably isn't stored in the metadata

Contact.phone_url(contact)
# => "tel:01632960808"
@spec role(aspect :: t()) :: atom()

Returns the associated role for this aspect: :sp, :idp or :all

The role type is useful when handling a mixed list of aspects that may be specific to certain roles of an entity.

Contact.role(aspect)
# => :idp
@spec sp?(aspect :: t()) :: boolean()

Is this aspect relevant to the SP role?

Will return true if the aspect has been derived from an SP role, or is applicable to all roles.

Contact.sp?(aspect)
# => false
@spec surname(aspect :: t()) :: binary() | nil

Returns the surname of the contact, if present.

Contact.surname(contact)
# => "Stibbons"
@spec type(aspect :: t()) :: binary()

Returns the contact type (technical, support, administrative, billing, or other)

Contact.type(contact)
# => "administrative"