Class: LUSI::API::Person::StaffMember
- Inherits:
-
Object
- Object
- LUSI::API::Person::StaffMember
- Defined in:
- lib/lusi_api/person/staff.rb
Overview
Represents a staff member in the LUSI API
Instance Attribute Summary collapse
-
#department ⇒ LUSI::API::Organisation::Unit?
The staff member’s associated department.
-
#faculty ⇒ LUSI::API::Organisation::Unit?
The staff member’s associated faculty.
-
#forename ⇒ String?
The forename of the staff member.
-
#identity ⇒ String?
The identity code of the staff member.
-
#institution ⇒ LUSI::API::Organisation::Unit?
The staff member’s associated institution.
-
#preferred_name ⇒ String?
The preferred name of the staff member.
-
#surname ⇒ String?
The surname of the staff member.
-
#title ⇒ String?
The title (honourific) of the staff member.
Instance Method Summary collapse
-
#initialize(xml = nil, lookup = nil, department: nil, faculty: nil, forename: nil, identity: nil, institution: nil, preferred_name: nil, surname: nil, title: nil) ⇒ void
constructor
Initialises a new StaffMember instance.
-
#to_s ⇒ String
Returns a string representation of the staff member (full name).
Constructor Details
#initialize(xml = nil, lookup = nil, department: nil, faculty: nil, forename: nil, identity: nil, institution: nil, preferred_name: nil, surname: nil, title: nil) ⇒ void
Initialises a new StaffMember instance
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/lusi_api/person/staff.rb', line 87 def initialize(xml = nil, lookup = nil, department: nil, faculty: nil, forename: nil, identity: nil, institution: nil, preferred_name: nil, surname: nil, title: nil) @department = LUSI::API::Core::XML.lookup(xml, lookup, :department, 'xmlns:Department/xmlns:Identity', department) @faculty = LUSI::API::Core::XML.lookup(xml, lookup, :faculty, 'xmlns:Faculty/xmlns:Identity', faculty) @forename = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Forename', forename) @identity = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Identity', identity) @institution = LUSI::API::Core::XML.lookup(xml, lookup, :institution, 'xmlns:Institution/xmlns:Identity', institution) @preferred_name = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:PreferredName', preferred_name) @surname = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Surname', surname) @title = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Title', title) end |
Instance Attribute Details
#department ⇒ LUSI::API::Organisation::Unit?
Returns the staff member’s associated department.
65 66 67 |
# File 'lib/lusi_api/person/staff.rb', line 65 def department @department end |
#faculty ⇒ LUSI::API::Organisation::Unit?
Returns the staff member’s associated faculty.
69 70 71 |
# File 'lib/lusi_api/person/staff.rb', line 69 def faculty @faculty end |
#forename ⇒ String?
Returns the forename of the staff member.
57 58 59 |
# File 'lib/lusi_api/person/staff.rb', line 57 def forename @forename end |
#identity ⇒ String?
Returns the identity code of the staff member.
45 46 47 |
# File 'lib/lusi_api/person/staff.rb', line 45 def identity @identity end |
#institution ⇒ LUSI::API::Organisation::Unit?
Returns the staff member’s associated institution.
73 74 75 |
# File 'lib/lusi_api/person/staff.rb', line 73 def institution @institution end |
#preferred_name ⇒ String?
Returns the preferred name of the staff member.
61 62 63 |
# File 'lib/lusi_api/person/staff.rb', line 61 def preferred_name @preferred_name end |
#surname ⇒ String?
Returns the surname of the staff member.
53 54 55 |
# File 'lib/lusi_api/person/staff.rb', line 53 def surname @surname end |
#title ⇒ String?
Returns the title (honourific) of the staff member.
49 50 51 |
# File 'lib/lusi_api/person/staff.rb', line 49 def title @title end |
Instance Method Details
#to_s ⇒ String
Returns a string representation of the staff member (full name)
103 104 105 106 107 108 |
# File 'lib/lusi_api/person/staff.rb', line 103 def to_s str = "#{@title} #{@forename} #{@surname}" str.strip! str.squeeze!(' ') str end |