taxamo-ns 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (97) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/LICENSE +11 -0
  4. data/README.md +152 -0
  5. data/Rakefile +7 -0
  6. data/lib/monkey.rb +90 -0
  7. data/lib/swagger/configuration.rb +21 -0
  8. data/lib/swagger/request.rb +199 -0
  9. data/lib/swagger/response.rb +87 -0
  10. data/lib/swagger.rb +93 -0
  11. data/lib/taxamo/models/additionalcurrencies.rb +63 -0
  12. data/lib/taxamo/models/additionalcurrency.rb +88 -0
  13. data/lib/taxamo/models/bycountry.rb +78 -0
  14. data/lib/taxamo/models/bystatus.rb +70 -0
  15. data/lib/taxamo/models/bytaxationtype.rb +83 -0
  16. data/lib/taxamo/models/c.rb +78 -0
  17. data/lib/taxamo/models/calculatesimpletaxout.rb +75 -0
  18. data/lib/taxamo/models/calculatetaxin.rb +63 -0
  19. data/lib/taxamo/models/calculatetaxlocationout.rb +98 -0
  20. data/lib/taxamo/models/calculatetaxout.rb +75 -0
  21. data/lib/taxamo/models/canceltransactionout.rb +63 -0
  22. data/lib/taxamo/models/capturepaymentout.rb +63 -0
  23. data/lib/taxamo/models/confirmtransactionin.rb +63 -0
  24. data/lib/taxamo/models/confirmtransactionout.rb +75 -0
  25. data/lib/taxamo/models/countries.rb +113 -0
  26. data/lib/taxamo/models/country.rb +120 -0
  27. data/lib/taxamo/models/countryschema.rb +120 -0
  28. data/lib/taxamo/models/createpaymentin.rb +73 -0
  29. data/lib/taxamo/models/createpaymentout.rb +63 -0
  30. data/lib/taxamo/models/createrefundin.rb +83 -0
  31. data/lib/taxamo/models/createrefundout.rb +78 -0
  32. data/lib/taxamo/models/createsmstokenin.rb +68 -0
  33. data/lib/taxamo/models/createsmstokenout.rb +63 -0
  34. data/lib/taxamo/models/createtransactionin.rb +68 -0
  35. data/lib/taxamo/models/createtransactionout.rb +75 -0
  36. data/lib/taxamo/models/currencyschema.rb +83 -0
  37. data/lib/taxamo/models/customfields.rb +68 -0
  38. data/lib/taxamo/models/emailinvoicein.rb +63 -0
  39. data/lib/taxamo/models/emailinvoiceout.rb +63 -0
  40. data/lib/taxamo/models/emailrefundin.rb +63 -0
  41. data/lib/taxamo/models/emailrefundout.rb +63 -0
  42. data/lib/taxamo/models/evidence.rb +113 -0
  43. data/lib/taxamo/models/evidenceschema.rb +78 -0
  44. data/lib/taxamo/models/getcountriesdictout.rb +64 -0
  45. data/lib/taxamo/models/getcurrenciesdictout.rb +64 -0
  46. data/lib/taxamo/models/getdailysettlementstatsout.rb +64 -0
  47. data/lib/taxamo/models/getdetailedrefundsout.rb +64 -0
  48. data/lib/taxamo/models/getdomesticsummaryreportout.rb +123 -0
  49. data/lib/taxamo/models/geteuviesreportout.rb +79 -0
  50. data/lib/taxamo/models/getproducttypesdictout.rb +64 -0
  51. data/lib/taxamo/models/getrefundsout.rb +64 -0
  52. data/lib/taxamo/models/getsettlementout.rb +84 -0
  53. data/lib/taxamo/models/getsettlementstatsbycountryout.rb +64 -0
  54. data/lib/taxamo/models/getsettlementstatsbytaxationtypeout.rb +63 -0
  55. data/lib/taxamo/models/getsettlementsummaryout.rb +63 -0
  56. data/lib/taxamo/models/gettransactionout.rb +75 -0
  57. data/lib/taxamo/models/gettransactionsstatsbycountryout.rb +64 -0
  58. data/lib/taxamo/models/gettransactionsstatsout.rb +63 -0
  59. data/lib/taxamo/models/inputtransaction.rb +220 -0
  60. data/lib/taxamo/models/inputtransactionline.rb +144 -0
  61. data/lib/taxamo/models/inputtransactionupdate.rb +220 -0
  62. data/lib/taxamo/models/invoiceaddress.rb +98 -0
  63. data/lib/taxamo/models/listpaymentsout.rb +64 -0
  64. data/lib/taxamo/models/listrefundsout.rb +64 -0
  65. data/lib/taxamo/models/listtransactionsout.rb +64 -0
  66. data/lib/taxamo/models/locategivenipout.rb +73 -0
  67. data/lib/taxamo/models/locatemyipout.rb +73 -0
  68. data/lib/taxamo/models/n.rb +78 -0
  69. data/lib/taxamo/models/payments.rb +73 -0
  70. data/lib/taxamo/models/producttypeschema.rb +63 -0
  71. data/lib/taxamo/models/refunds.rb +108 -0
  72. data/lib/taxamo/models/report.rb +103 -0
  73. data/lib/taxamo/models/settlementdailystatsschema.rb +103 -0
  74. data/lib/taxamo/models/storagerequiredfields.rb +63 -0
  75. data/lib/taxamo/models/summary.rb +98 -0
  76. data/lib/taxamo/models/taxdataschema.rb +63 -0
  77. data/lib/taxamo/models/taxrequiredfields.rb +63 -0
  78. data/lib/taxamo/models/transaction.rb +330 -0
  79. data/lib/taxamo/models/transactionlines.rb +174 -0
  80. data/lib/taxamo/models/transactions.rb +330 -0
  81. data/lib/taxamo/models/unconfirmtransactionin.rb +63 -0
  82. data/lib/taxamo/models/unconfirmtransactionout.rb +75 -0
  83. data/lib/taxamo/models/updatetransactionin.rb +63 -0
  84. data/lib/taxamo/models/updatetransactionout.rb +75 -0
  85. data/lib/taxamo/models/ustaxexemptioncertificatedetailsschema.rb +139 -0
  86. data/lib/taxamo/models/ustaxexemptioncertificateschema.rb +68 -0
  87. data/lib/taxamo/models/ustaxexemptstate.rb +73 -0
  88. data/lib/taxamo/models/ustaxid.rb +73 -0
  89. data/lib/taxamo/models/validatetaxnumberout.rb +78 -0
  90. data/lib/taxamo/models/verifysmstokenout.rb +63 -0
  91. data/lib/taxamo/version.rb +17 -0
  92. data/lib/taxamo.rb +1215 -0
  93. data/taxamo.gemspec +28 -0
  94. data/test/taxamo/connectivity_test.rb +55 -0
  95. data/test/taxamo/tax_test.rb +152 -0
  96. data/test/taxamo/transactions_api_test.rb +326 -0
  97. metadata +241 -0
