Class: Taxamo::InvoiceAddress
- Defined in:
- lib/taxamo/models/invoiceaddress.rb
Instance Attribute Summary collapse
-
#address_detail ⇒ Object
Returns the value of attribute address_detail.
-
#building_number ⇒ Object
Returns the value of attribute building_number.
-
#city ⇒ Object
Returns the value of attribute city.
-
#country ⇒ Object
Returns the value of attribute country.
-
#freeform_address ⇒ Object
Returns the value of attribute freeform_address.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#region ⇒ Object
Returns the value of attribute region.
-
#street_name ⇒ Object
Returns the value of attribute street_name.
Class Method Summary collapse
-
.attribute_map ⇒ Object
:internal => :external.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ InvoiceAddress
constructor
A new instance of InvoiceAddress.
- #to_body ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ InvoiceAddress
Returns a new instance of InvoiceAddress.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 32 def initialize(attributes = {}) return if attributes.nil? or attributes.empty? # Morph attribute keys into undescored rubyish style if attributes.key?("freeform_address") @freeform_address = attributes["freeform_address"] end if attributes.key?("building_number") @building_number = attributes["building_number"] end if attributes.key?("street_name") @street_name = attributes["street_name"] end if attributes.key?("address_detail") @address_detail = attributes["address_detail"] end if attributes.key?("city") @city = attributes["city"] end if attributes.key?("postal_code") @postal_code = attributes["postal_code"] end if attributes.key?("region") @region = attributes["region"] end if attributes.key?("country") @country = attributes["country"] end end |
Instance Attribute Details
#address_detail ⇒ Object
Returns the value of attribute address_detail.
15 16 17 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 15 def address_detail @address_detail end |
#building_number ⇒ Object
Returns the value of attribute building_number.
15 16 17 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 15 def building_number @building_number end |
#city ⇒ Object
Returns the value of attribute city.
15 16 17 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 15 def city @city end |
#country ⇒ Object
Returns the value of attribute country.
15 16 17 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 15 def country @country end |
#freeform_address ⇒ Object
Returns the value of attribute freeform_address.
15 16 17 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 15 def freeform_address @freeform_address end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
15 16 17 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 15 def postal_code @postal_code end |
#region ⇒ Object
Returns the value of attribute region.
15 16 17 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 15 def region @region end |
#street_name ⇒ Object
Returns the value of attribute street_name.
15 16 17 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 15 def street_name @street_name end |
Class Method Details
.attribute_map ⇒ Object
:internal => :external
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 18 def self.attribute_map { :freeform_address => :freeform_address, :building_number => :building_number, :street_name => :street_name, :address_detail => :address_detail, :city => :city, :postal_code => :postal_code, :region => :region, :country => :country } end |
Instance Method Details
#to_body ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/taxamo/models/invoiceaddress.rb', line 71 def to_body body = {} self.class.attribute_map.each_pair do |key, value| v = self.send(key) unless v.nil? if v.is_a?(Array) array = Array.new v.each do |item| if item.respond_to?("to_body".to_sym) array.push item.to_body else array.push item end end body[value] = array else if v.respond_to?("to_body".to_sym) body[value] = v.to_body else body[value] = v end end end end body end |