Class: LUSI::API::Person::PersonAddress
- Inherits:
-
Object
- Object
- LUSI::API::Person::PersonAddress
- Defined in:
- lib/lusi_api/person/student.rb
Overview
Represents a person’s postal address
Instance Attribute Summary collapse
-
#address_line_1 ⇒ String?
The first address line.
-
#address_line_2 ⇒ String?
The second address line.
-
#address_line_3 ⇒ String?
The third address line.
-
#address_line_4 ⇒ String?
The fourth address line.
-
#address_line_5 ⇒ String?
The fifth address line.
-
#address_type ⇒ String?
The address type (e.g. ‘Termtime Address’).
-
#country ⇒ LUSI::API::Person::AddressCountry?
The country.
-
#post_code ⇒ String?
The postal or zip code.
Instance Method Summary collapse
-
#initialize(xml = nil, lookup = nil, address_type: nil, address_line_1: nil, address_line_2: nil, address_line_3: nil, address_line_4: nil, address_line_5: nil, post_code: nil, country: nil) ⇒ void
constructor
Initialises a PersonAddress instance.
-
#to_s(sep = nil) ⇒ String
Returns a string representation of the PersonAddress instance.
Constructor Details
#initialize(xml = nil, lookup = nil, address_type: nil, address_line_1: nil, address_line_2: nil, address_line_3: nil, address_line_4: nil, address_line_5: nil, post_code: nil, country: nil) ⇒ void
Initialises a PersonAddress instance
99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/lusi_api/person/student.rb', line 99 def initialize(xml = nil, lookup = nil, address_type: nil, address_line_1: nil, address_line_2: nil, address_line_3: nil, address_line_4: nil, address_line_5: nil, post_code: nil, country: nil) @address_type = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:AddressType', address_type) @address_line_1 = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:AddressLine1', address_line_1) @address_line_2 = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:AddressLine2', address_line_2) @address_line_3 = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:AddressLine3', address_line_3) @address_line_4 = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:AddressLine4', address_line_4) @address_line_5 = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:AddressLine5', address_line_5) @post_code = LUSI::API::Core::XML.xml_content_at(xml, 'xmlns:PostCode', post_code) @country = LUSI::API::Core::XML.lookup(xml, lookup, :address_country, 'xmlns:Country/xmlns:Identity', country) end |
Instance Attribute Details
#address_line_1 ⇒ String?
Returns the first address line.
61 62 63 |
# File 'lib/lusi_api/person/student.rb', line 61 def address_line_1 @address_line_1 end |
#address_line_2 ⇒ String?
Returns the second address line.
65 66 67 |
# File 'lib/lusi_api/person/student.rb', line 65 def address_line_2 @address_line_2 end |
#address_line_3 ⇒ String?
Returns the third address line.
69 70 71 |
# File 'lib/lusi_api/person/student.rb', line 69 def address_line_3 @address_line_3 end |
#address_line_4 ⇒ String?
Returns the fourth address line.
73 74 75 |
# File 'lib/lusi_api/person/student.rb', line 73 def address_line_4 @address_line_4 end |
#address_line_5 ⇒ String?
Returns the fifth address line.
77 78 79 |
# File 'lib/lusi_api/person/student.rb', line 77 def address_line_5 @address_line_5 end |
#address_type ⇒ String?
Returns the address type (e.g. ‘Termtime Address’).
57 58 59 |
# File 'lib/lusi_api/person/student.rb', line 57 def address_type @address_type end |
#country ⇒ LUSI::API::Person::AddressCountry?
Returns the country.
85 86 87 |
# File 'lib/lusi_api/person/student.rb', line 85 def country @country end |
#post_code ⇒ String?
Returns the postal or zip code.
81 82 83 |
# File 'lib/lusi_api/person/student.rb', line 81 def post_code @post_code end |
Instance Method Details
#to_s(sep = nil) ⇒ String
Returns a string representation of the PersonAddress instance
113 114 115 116 117 118 119 120 121 122 |
# File 'lib/lusi_api/person/student.rb', line 113 def to_s(sep = nil) sep ||= ', ' fields = [] [@address_type, @address_line_1, @address_line_2, @address_line_3, @address_line_4, @address_line_5, @post_code, @country].each do |field| field_s = field.to_s fields.push(field_s) unless field_s.nil? || field_s.empty? end fields.join(sep) end |