@@ -0,0 +1,220 @@
1
+ # Copyright 2014-2015 Taxamo, Ltd.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ module Taxamo
14
+ class InputTransactionUpdate
15
+ attr_accessor :order_date_type, :buyer_credit_card_prefix, :custom_data, :buyer_name, :invoice_date, :currency_code, :sub_account_id, :supply_date, :invoice_address, :verification_token, :note, :tax_data, :transaction_lines, :buyer_tax_number, :status, :custom_fields, :force_country_code, :invoice_number, :order_date, :customer_id, :comments, :buyer_ip, :buyer_email, :original_transaction_key, :billing_country_code, :custom_id, :additional_currencies, :invoice_place, :evidence, :description, :tax_deducted, :tax_country_code
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :order_date_type => :order_date_type,
21
+ :buyer_credit_card_prefix => :buyer_credit_card_prefix,
22
+ :custom_data => :custom_data,
23
+ :buyer_name => :buyer_name,
24
+ :invoice_date => :invoice_date,
25
+ :currency_code => :currency_code,
26
+ :sub_account_id => :sub_account_id,
27
+ :supply_date => :supply_date,
28
+ :invoice_address => :invoice_address,
29
+ :verification_token => :verification_token,
30
+ :note => :note,
31
+ :tax_data => :tax_data,
32
+ :transaction_lines => :transaction_lines,
33
+ :buyer_tax_number => :buyer_tax_number,
34
+ :status => :status,
35
+ :custom_fields => :custom_fields,
36
+ :force_country_code => :force_country_code,
37
+ :invoice_number => :invoice_number,
38
+ :order_date => :order_date,
39
+ :customer_id => :customer_id,
40
+ :comments => :comments,
41
+ :buyer_ip => :buyer_ip,
42
+ :buyer_email => :buyer_email,
43
+ :original_transaction_key => :original_transaction_key,
44
+ :billing_country_code => :billing_country_code,
45
+ :custom_id => :custom_id,
46
+ :additional_currencies => :additional_currencies,
47
+ :invoice_place => :invoice_place,
48
+ :evidence => :evidence,
49
+ :description => :description,
50
+ :tax_deducted => :tax_deducted,
51
+ :tax_country_code => :tax_country_code
52
+
53
+ }
54
+ end
55
+
56
+ def initialize(attributes = {})
57
+ return if attributes.empty?
58
+ # Morph attribute keys into undescored rubyish style
59
+ if attributes["order_date_type"]
60
+ @order_date_type = attributes["order_date_type"]
61
+
62
+ end
63
+ if attributes["buyer_credit_card_prefix"]
64
+ @buyer_credit_card_prefix = attributes["buyer_credit_card_prefix"]
65
+
66
+ end
67
+ if attributes["custom_data"]
68
+ @custom_data = attributes["custom_data"]
69
+
70
+ end
71
+ if attributes["buyer_name"]
72
+ @buyer_name = attributes["buyer_name"]
73
+
74
+ end
75
+ if attributes["invoice_date"]
76
+ @invoice_date = attributes["invoice_date"]
77
+
78
+ end
79
+ if attributes["currency_code"]
80
+ @currency_code = attributes["currency_code"]
81
+
82
+ end
83
+ if attributes["sub_account_id"]
84
+ @sub_account_id = attributes["sub_account_id"]
85
+
86
+ end
87
+ if attributes["supply_date"]
88
+ @supply_date = attributes["supply_date"]
89
+
90
+ end
91
+ if attributes["invoice_address"]
92
+ @invoice_address = InvoiceAddress.new(attributes["invoice_address"])
93
+
94
+ end
95
+ if attributes["verification_token"]
96
+ @verification_token = attributes["verification_token"]
97
+
98
+ end
99
+ if attributes["note"]
100
+ @note = attributes["note"]
101
+
102
+ end
103
+ if attributes["tax_data"]
104
+ @tax_data = TaxDataSchema.new(attributes["tax_data"])
105
+
106
+ end
107
+ if attributes["transaction_lines"]
108
+ if (value = attributes["transaction_lines"]).is_a?(Array)
109
+ @transaction_lines = value.map{ |v| InputTransactionLine.new(v) }
110
+ end
111
+ end
112
+ if attributes["buyer_tax_number"]
113
+ @buyer_tax_number = attributes["buyer_tax_number"]
114
+
115
+ end
116
+ if attributes["status"]
117
+ @status = attributes["status"]
118
+
119
+ end
120
+ if attributes["custom_fields"]
121
+ if (value = attributes["custom_fields"]).is_a?(Array)
122
+ @custom_fields = value.map{ |v| CustomFields.new(v) }
123
+ end
124
+ end
125
+ if attributes["force_country_code"]
126
+ @force_country_code = attributes["force_country_code"]
127
+
128
+ end
129
+ if attributes["invoice_number"]
130
+ @invoice_number = attributes["invoice_number"]
131
+
132
+ end
133
+ if attributes["order_date"]
134
+ @order_date = attributes["order_date"]
135
+
136
+ end
137
+ if attributes["customer_id"]
138
+ @customer_id = attributes["customer_id"]
139
+
140
+ end
141
+ if attributes["comments"]
142
+ @comments = attributes["comments"]
143
+
144
+ end
145
+ if attributes["buyer_ip"]
146
+ @buyer_ip = attributes["buyer_ip"]
147
+
148
+ end
149
+ if attributes["buyer_email"]
150
+ @buyer_email = attributes["buyer_email"]
151
+
152
+ end
153
+ if attributes["original_transaction_key"]
154
+ @original_transaction_key = attributes["original_transaction_key"]
155
+
156
+ end
157
+ if attributes["billing_country_code"]
158
+ @billing_country_code = attributes["billing_country_code"]
159
+
160
+ end
161
+ if attributes["custom_id"]
162
+ @custom_id = attributes["custom_id"]
163
+
164
+ end
165
+ if attributes["additional_currencies"]
166
+ @additional_currencies = AdditionalCurrencies.new(attributes["additional_currencies"])
167
+
168
+ end
169
+ if attributes["invoice_place"]
170
+ @invoice_place = attributes["invoice_place"]
171
+
172
+ end
173
+ if attributes["evidence"]
174
+ @evidence = Evidence.new(attributes["evidence"])
175
+
176
+ end
177
+ if attributes["description"]
178
+ @description = attributes["description"]
179
+
180
+ end
181
+ if attributes["tax_deducted"]
182
+ @tax_deducted = attributes["tax_deducted"]
183
+
184
+ end
185
+ if attributes["tax_country_code"]
186
+ @tax_country_code = attributes["tax_country_code"]
187
+
188
+ end
189
+
190
+
191
+ end
192
+
193
+ def to_body
194
+ body = {}
195
+ self.class.attribute_map.each_pair do |key, value|
196
+ v = self.send(key)
197
+ unless v.nil?
198
+ if v.is_a?(Array)
199
+ array = Array.new
200
+ v.each do |item|
201
+ if item.respond_to?("to_body".to_sym)
202
+ array.push item.to_body
203
+ else
204
+ array.push item
205
+ end
206
+ end
207
+ body[value] = array
208
+ else
209
+ if v.respond_to?("to_body".to_sym)
210
+ body[value] = v.to_body
211
+ else
212
+ body[value] = v
213
+ end
214
+ end
215
+ end
216
+ end
217
+ body
218
+ end
219
+ end
220
+ end
@@ -0,0 +1,98 @@
1
+ # Copyright 2014-2015 Taxamo, Ltd.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ module Taxamo
14
+ class InvoiceAddress
15
+ attr_accessor :freeform_address, :building_number, :street_name, :address_detail, :city, :postal_code, :region, :country
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :freeform_address => :freeform_address,
21
+ :building_number => :building_number,
22
+ :street_name => :street_name,
23
+ :address_detail => :address_detail,
24
+ :city => :city,
25
+ :postal_code => :postal_code,
26
+ :region => :region,
27
+ :country => :country
28
+
29
+ }
30
+ end
31
+
32
+ def initialize(attributes = {})
33
+ return if attributes.empty?
34
+ # Morph attribute keys into undescored rubyish style
35
+ if attributes["freeform_address"]
36
+ @freeform_address = attributes["freeform_address"]
37
+
38
+ end
39
+ if attributes["building_number"]
40
+ @building_number = attributes["building_number"]
41
+
42
+ end
43
+ if attributes["street_name"]
44
+ @street_name = attributes["street_name"]
45
+
46
+ end
47
+ if attributes["address_detail"]
48
+ @address_detail = attributes["address_detail"]
49
+
50
+ end
51
+ if attributes["city"]
52
+ @city = attributes["city"]
53
+
54
+ end
55
+ if attributes["postal_code"]
56
+ @postal_code = attributes["postal_code"]
57
+
58
+ end
59
+ if attributes["region"]
60
+ @region = attributes["region"]
61
+
62
+ end
63
+ if attributes["country"]
64
+ @country = attributes["country"]
65
+
66
+ end
67
+
68
+
69
+ end
70
+
71
+ def to_body
72
+ body = {}
73
+ self.class.attribute_map.each_pair do |key, value|
74
+ v = self.send(key)
75
+ unless v.nil?
76
+ if v.is_a?(Array)
77
+ array = Array.new
78
+ v.each do |item|
79
+ if item.respond_to?("to_body".to_sym)
80
+ array.push item.to_body
81
+ else
82
+ array.push item
83
+ end
84
+ end
85
+ body[value] = array
86
+ else
87
+ if v.respond_to?("to_body".to_sym)
88
+ body[value] = v.to_body
89
+ else
90
+ body[value] = v
91
+ end
92
+ end
93
+ end
94
+ end
95
+ body
96
+ end
97
+ end
98
+ end
@@ -0,0 +1,64 @@
1
+ # Copyright 2014-2015 Taxamo, Ltd.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ module Taxamo
14
+ class ListPaymentsOut
15
+ attr_accessor :payments
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :payments => :payments
21
+
22
+ }
23
+ end
24
+
25
+ def initialize(attributes = {})
26
+ return if attributes.empty?
27
+ # Morph attribute keys into undescored rubyish style
28
+ if attributes["payments"]
29
+ if (value = attributes["payments"]).is_a?(Array)
30
+ @payments = value.map{ |v| Payments.new(v) }
31
+ end
32
+ end
33
+
34
+
35
+ end
36
+
37
+ def to_body
38
+ body = {}
39
+ self.class.attribute_map.each_pair do |key, value|
40
+ v = self.send(key)
41
+ unless v.nil?
42
+ if v.is_a?(Array)
43
+ array = Array.new
44
+ v.each do |item|
45
+ if item.respond_to?("to_body".to_sym)
46
+ array.push item.to_body
47
+ else
48
+ array.push item
49
+ end
50
+ end
51
+ body[value] = array
52
+ else
53
+ if v.respond_to?("to_body".to_sym)
54
+ body[value] = v.to_body
55
+ else
56
+ body[value] = v
57
+ end
58
+ end
59
+ end
60
+ end
61
+ body
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,64 @@
1
+ # Copyright 2014-2015 Taxamo, Ltd.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ module Taxamo
14
+ class ListRefundsOut
15
+ attr_accessor :refunds
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :refunds => :refunds
21
+
22
+ }
23
+ end
24
+
25
+ def initialize(attributes = {})
26
+ return if attributes.empty?
27
+ # Morph attribute keys into undescored rubyish style
28
+ if attributes["refunds"]
29
+ if (value = attributes["refunds"]).is_a?(Array)
30
+ @refunds = value.map{ |v| Refunds.new(v) }
31
+ end
32
+ end
33
+
34
+
35
+ end
36
+
37
+ def to_body
38
+ body = {}
39
+ self.class.attribute_map.each_pair do |key, value|
40
+ v = self.send(key)
41
+ unless v.nil?
42
+ if v.is_a?(Array)
43
+ array = Array.new
44
+ v.each do |item|
45
+ if item.respond_to?("to_body".to_sym)
46
+ array.push item.to_body
47
+ else
48
+ array.push item
49
+ end
50
+ end
51
+ body[value] = array
52
+ else
53
+ if v.respond_to?("to_body".to_sym)
54
+ body[value] = v.to_body
55
+ else
56
+ body[value] = v
57
+ end
58
+ end
59
+ end
60
+ end
61
+ body
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,64 @@
1
+ # Copyright 2014-2015 Taxamo, Ltd.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ module Taxamo
14
+ class ListTransactionsOut
15
+ attr_accessor :transactions
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :transactions => :transactions
21
+
22
+ }
23
+ end
24
+
25
+ def initialize(attributes = {})
26
+ return if attributes.empty?
27
+ # Morph attribute keys into undescored rubyish style
28
+ if attributes["transactions"]
29
+ if (value = attributes["transactions"]).is_a?(Array)
30
+ @transactions = value.map{ |v| Transactions.new(v) }
31
+ end
32
+ end
33
+
34
+
35
+ end
36
+
37
+ def to_body
38
+ body = {}
39
+ self.class.attribute_map.each_pair do |key, value|
40
+ v = self.send(key)
41
+ unless v.nil?
42
+ if v.is_a?(Array)
43
+ array = Array.new
44
+ v.each do |item|
45
+ if item.respond_to?("to_body".to_sym)
46
+ array.push item.to_body
47
+ else
48
+ array.push item
49
+ end
50
+ end
51
+ body[value] = array
52
+ else
53
+ if v.respond_to?("to_body".to_sym)
54
+ body[value] = v.to_body
55
+ else
56
+ body[value] = v
57
+ end
58
+ end
59
+ end
60
+ end
61
+ body
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,73 @@
1
+ # Copyright 2014-2015 Taxamo, Ltd.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ module Taxamo
14
+ class LocateGivenIPOut
15
+ attr_accessor :remote_addr, :country_code, :country
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :remote_addr => :remote_addr,
21
+ :country_code => :country_code,
22
+ :country => :country
23
+
24
+ }
25
+ end
26
+
27
+ def initialize(attributes = {})
28
+ return if attributes.empty?
29
+ # Morph attribute keys into undescored rubyish style
30
+ if attributes["remote_addr"]
31
+ @remote_addr = attributes["remote_addr"]
32
+
33
+ end
34
+ if attributes["country_code"]
35
+ @country_code = attributes["country_code"]
36
+
37
+ end
38
+ if attributes["country"]
39
+ @country = Country.new(attributes["country"])
40
+
41
+ end
42
+
43
+
44
+ end
45
+
46
+ def to_body
47
+ body = {}
48
+ self.class.attribute_map.each_pair do |key, value|
49
+ v = self.send(key)
50
+ unless v.nil?
51
+ if v.is_a?(Array)
52
+ array = Array.new
53
+ v.each do |item|
54
+ if item.respond_to?("to_body".to_sym)
55
+ array.push item.to_body
56
+ else
57
+ array.push item
58
+ end
59
+ end
60
+ body[value] = array
61
+ else
62
+ if v.respond_to?("to_body".to_sym)
63
+ body[value] = v.to_body
64
+ else
65
+ body[value] = v
66
+ end
67
+ end
68
+ end
69
+ end
70
+ body
71
+ end
72
+ end
73
+ end
@@ -0,0 +1,73 @@
1
+ # Copyright 2014-2015 Taxamo, Ltd.
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6
+ #
7
+ # Unless required by applicable law or agreed to in writing, software
8
+ # distributed under the License is distributed on an "AS IS" BASIS,
9
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
+ # See the License for the specific language governing permissions and
11
+ # limitations under the License.
12
+
13
+ module Taxamo
14
+ class LocateMyIPOut
15
+ attr_accessor :remote_addr, :country_code, :country
16
+
17
+ # :internal => :external
18
+ def self.attribute_map
19
+ {
20
+ :remote_addr => :remote_addr,
21
+ :country_code => :country_code,
22
+ :country => :country
23
+
24
+ }
25
+ end
26
+
27
+ def initialize(attributes = {})
28
+ return if attributes.empty?
29
+ # Morph attribute keys into undescored rubyish style
30
+ if attributes["remote_addr"]
31
+ @remote_addr = attributes["remote_addr"]
32
+
33
+ end
34
+ if attributes["country_code"]
35
+ @country_code = attributes["country_code"]
36
+
37
+ end
38
+ if attributes["country"]
39
+ @country = Country.new(attributes["country"])
40
+
41
+ end
42
+
43
+
44
+ end
45
+
46
+ def to_body
47
+ body = {}
48
+ self.class.attribute_map.each_pair do |key, value|
49
+ v = self.send(key)
50
+ unless v.nil?
51
+ if v.is_a?(Array)
52
+ array = Array.new
53
+ v.each do |item|
54
+ if item.respond_to?("to_body".to_sym)
55
+ array.push item.to_body
56
+ else
57
+ array.push item
58
+ end
59
+ end
60
+ body[value] = array
61
+ else
62
+ if v.respond_to?("to_body".to_sym)
63
+ body[value] = v.to_body
64
+ else
65
+ body[value] = v
66
+ end
67
+ end
68
+ end
69
+ end
70
+ body
71
+ end
72
+ end
73
+ end