Class: Taxamo::CountrySchema
- Defined in:
- lib/taxamo/models/countryschema.rb
Instance Attribute Summary collapse
-
#calling_code ⇒ Object
Returns the value of attribute calling_code.
-
#cca2 ⇒ Object
Returns the value of attribute cca2.
-
#cca3 ⇒ Object
Returns the value of attribute cca3.
-
#ccn3 ⇒ Object
Returns the value of attribute ccn3.
-
#code ⇒ Object
Returns the value of attribute code.
-
#code_long ⇒ Object
Returns the value of attribute code_long.
-
#codenum ⇒ Object
Returns the value of attribute codenum.
-
#currency ⇒ Object
Returns the value of attribute currency.
-
#name ⇒ Object
Returns the value of attribute name.
-
#tax_number_country_code ⇒ Object
Returns the value of attribute tax_number_country_code.
-
#tax_region ⇒ Object
Returns the value of attribute tax_region.
-
#tax_supported ⇒ Object
Returns the value of attribute tax_supported.
Class Method Summary collapse
-
.attribute_map ⇒ Object
:internal => :external.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ CountrySchema
constructor
A new instance of CountrySchema.
- #to_body ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ CountrySchema
Returns a new instance of CountrySchema.
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 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/taxamo/models/countryschema.rb', line 36 def initialize(attributes = {}) return if attributes.nil? or attributes.empty? # Morph attribute keys into undescored rubyish style if attributes.key?("code_long") @code_long = attributes["code_long"] end if attributes.key?("codenum") @codenum = attributes["codenum"] end if attributes.key?("currency") if (value = attributes["currency"]).is_a?(Array) @currency = value end end if attributes.key?("tax_supported") @tax_supported = attributes["tax_supported"] end if attributes.key?("name") @name = attributes["name"] end if attributes.key?("ccn3") @ccn3 = attributes["ccn3"] end if attributes.key?("tax_region") @tax_region = attributes["tax_region"] end if attributes.key?("cca3") @cca3 = attributes["cca3"] end if attributes.key?("calling_code") if (value = attributes["callingCode"]).is_a?(Array) @calling_code = value end end if attributes.key?("tax_number_country_code") @tax_number_country_code = attributes["tax_number_country_code"] end if attributes.key?("code") @code = attributes["code"] end if attributes.key?("cca2") @cca2 = attributes["cca2"] end end |
Instance Attribute Details
#calling_code ⇒ Object
Returns the value of attribute calling_code.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def calling_code @calling_code end |
#cca2 ⇒ Object
Returns the value of attribute cca2.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def cca2 @cca2 end |
#cca3 ⇒ Object
Returns the value of attribute cca3.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def cca3 @cca3 end |
#ccn3 ⇒ Object
Returns the value of attribute ccn3.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def ccn3 @ccn3 end |
#code ⇒ Object
Returns the value of attribute code.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def code @code end |
#code_long ⇒ Object
Returns the value of attribute code_long.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def code_long @code_long end |
#codenum ⇒ Object
Returns the value of attribute codenum.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def codenum @codenum end |
#currency ⇒ Object
Returns the value of attribute currency.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def currency @currency end |
#name ⇒ Object
Returns the value of attribute name.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def name @name end |
#tax_number_country_code ⇒ Object
Returns the value of attribute tax_number_country_code.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def tax_number_country_code @tax_number_country_code end |
#tax_region ⇒ Object
Returns the value of attribute tax_region.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def tax_region @tax_region end |
#tax_supported ⇒ Object
Returns the value of attribute tax_supported.
15 16 17 |
# File 'lib/taxamo/models/countryschema.rb', line 15 def tax_supported @tax_supported end |
Class Method Details
.attribute_map ⇒ Object
:internal => :external
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/taxamo/models/countryschema.rb', line 18 def self.attribute_map { :code_long => :code_long, :codenum => :codenum, :currency => :currency, :tax_supported => :tax_supported, :name => :name, :ccn3 => :ccn3, :tax_region => :tax_region, :cca3 => :cca3, :calling_code => :callingCode, :tax_number_country_code => :tax_number_country_code, :code => :code, :cca2 => :cca2 } end |
Instance Method Details
#to_body ⇒ Object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/taxamo/models/countryschema.rb', line 93 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 |