Class: Taxamo::Countries

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Countries

Returns a new instance of Countries.



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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/taxamo/models/countries.rb', line 35

def initialize(attributes = {})
  return if attributes.nil? or attributes.empty?
  # Morph attribute keys into undescored rubyish style
  if attributes.key?("by_token")
    @by_token = CountrySchema.new(attributes["by_token"])
      
  end
  if attributes.key?("by_cc")
    @by_cc = CountrySchema.new(attributes["by_cc"])
      
  end
  if attributes.key?("by_2003_rules")
    @by_2003_rules = CountrySchema.new(attributes["by_2003_rules"])
      
  end
  if attributes.key?("forced")
    @forced = CountrySchema.new(attributes["forced"])
      
  end
  if attributes.key?("by_ip")
    @by_ip = CountrySchema.new(attributes["by_ip"])
      
  end
  if attributes.key?("guessed_from_ip")
    @guessed_from_ip = CountrySchema.new(attributes["guessed_from_ip"])
      
  end
  if attributes.key?("other_commercially_relevant_info")
    @other_commercially_relevant_info = CountrySchema.new(attributes["other_commercially_relevant_info"])
      
  end
  if attributes.key?("by_billing")
    @by_billing = CountrySchema.new(attributes["by_billing"])
      
  end
  if attributes.key?("by_tax_number")
    @by_tax_number = CountrySchema.new(attributes["by_tax_number"])
      
  end
  if attributes.key?("detected")
    @detected = CountrySchema.new(attributes["detected"])
      
  end
  if attributes.key?("self_declaration")
    @self_declaration = CountrySchema.new(attributes["self_declaration"])
      
  end
  

end

Instance Attribute Details

#by_2003_rulesObject

Returns the value of attribute by_2003_rules.



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

def by_2003_rules
  @by_2003_rules
end

#by_billingObject

Returns the value of attribute by_billing.



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

def by_billing
  @by_billing
end

#by_ccObject

Returns the value of attribute by_cc.



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

def by_cc
  @by_cc
end

#by_ipObject

Returns the value of attribute by_ip.



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

def by_ip
  @by_ip
end

#by_tax_numberObject

Returns the value of attribute by_tax_number.



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

def by_tax_number
  @by_tax_number
end

#by_tokenObject

Returns the value of attribute by_token.



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

def by_token
  @by_token
end

#detectedObject

Returns the value of attribute detected.



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

def detected
  @detected
end

#forcedObject

Returns the value of attribute forced.



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

def forced
  @forced
end

#guessed_from_ipObject

Returns the value of attribute guessed_from_ip.



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

def guessed_from_ip
  @guessed_from_ip
end

#other_commercially_relevant_infoObject

Returns the value of attribute other_commercially_relevant_info.



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

def other_commercially_relevant_info
  @other_commercially_relevant_info
end

#self_declarationObject

Returns the value of attribute self_declaration.



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

def self_declaration
  @self_declaration
end

Class Method Details

.attribute_mapObject

:internal => :external



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/taxamo/models/countries.rb', line 18

def self.attribute_map
  {
    :by_token => :by_token,
    :by_cc => :by_cc,
    :by_2003_rules => :by_2003_rules,
    :forced => :forced,
    :by_ip => :by_ip,
    :guessed_from_ip => :guessed_from_ip,
    :other_commercially_relevant_info => :other_commercially_relevant_info,
    :by_billing => :by_billing,
    :by_tax_number => :by_tax_number,
    :detected => :detected,
    :self_declaration => :self_declaration

  }
end

Instance Method Details

#to_bodyObject



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/taxamo/models/countries.rb', line 86

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