Class: Vantaca::Models::Address
- Defined in:
- lib/vantaca/models/address.rb
Overview
Information about an address, received from the Vantaca API
Instance Attribute Summary collapse
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
Attributes inherited from Base
Instance Method Summary collapse
- #address1 ⇒ Object
- #address2 ⇒ Object
- #city ⇒ Object
- #id ⇒ Object
-
#initialize(data, owner:) ⇒ Address
constructor
A new instance of Address.
- #international? ⇒ Boolean
- #label ⇒ Object
- #mailing? ⇒ Boolean
- #state ⇒ Object
- #to_s ⇒ Object (also: #formatted)
- #zip ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(data, owner:) ⇒ Address
12 13 14 15 16 |
# File 'lib/vantaca/models/address.rb', line 12 def initialize(data, owner:) super(data) @owner = owner end |
Instance Attribute Details
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
10 11 12 |
# File 'lib/vantaca/models/address.rb', line 10 def owner @owner end |
Instance Method Details
#address1 ⇒ Object
26 |
# File 'lib/vantaca/models/address.rb', line 26 def address1 = data['address1'] |
#address2 ⇒ Object
28 |
# File 'lib/vantaca/models/address.rb', line 28 def address2 = data['address2'] |
#city ⇒ Object
30 |
# File 'lib/vantaca/models/address.rb', line 30 def city = data['city'] |
#id ⇒ Object
18 |
# File 'lib/vantaca/models/address.rb', line 18 def id = data['addrID'] |
#international? ⇒ Boolean
24 |
# File 'lib/vantaca/models/address.rb', line 24 def international? = data['isInternational'] |
#label ⇒ Object
20 |
# File 'lib/vantaca/models/address.rb', line 20 def label = data['label'] |
#mailing? ⇒ Boolean
22 |
# File 'lib/vantaca/models/address.rb', line 22 def mailing? = data['isMailing'] |
#state ⇒ Object
32 |
# File 'lib/vantaca/models/address.rb', line 32 def state = data['state'] |
#to_s ⇒ Object Also known as: formatted
36 37 38 39 40 41 42 |
# File 'lib/vantaca/models/address.rb', line 36 def to_s [ (data['address1'] if data['address1'].match?(/[[:graph:]]/)), (data['address2'] if data['address2'].match?(/[[:graph:]]/)), city_state_zip ].compact.map(&:strip).join("\n") end |
#zip ⇒ Object
34 |
# File 'lib/vantaca/models/address.rb', line 34 def zip = data['zip'] |