Class: Taxamo::CountrySchema

Inherits:
Object
  • Object
show all
Defined in:
lib/taxamo/models/countryschema.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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_codeObject

Returns the value of attribute calling_code.



15
16
17
# File 'lib/taxamo/models/countryschema.rb', line 15

def calling_code
  @calling_code
end

#cca2Object

Returns the value of attribute cca2.



15
16
17
# File 'lib/taxamo/models/countryschema.rb', line 15

def cca2
  @cca2
end

#cca3Object

Returns the value of attribute cca3.



15
16
17
# File 'lib/taxamo/models/countryschema.rb', line 15

def cca3
  @cca3
end

#ccn3Object

Returns the value of attribute ccn3.



15
16
17
# File 'lib/taxamo/models/countryschema.rb', line 15

def ccn3
  @ccn3
end

#codeObject

Returns the value of attribute code.



15
16
17
# File 'lib/taxamo/models/countryschema.rb', line 15

def code
  @code
end

#code_longObject

Returns the value of attribute code_long.



15
16
17
# File 'lib/taxamo/models/countryschema.rb', line 15

def code_long
  @code_long
end

#codenumObject

Returns the value of attribute codenum.



15
16
17
# File 'lib/taxamo/models/countryschema.rb', line 15

def codenum
  @codenum
end

#currencyObject

Returns the value of attribute currency.



15
16
17
# File 'lib/taxamo/models/countryschema.rb', line 15

def currency
  @currency
end

#nameObject

Returns the value of attribute name.



15
16
17
# File 'lib/taxamo/models/countryschema.rb', line 15

def name
  @name
end

#tax_number_country_codeObject

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_regionObject

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_supportedObject

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_mapObject

: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_bodyObject



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