class Taxamo::Country
Attributes
calling_code[RW]
cca2[RW]
cca3[RW]
ccn3[RW]
code[RW]
code_long[RW]
codenum[RW]
currency[RW]
name[RW]
tax_number_country_code[RW]
tax_region[RW]
tax_supported[RW]
Public Class Methods
attribute_map()
click to toggle source
:internal => :external
# File lib/taxamo/models/country.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
new(attributes = {})
click to toggle source
# File lib/taxamo/models/country.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
Public Instance Methods
to_body()
click to toggle source
# File lib/taxamo/models/country.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