Class: LUSI::API::Person::Student
- Inherits:
-
Object
- Object
- LUSI::API::Person::Student
- Defined in:
- lib/lusi_api/person/student.rb
Overview
Represents a person (student) in the LUSI API
Instance Attribute Summary collapse
-
#contact_detail ⇒ LUSI::API::Person::ContactDetail?
The person’s contact details.
-
#date_of_birth ⇒ DateTime?
The person’s date of birth.
-
#fee_status ⇒ String?
The person’s fee status.
-
#forenames ⇒ Object
!@attribute [rw] forenames @return [String, nil] the person’s full forenames (space-separated string).
-
#gender ⇒ String?
The person’s gender.
-
#nationality ⇒ LUSI::API::Country::Nationality
The person’s nationality.
-
#preferred_name ⇒ String?
The person’s preferred name.
-
#student_records ⇒ Array<LUSI::API::Person::StudentRecord>?
The person’s student record list.
-
#surname ⇒ Object
!@attribute [rw] surname @return [String, nil] the person’s surname.
-
#title ⇒ String?
The person’s title (honourific).
Class Method Summary collapse
-
.get_instance(api, lookup = nil, lancaster_student_id: nil, external_student_id: nil, user_login: nil, relationship_is_current_only: nil, relationship_identity: nil) {|obj| ... } ⇒ Array<Student>?
Returns an array of Student instances matching the search parameters.
Instance Method Summary collapse
-
#initialize(xml = nil, lookup = nil, title: nil, surname: nil, forenames: nil, preferred_name: nil, date_of_birth: nil, gender: nil, fee_status: nil, nationality: nil, contact_detail: nil, student_records: nil) ⇒ void
constructor
Initialises a new Person instance.
-
#to_s ⇒ String
Returns a string representation of the person (full title and names).
Constructor Details
#initialize(xml = nil, lookup = nil, title: nil, surname: nil, forenames: nil, preferred_name: nil, date_of_birth: nil, gender: nil, fee_status: nil, nationality: nil, contact_detail: nil, student_records: nil) ⇒ void
Initialises a new Person instance
510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
# File 'lib/lusi_api/person/student.rb', line 510 def initialize(xml = nil, lookup = nil, title: nil, surname: nil, forenames: nil, preferred_name: nil, date_of_birth: nil, gender: nil, fee_status: nil, nationality: nil, contact_detail: nil, student_records: nil) @title = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Title', title) @surname = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Surname', surname) @forenames = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Forenames', forenames) @preferred_name = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:PreferredName', preferred_name) @date_of_birth = LUSI::API::Core::XML.xml_datetime_at(xml, 'xmlns:DateOfBirth', date_of_birth) @gender = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:Gender', gender) @fee_status = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:FeeStatus', fee_status) @nationality = LUSI::API::Core::XML.lookup(xml, lookup, :nationality, 'xmlns:Nationality', nationality) @contact_detail = ContactDetail.new(LUSI::API::Core::XML.xml_at(xml, 'xmlns:ContactDetail', contact_detail), lookup) @student_records = LUSI::API::Core::XML.xml(xml, 'xmlns:StudentRecords/xmlns:StudentRecord', student_records) { |r| StudentRecord.new(r, lookup) } end |
Instance Attribute Details
#contact_detail ⇒ LUSI::API::Person::ContactDetail?
Returns the person’s contact details.
464 465 466 |
# File 'lib/lusi_api/person/student.rb', line 464 def contact_detail @contact_detail end |
#date_of_birth ⇒ DateTime?
Returns the person’s date of birth.
448 449 450 |
# File 'lib/lusi_api/person/student.rb', line 448 def date_of_birth @date_of_birth end |
#fee_status ⇒ String?
Returns the person’s fee status.
456 457 458 |
# File 'lib/lusi_api/person/student.rb', line 456 def fee_status @fee_status end |
#forenames ⇒ Object
!@attribute [rw] forenames
@return [String, nil] the person's full forenames (space-separated string)
440 441 442 |
# File 'lib/lusi_api/person/student.rb', line 440 def forenames @forenames end |
#gender ⇒ String?
Returns the person’s gender.
452 453 454 |
# File 'lib/lusi_api/person/student.rb', line 452 def gender @gender end |
#nationality ⇒ LUSI::API::Country::Nationality
Returns the person’s nationality.
460 461 462 |
# File 'lib/lusi_api/person/student.rb', line 460 def nationality @nationality end |
#preferred_name ⇒ String?
Returns the person’s preferred name.
444 445 446 |
# File 'lib/lusi_api/person/student.rb', line 444 def preferred_name @preferred_name end |
#student_records ⇒ Array<LUSI::API::Person::StudentRecord>?
Returns the person’s student record list.
468 469 470 |
# File 'lib/lusi_api/person/student.rb', line 468 def student_records @student_records end |
#surname ⇒ Object
!@attribute [rw] surname
@return [String, nil] the person's surname
436 437 438 |
# File 'lib/lusi_api/person/student.rb', line 436 def surname @surname end |
#title ⇒ String?
Returns the person’s title (honourific).
432 433 434 |
# File 'lib/lusi_api/person/student.rb', line 432 def title @title end |
Class Method Details
.get_instance(api, lookup = nil, lancaster_student_id: nil, external_student_id: nil, user_login: nil, relationship_is_current_only: nil, relationship_identity: nil) {|obj| ... } ⇒ Array<Student>?
Returns an array of Student instances matching the search parameters
482 483 484 485 486 487 488 489 490 491 492 493 494 |
# File 'lib/lusi_api/person/student.rb', line 482 def self.get_instance(api, lookup = nil, lancaster_student_id: nil, external_student_id: nil, user_login: nil, relationship_is_current_only: nil, relationship_identity: nil) params = get_instance_params(lancaster_student_id: lancaster_student_id, external_student_id: external_student_id, user_login: user_login, relationship_is_current_only: relationship_is_current_only, relationship_identity: relationship_identity) xml = api.call('UserDetails', 'StudentManager.asmx', 'GetFullDetails', **params) LUSI::API::Core::XML.xml(xml, 'xmlns:Person') do |p| obj = Student.new(p, lookup) yield(obj) if block_given? obj end end |
Instance Method Details
#to_s ⇒ String
Returns a string representation of the person (full title and names)
529 530 531 |
# File 'lib/lusi_api/person/student.rb', line 529 def to_s "#{@title} #{@sforenames} #{@surname}".squeeze!(' ').strip! end |