Class: LUSI::API::Person::UserContact

Inherits:
Object
  • Object
show all
Defined in:
lib/lusi_api/person/student.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml = nil, lookup = nil, identity: nil, contact_type: nil, contact_name: nil, email_address: nil) ⇒ void

Initialises a new UserContact instance

Parameters:

  • identity (String, nil) (defaults to: nil)

    the default identity code of the contact

  • contact_type (String, nil) (defaults to: nil)

    the default contact type (‘Staff’ | ‘Student’)

  • contact_name (String, nil) (defaults to: nil)

    the default contact name

  • email_address (String, nil) (defaults to: nil)

    the default email address



206
207
208
209
210
211
# File 'lib/lusi_api/person/student.rb', line 206

def initialize(xml = nil, lookup = nil, identity: nil, contact_type: nil, contact_name: nil, email_address: nil)
  @identity = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Identity', identity)
  @contact_type = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:ContactType', contact_type)
  @contact_name = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:ContactName', contact_name)
  @email_address = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:EmailAddress', email_address)
end

Instance Attribute Details

#contact_nameString?

Returns the name of the contact.

Returns:

  • (String, nil)

    the name of the contact



194
195
196
# File 'lib/lusi_api/person/student.rb', line 194

def contact_name
  @contact_name
end

#contact_typeString?

Returns the type of contact (‘Staff’ | ‘Student’).

Returns:

  • (String, nil)

    the type of contact (‘Staff’ | ‘Student’)



190
191
192
# File 'lib/lusi_api/person/student.rb', line 190

def contact_type
  @contact_type
end

#email_addressString?

Returns the email address of the contact.

Returns:

  • (String, nil)

    the email address of the contact



198
199
200
# File 'lib/lusi_api/person/student.rb', line 198

def email_address
  @email_address
end

#identityString?

Returns the identity code of the contact.

Returns:

  • (String, nil)

    the identity code of the contact



186
187
188
# File 'lib/lusi_api/person/student.rb', line 186

def identity
  @identity
end

Instance Method Details

#to_sString

Returns a string representation of the instance

Returns:

  • (String)

    the string representation of the contact



215
216
217
218
# File 'lib/lusi_api/person/student.rb', line 215

def to_s
  email = @email_address ? " <#{@email_address}>" : ''
  "#{@contact_name}#{@email}"
end