class LUSI::API::Person::StaffMember
Attributes
@!attribute [rw] department
@return [LUSI::API::Organisation::Unit, nil] the staff member's associated department
@!attribute [rw] faculty
@return [LUSI::API::Organisation::Unit, nil] the staff member's associated faculty
@!attribute [rw] forename
@return [String, nil] the forename of the staff member
@!attribute [rw] identity
@return [String, nil] the identity code of the staff member
@!attribute [rw] institution
@return [LUSI::API::Organisation::Unit, nil] the staff member's associated institution
@!attribute [rw] preferred_name
@return [String, nil] the preferred name of the staff member
@!attribute [rw] surname
@return [String, nil] the surname of the staff member
@!attribute [rw] title
@return [String, nil] the title (honourific) of the staff member
Public Class Methods
Initialises a new StaffMember
instance @param xml [Nokogiri::XML::Document, Nokogiri::XML::Node] the parsed XML root of the staff member @param lookup [LUSI::API::Core::LookupTable, nil] the lookup service for organisation unit resolution @param department [LUSI::API::Organisation::Unit, nil] the default department @param faculty [LUSI::API::Organisation::Unit, nil] the default faculty @param forename [String, nil] the default forename @param identity [String, nil] the default identity code @param institution [LUSI::API::Organisation::Unit, nil] the default institution @param preferred_name
[String, nil] the default preferred name @param surname [String, nil] the default surname @param title [String, nil] the default title (honourific) @return [void]
# 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
Public Instance Methods
Returns a string representation of the staff member (full name) @return [String] the string representation of the staff member (full name)
# File lib/lusi_api/person/staff.rb, line 103 def to_s str = "#{@title} #{@forename} #{@surname}" str.strip! str.squeeze!(' ') str end