Class: TopsConnect::Address
Constant Summary collapse
- TYPES =
{ 'Main' => 1, 'Home' => 2, 'Work' => 3, 'Other' => 4, 'Return Payment' => 5, 'Lockbox' => 6, 'Community Office' => 7, 'Management Office' => 8, 'Alternate' => 9, 'Billing' => 10, 'Property' => 11, 'Shipping' => 12 }.freeze
Instance Attribute Summary collapse
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(data, owner:) ⇒ Address
constructor
A new instance of Address.
- #to_s ⇒ Object (also: #formatted)
- #type ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(data, owner:) ⇒ Address
Returns a new instance of Address.
25 26 27 28 29 |
# File 'lib/tops_connect/address.rb', line 25 def initialize(data, owner:) super(data) @owner = owner end |
Instance Attribute Details
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
8 9 10 |
# File 'lib/tops_connect/address.rb', line 8 def owner @owner end |
Instance Method Details
#to_s ⇒ Object Also known as: formatted
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/tops_connect/address.rb', line 35 def to_s lines = address_lines return if lines.empty? # Foreign addresses do not have City/State/Zip if @data['City'] && @data['State'] && @data['Zip'] lines << "#{@data['City']}, #{@data['State']} #{@data['Zip']}" end lines.map(&:strip).join("\n") end |
#type ⇒ Object
31 32 33 |
# File 'lib/tops_connect/address.rb', line 31 def type @data['Type']['Name'] end |