Class: LUSI::API::Person::Relationship
- Inherits:
-
Object
- Object
- LUSI::API::Person::Relationship
- Defined in:
- lib/lusi_api/person/student.rb
Overview
Represents a student’s relationship with a member of staff
Instance Attribute Summary collapse
-
#staff_relationship ⇒ LUSI::API::Core::Code?
The staff relationship type.
-
#user_contact ⇒ LUSI::API::Person::UserContact?
The related person’s contact details.
Instance Method Summary collapse
-
#initialize(xml = nil, lookup = nil, staff_relationship: nil, user_contact: nil) ⇒ Relationship
constructor
Initialises a new Relationship instance.
-
#to_s ⇒ Object
Returns a string representation of the relationship.
Constructor Details
#initialize(xml = nil, lookup = nil, staff_relationship: nil, user_contact: nil) ⇒ Relationship
Initialises a new Relationship instance
239 240 241 242 243 |
# File 'lib/lusi_api/person/student.rb', line 239 def initialize(xml = nil, lookup = nil, staff_relationship: nil, user_contact: nil) @staff_relationship = LUSI::API::Core::Code.new( LUSI::API::Core::XML.xml_at(xml, 'xmlns:StaffRelationship', staff_relationship), lookup) @user_contact = UserContact.new(LUSI::API::Core::XML.xml_at(xml, 'xmlns:UserContact', user_contact), lookup) end |
Instance Attribute Details
#staff_relationship ⇒ LUSI::API::Core::Code?
Returns the staff relationship type.
228 229 230 |
# File 'lib/lusi_api/person/student.rb', line 228 def staff_relationship @staff_relationship end |
#user_contact ⇒ LUSI::API::Person::UserContact?
Returns the related person’s contact details.
232 233 234 |
# File 'lib/lusi_api/person/student.rb', line 232 def user_contact @user_contact end |
Instance Method Details
#to_s ⇒ Object
Returns a string representation of the relationship
246 247 248 249 250 |
# File 'lib/lusi_api/person/student.rb', line 246 def to_s contact = @user_contact ? @user_contact.contact_name : '' description = @staff_relationship ? "#{@staff_relationship.description}: " : '' "#{description}#{contact}" end |