taxamo 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +7 -0
- data/LICENSE +11 -0
- data/README.md +120 -0
- data/Rakefile +7 -0
- data/lib/monkey.rb +90 -0
- data/lib/swagger.rb +93 -0
- data/lib/swagger/configuration.rb +21 -0
- data/lib/swagger/request.rb +198 -0
- data/lib/swagger/response.rb +87 -0
- data/lib/taxamo.rb +999 -0
- data/lib/taxamo/models/additionalcurrencies.rb +62 -0
- data/lib/taxamo/models/additionalcurrency.rb +82 -0
- data/lib/taxamo/models/bycountry.rb +77 -0
- data/lib/taxamo/models/bystatus.rb +69 -0
- data/lib/taxamo/models/bytaxationtype.rb +82 -0
- data/lib/taxamo/models/c.rb +77 -0
- data/lib/taxamo/models/calculatesimpletaxout.rb +62 -0
- data/lib/taxamo/models/calculatetaxin.rb +62 -0
- data/lib/taxamo/models/calculatetaxlocationout.rb +97 -0
- data/lib/taxamo/models/calculatetaxout.rb +62 -0
- data/lib/taxamo/models/canceltransactionout.rb +62 -0
- data/lib/taxamo/models/capturepaymentout.rb +62 -0
- data/lib/taxamo/models/confirmtransactionin.rb +62 -0
- data/lib/taxamo/models/confirmtransactionout.rb +62 -0
- data/lib/taxamo/models/countries.rb +112 -0
- data/lib/taxamo/models/country.rb +114 -0
- data/lib/taxamo/models/countryschema.rb +114 -0
- data/lib/taxamo/models/createpaymentin.rb +72 -0
- data/lib/taxamo/models/createpaymentout.rb +62 -0
- data/lib/taxamo/models/createrefundin.rb +77 -0
- data/lib/taxamo/models/createrefundout.rb +77 -0
- data/lib/taxamo/models/createsmstokenin.rb +67 -0
- data/lib/taxamo/models/createsmstokenout.rb +62 -0
- data/lib/taxamo/models/createtransactionin.rb +67 -0
- data/lib/taxamo/models/createtransactionout.rb +62 -0
- data/lib/taxamo/models/currencyschema.rb +82 -0
- data/lib/taxamo/models/customfields.rb +67 -0
- data/lib/taxamo/models/emailinvoicein.rb +62 -0
- data/lib/taxamo/models/emailinvoiceout.rb +62 -0
- data/lib/taxamo/models/evidence.rb +112 -0
- data/lib/taxamo/models/evidenceschema.rb +77 -0
- data/lib/taxamo/models/getcountriesdictout.rb +63 -0
- data/lib/taxamo/models/getcurrenciesdictout.rb +63 -0
- data/lib/taxamo/models/getdailysettlementstatsout.rb +63 -0
- data/lib/taxamo/models/getproducttypesdictout.rb +63 -0
- data/lib/taxamo/models/getrefundsout.rb +63 -0
- data/lib/taxamo/models/getsettlementout.rb +83 -0
- data/lib/taxamo/models/getsettlementstatsbycountryout.rb +63 -0
- data/lib/taxamo/models/getsettlementstatsbytaxationtypeout.rb +62 -0
- data/lib/taxamo/models/getsettlementsummaryout.rb +62 -0
- data/lib/taxamo/models/gettransactionout.rb +62 -0
- data/lib/taxamo/models/gettransactionsstatsout.rb +62 -0
- data/lib/taxamo/models/inputtransaction.rb +184 -0
- data/lib/taxamo/models/inputtransactionline.rb +133 -0
- data/lib/taxamo/models/inputtransactionupdate.rb +184 -0
- data/lib/taxamo/models/invoiceaddress.rb +97 -0
- data/lib/taxamo/models/listpaymentsout.rb +63 -0
- data/lib/taxamo/models/listtransactionsout.rb +63 -0
- data/lib/taxamo/models/locategivenipout.rb +72 -0
- data/lib/taxamo/models/locatemyipout.rb +72 -0
- data/lib/taxamo/models/n.rb +77 -0
- data/lib/taxamo/models/payments.rb +72 -0
- data/lib/taxamo/models/producttypeschema.rb +62 -0
- data/lib/taxamo/models/report.rb +92 -0
- data/lib/taxamo/models/settlementdailystatsschema.rb +102 -0
- data/lib/taxamo/models/summary.rb +87 -0
- data/lib/taxamo/models/transaction.rb +279 -0
- data/lib/taxamo/models/transactionlines.rb +163 -0
- data/lib/taxamo/models/transactions.rb +279 -0
- data/lib/taxamo/models/unconfirmtransactionin.rb +62 -0
- data/lib/taxamo/models/unconfirmtransactionout.rb +62 -0
- data/lib/taxamo/models/updatetransactionin.rb +62 -0
- data/lib/taxamo/models/updatetransactionout.rb +62 -0
- data/lib/taxamo/models/validatetaxnumberout.rb +77 -0
- data/lib/taxamo/models/verifysmstokenout.rb +62 -0
- data/lib/taxamo/version.rb +17 -0
- data/taxamo.gemspec +31 -0
- data/test/taxamo/connectivity_test.rb +55 -0
- data/test/taxamo/tax_test.rb +147 -0
- data/test/taxamo/transactions_api_test.rb +308 -0
- metadata +226 -0
@@ -0,0 +1,87 @@
|
|
1
|
+
module Swagger
|
2
|
+
|
3
|
+
class Response
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
attr_accessor :raw
|
7
|
+
|
8
|
+
def initialize(raw)
|
9
|
+
self.raw = raw
|
10
|
+
|
11
|
+
case self.code
|
12
|
+
when 500..510 then raise(ServerError, self.body)
|
13
|
+
when 400 then
|
14
|
+
e = nil
|
15
|
+
if self.body['errors']
|
16
|
+
e = ValidationError.new(self.body['errors'])
|
17
|
+
if self.body['validation_failures']
|
18
|
+
e.validation_failures = self.body['validation_failures']
|
19
|
+
end
|
20
|
+
else
|
21
|
+
e = ValidationError.new(self.body)
|
22
|
+
end
|
23
|
+
raise(e)
|
24
|
+
when 401 then raise(AuthenticationError, self.body)
|
25
|
+
when 402..403 then raise(ClientError, self.body)
|
26
|
+
when 299..399 then raise(ClientError, self.body)
|
27
|
+
when 0 then raise(ClientError, raw.return_message)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def code
|
32
|
+
raw.code
|
33
|
+
end
|
34
|
+
|
35
|
+
# Account for error messages that take different forms...
|
36
|
+
def error_message
|
37
|
+
body['message']
|
38
|
+
rescue
|
39
|
+
body
|
40
|
+
end
|
41
|
+
|
42
|
+
def validation_message
|
43
|
+
body
|
44
|
+
end
|
45
|
+
# If body is JSON, parse it
|
46
|
+
# Otherwise return raw string
|
47
|
+
def body
|
48
|
+
JSON.parse raw.body
|
49
|
+
rescue
|
50
|
+
raw.body
|
51
|
+
end
|
52
|
+
|
53
|
+
# `headers_hash` is a Typhoeus-specific extension of Hash,
|
54
|
+
# so simplify it back into a regular old Hash.
|
55
|
+
def headers
|
56
|
+
h = {}
|
57
|
+
raw.headers_hash.each {|k,v| h[k] = v }
|
58
|
+
h
|
59
|
+
end
|
60
|
+
|
61
|
+
# Extract the response format from the header hash
|
62
|
+
# e.g. {'Content-Type' => 'application/json'}
|
63
|
+
def format
|
64
|
+
headers['Content-Type'].split("/").last.downcase
|
65
|
+
end
|
66
|
+
|
67
|
+
def json?
|
68
|
+
format == 'json'
|
69
|
+
end
|
70
|
+
|
71
|
+
def xml?
|
72
|
+
format == 'xml'
|
73
|
+
end
|
74
|
+
|
75
|
+
def pretty_body
|
76
|
+
return unless body.present?
|
77
|
+
case format
|
78
|
+
when 'json' then JSON.pretty_generate(body).gsub(/\n/, '<br/>')
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def pretty_headers
|
83
|
+
JSON.pretty_generate(headers).gsub(/\n/, '<br/>')
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
data/lib/taxamo.rb
ADDED
@@ -0,0 +1,999 @@
|
|
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
|
+
require "uri"
|
14
|
+
require "swagger"
|
15
|
+
require "taxamo/version"
|
16
|
+
require "require_all"
|
17
|
+
require_all "lib/taxamo/models/*"
|
18
|
+
|
19
|
+
module Taxamo
|
20
|
+
class <<self
|
21
|
+
def escapeString(string)
|
22
|
+
URI.encode(string.to_s)
|
23
|
+
end
|
24
|
+
|
25
|
+
def create_refund (key,body,opts={})
|
26
|
+
query_param_keys = []
|
27
|
+
|
28
|
+
# verify existence of params
|
29
|
+
raise "key is required" if key.nil?
|
30
|
+
raise "body is required" if body.nil?
|
31
|
+
# set default values and merge with input
|
32
|
+
options = {
|
33
|
+
:key => key,
|
34
|
+
:body => body}.merge(opts)
|
35
|
+
|
36
|
+
#resource path
|
37
|
+
path = "/api/v1/transactions/{key}/refunds".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
38
|
+
|
39
|
+
|
40
|
+
# pull querystring keys from options
|
41
|
+
queryopts = options.select do |key,value|
|
42
|
+
query_param_keys.include? key
|
43
|
+
end
|
44
|
+
|
45
|
+
headers = nil
|
46
|
+
post_body = nil
|
47
|
+
if body != nil
|
48
|
+
if body.is_a?(Array)
|
49
|
+
array = Array.new
|
50
|
+
body.each do |item|
|
51
|
+
if item.respond_to?("to_body".to_sym)
|
52
|
+
array.push item.to_body
|
53
|
+
else
|
54
|
+
array.push item
|
55
|
+
end
|
56
|
+
end
|
57
|
+
post_body = array
|
58
|
+
|
59
|
+
else
|
60
|
+
if body.respond_to?("to_body".to_sym)
|
61
|
+
post_body = body.to_body
|
62
|
+
else
|
63
|
+
post_body = body
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
68
|
+
CreateRefundOut.new(response)
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
def create_payment (key,body,opts={})
|
73
|
+
query_param_keys = []
|
74
|
+
|
75
|
+
# verify existence of params
|
76
|
+
raise "key is required" if key.nil?
|
77
|
+
raise "body is required" if body.nil?
|
78
|
+
# set default values and merge with input
|
79
|
+
options = {
|
80
|
+
:key => key,
|
81
|
+
:body => body}.merge(opts)
|
82
|
+
|
83
|
+
#resource path
|
84
|
+
path = "/api/v1/transactions/{key}/payments".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
85
|
+
|
86
|
+
|
87
|
+
# pull querystring keys from options
|
88
|
+
queryopts = options.select do |key,value|
|
89
|
+
query_param_keys.include? key
|
90
|
+
end
|
91
|
+
|
92
|
+
headers = nil
|
93
|
+
post_body = nil
|
94
|
+
if body != nil
|
95
|
+
if body.is_a?(Array)
|
96
|
+
array = Array.new
|
97
|
+
body.each do |item|
|
98
|
+
if item.respond_to?("to_body".to_sym)
|
99
|
+
array.push item.to_body
|
100
|
+
else
|
101
|
+
array.push item
|
102
|
+
end
|
103
|
+
end
|
104
|
+
post_body = array
|
105
|
+
|
106
|
+
else
|
107
|
+
if body.respond_to?("to_body".to_sym)
|
108
|
+
post_body = body.to_body
|
109
|
+
else
|
110
|
+
post_body = body
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
115
|
+
CreatePaymentOut.new(response)
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
def list_payments (limit,offset,key,opts={})
|
120
|
+
query_param_keys = [:limit,:offset]
|
121
|
+
|
122
|
+
# verify existence of params
|
123
|
+
raise "key is required" if key.nil?
|
124
|
+
# set default values and merge with input
|
125
|
+
options = {
|
126
|
+
:limit => limit,
|
127
|
+
:offset => offset,
|
128
|
+
:key => key}.merge(opts)
|
129
|
+
|
130
|
+
#resource path
|
131
|
+
path = "/api/v1/transactions/{key}/payments".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
132
|
+
|
133
|
+
|
134
|
+
# pull querystring keys from options
|
135
|
+
queryopts = options.select do |key,value|
|
136
|
+
query_param_keys.include? key
|
137
|
+
end
|
138
|
+
|
139
|
+
headers = nil
|
140
|
+
post_body = nil
|
141
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
142
|
+
ListPaymentsOut.new(response)
|
143
|
+
|
144
|
+
end
|
145
|
+
|
146
|
+
def capture_payment (key,opts={})
|
147
|
+
query_param_keys = []
|
148
|
+
|
149
|
+
# verify existence of params
|
150
|
+
raise "key is required" if key.nil?
|
151
|
+
# set default values and merge with input
|
152
|
+
options = {
|
153
|
+
:key => key}.merge(opts)
|
154
|
+
|
155
|
+
#resource path
|
156
|
+
path = "/api/v1/transactions/{key}/payments/capture".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
157
|
+
|
158
|
+
|
159
|
+
# pull querystring keys from options
|
160
|
+
queryopts = options.select do |key,value|
|
161
|
+
query_param_keys.include? key
|
162
|
+
end
|
163
|
+
|
164
|
+
headers = nil
|
165
|
+
post_body = nil
|
166
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
167
|
+
CapturePaymentOut.new(response)
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
def email_invoice (key,body,opts={})
|
172
|
+
query_param_keys = []
|
173
|
+
|
174
|
+
# verify existence of params
|
175
|
+
raise "key is required" if key.nil?
|
176
|
+
raise "body is required" if body.nil?
|
177
|
+
# set default values and merge with input
|
178
|
+
options = {
|
179
|
+
:key => key,
|
180
|
+
:body => body}.merge(opts)
|
181
|
+
|
182
|
+
#resource path
|
183
|
+
path = "/api/v1/transactions/{key}/invoice/send_email".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
184
|
+
|
185
|
+
|
186
|
+
# pull querystring keys from options
|
187
|
+
queryopts = options.select do |key,value|
|
188
|
+
query_param_keys.include? key
|
189
|
+
end
|
190
|
+
|
191
|
+
headers = nil
|
192
|
+
post_body = nil
|
193
|
+
if body != nil
|
194
|
+
if body.is_a?(Array)
|
195
|
+
array = Array.new
|
196
|
+
body.each do |item|
|
197
|
+
if item.respond_to?("to_body".to_sym)
|
198
|
+
array.push item.to_body
|
199
|
+
else
|
200
|
+
array.push item
|
201
|
+
end
|
202
|
+
end
|
203
|
+
post_body = array
|
204
|
+
|
205
|
+
else
|
206
|
+
if body.respond_to?("to_body".to_sym)
|
207
|
+
post_body = body.to_body
|
208
|
+
else
|
209
|
+
post_body = body
|
210
|
+
end
|
211
|
+
end
|
212
|
+
end
|
213
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
214
|
+
EmailInvoiceOut.new(response)
|
215
|
+
|
216
|
+
end
|
217
|
+
|
218
|
+
def create_transaction (body,opts={})
|
219
|
+
query_param_keys = []
|
220
|
+
|
221
|
+
# verify existence of params
|
222
|
+
raise "body is required" if body.nil?
|
223
|
+
# set default values and merge with input
|
224
|
+
options = {
|
225
|
+
:body => body}.merge(opts)
|
226
|
+
|
227
|
+
#resource path
|
228
|
+
path = "/api/v1/transactions".sub('{format}','json')
|
229
|
+
|
230
|
+
|
231
|
+
# pull querystring keys from options
|
232
|
+
queryopts = options.select do |key,value|
|
233
|
+
query_param_keys.include? key
|
234
|
+
end
|
235
|
+
|
236
|
+
headers = nil
|
237
|
+
post_body = nil
|
238
|
+
if body != nil
|
239
|
+
if body.is_a?(Array)
|
240
|
+
array = Array.new
|
241
|
+
body.each do |item|
|
242
|
+
if item.respond_to?("to_body".to_sym)
|
243
|
+
array.push item.to_body
|
244
|
+
else
|
245
|
+
array.push item
|
246
|
+
end
|
247
|
+
end
|
248
|
+
post_body = array
|
249
|
+
|
250
|
+
else
|
251
|
+
if body.respond_to?("to_body".to_sym)
|
252
|
+
post_body = body.to_body
|
253
|
+
else
|
254
|
+
post_body = body
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
259
|
+
CreateTransactionOut.new(response)
|
260
|
+
|
261
|
+
end
|
262
|
+
|
263
|
+
def get_transaction (key,opts={})
|
264
|
+
query_param_keys = []
|
265
|
+
|
266
|
+
# verify existence of params
|
267
|
+
raise "key is required" if key.nil?
|
268
|
+
# set default values and merge with input
|
269
|
+
options = {
|
270
|
+
:key => key}.merge(opts)
|
271
|
+
|
272
|
+
#resource path
|
273
|
+
path = "/api/v1/transactions/{key}".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
274
|
+
|
275
|
+
|
276
|
+
# pull querystring keys from options
|
277
|
+
queryopts = options.select do |key,value|
|
278
|
+
query_param_keys.include? key
|
279
|
+
end
|
280
|
+
|
281
|
+
headers = nil
|
282
|
+
post_body = nil
|
283
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
284
|
+
GetTransactionOut.new(response)
|
285
|
+
|
286
|
+
end
|
287
|
+
|
288
|
+
def update_transaction (key,body,opts={})
|
289
|
+
query_param_keys = []
|
290
|
+
|
291
|
+
# verify existence of params
|
292
|
+
raise "key is required" if key.nil?
|
293
|
+
raise "body is required" if body.nil?
|
294
|
+
# set default values and merge with input
|
295
|
+
options = {
|
296
|
+
:key => key,
|
297
|
+
:body => body}.merge(opts)
|
298
|
+
|
299
|
+
#resource path
|
300
|
+
path = "/api/v1/transactions/{key}".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
301
|
+
|
302
|
+
|
303
|
+
# pull querystring keys from options
|
304
|
+
queryopts = options.select do |key,value|
|
305
|
+
query_param_keys.include? key
|
306
|
+
end
|
307
|
+
|
308
|
+
headers = nil
|
309
|
+
post_body = nil
|
310
|
+
if body != nil
|
311
|
+
if body.is_a?(Array)
|
312
|
+
array = Array.new
|
313
|
+
body.each do |item|
|
314
|
+
if item.respond_to?("to_body".to_sym)
|
315
|
+
array.push item.to_body
|
316
|
+
else
|
317
|
+
array.push item
|
318
|
+
end
|
319
|
+
end
|
320
|
+
post_body = array
|
321
|
+
|
322
|
+
else
|
323
|
+
if body.respond_to?("to_body".to_sym)
|
324
|
+
post_body = body.to_body
|
325
|
+
else
|
326
|
+
post_body = body
|
327
|
+
end
|
328
|
+
end
|
329
|
+
end
|
330
|
+
response = Swagger::Request.new(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
331
|
+
UpdateTransactionOut.new(response)
|
332
|
+
|
333
|
+
end
|
334
|
+
|
335
|
+
def confirm_transaction (key,body,opts={})
|
336
|
+
query_param_keys = []
|
337
|
+
|
338
|
+
# verify existence of params
|
339
|
+
raise "key is required" if key.nil?
|
340
|
+
raise "body is required" if body.nil?
|
341
|
+
# set default values and merge with input
|
342
|
+
options = {
|
343
|
+
:key => key,
|
344
|
+
:body => body}.merge(opts)
|
345
|
+
|
346
|
+
#resource path
|
347
|
+
path = "/api/v1/transactions/{key}/confirm".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
348
|
+
|
349
|
+
|
350
|
+
# pull querystring keys from options
|
351
|
+
queryopts = options.select do |key,value|
|
352
|
+
query_param_keys.include? key
|
353
|
+
end
|
354
|
+
|
355
|
+
headers = nil
|
356
|
+
post_body = nil
|
357
|
+
if body != nil
|
358
|
+
if body.is_a?(Array)
|
359
|
+
array = Array.new
|
360
|
+
body.each do |item|
|
361
|
+
if item.respond_to?("to_body".to_sym)
|
362
|
+
array.push item.to_body
|
363
|
+
else
|
364
|
+
array.push item
|
365
|
+
end
|
366
|
+
end
|
367
|
+
post_body = array
|
368
|
+
|
369
|
+
else
|
370
|
+
if body.respond_to?("to_body".to_sym)
|
371
|
+
post_body = body.to_body
|
372
|
+
else
|
373
|
+
post_body = body
|
374
|
+
end
|
375
|
+
end
|
376
|
+
end
|
377
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
378
|
+
ConfirmTransactionOut.new(response)
|
379
|
+
|
380
|
+
end
|
381
|
+
|
382
|
+
def cancel_transaction (key,opts={})
|
383
|
+
query_param_keys = []
|
384
|
+
|
385
|
+
# verify existence of params
|
386
|
+
raise "key is required" if key.nil?
|
387
|
+
# set default values and merge with input
|
388
|
+
options = {
|
389
|
+
:key => key}.merge(opts)
|
390
|
+
|
391
|
+
#resource path
|
392
|
+
path = "/api/v1/transactions/{key}".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
393
|
+
|
394
|
+
|
395
|
+
# pull querystring keys from options
|
396
|
+
queryopts = options.select do |key,value|
|
397
|
+
query_param_keys.include? key
|
398
|
+
end
|
399
|
+
|
400
|
+
headers = nil
|
401
|
+
post_body = nil
|
402
|
+
response = Swagger::Request.new(:DELETE, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
403
|
+
CancelTransactionOut.new(response)
|
404
|
+
|
405
|
+
end
|
406
|
+
|
407
|
+
def unconfirm_transaction (key,body,opts={})
|
408
|
+
query_param_keys = []
|
409
|
+
|
410
|
+
# verify existence of params
|
411
|
+
raise "key is required" if key.nil?
|
412
|
+
raise "body is required" if body.nil?
|
413
|
+
# set default values and merge with input
|
414
|
+
options = {
|
415
|
+
:key => key,
|
416
|
+
:body => body}.merge(opts)
|
417
|
+
|
418
|
+
#resource path
|
419
|
+
path = "/api/v1/transactions/{key}/unconfirm".sub('{format}','json').sub('{' + 'key' + '}', escapeString(key))
|
420
|
+
|
421
|
+
|
422
|
+
# pull querystring keys from options
|
423
|
+
queryopts = options.select do |key,value|
|
424
|
+
query_param_keys.include? key
|
425
|
+
end
|
426
|
+
|
427
|
+
headers = nil
|
428
|
+
post_body = nil
|
429
|
+
if body != nil
|
430
|
+
if body.is_a?(Array)
|
431
|
+
array = Array.new
|
432
|
+
body.each do |item|
|
433
|
+
if item.respond_to?("to_body".to_sym)
|
434
|
+
array.push item.to_body
|
435
|
+
else
|
436
|
+
array.push item
|
437
|
+
end
|
438
|
+
end
|
439
|
+
post_body = array
|
440
|
+
|
441
|
+
else
|
442
|
+
if body.respond_to?("to_body".to_sym)
|
443
|
+
post_body = body.to_body
|
444
|
+
else
|
445
|
+
post_body = body
|
446
|
+
end
|
447
|
+
end
|
448
|
+
end
|
449
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
450
|
+
UnconfirmTransactionOut.new(response)
|
451
|
+
|
452
|
+
end
|
453
|
+
|
454
|
+
def list_transactions (statuses,sort_reverse,tax_country_code,order_date_from,key_or_custom_id,offset,filter_text,format,invoice_number,order_date_to,currency_code,limit,opts={})
|
455
|
+
query_param_keys = [:statuses,:sort_reverse,:tax_country_code,:order_date_from,:key_or_custom_id,:offset,:filter_text,:format,:invoice_number,:order_date_to,:currency_code,:limit]
|
456
|
+
|
457
|
+
# set default values and merge with input
|
458
|
+
options = {
|
459
|
+
:filter_text => filter_text,
|
460
|
+
:offset => offset,
|
461
|
+
:key_or_custom_id => key_or_custom_id,
|
462
|
+
:currency_code => currency_code,
|
463
|
+
:order_date_to => order_date_to,
|
464
|
+
:sort_reverse => sort_reverse,
|
465
|
+
:limit => limit,
|
466
|
+
:invoice_number => invoice_number,
|
467
|
+
:statuses => statuses,
|
468
|
+
:order_date_from => order_date_from,
|
469
|
+
:format => format,
|
470
|
+
:tax_country_code => tax_country_code}.merge(opts)
|
471
|
+
|
472
|
+
#resource path
|
473
|
+
path = "/api/v1/transactions".sub('{format}','json')
|
474
|
+
|
475
|
+
|
476
|
+
# pull querystring keys from options
|
477
|
+
queryopts = options.select do |key,value|
|
478
|
+
query_param_keys.include? key
|
479
|
+
end
|
480
|
+
|
481
|
+
headers = nil
|
482
|
+
post_body = nil
|
483
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
484
|
+
ListTransactionsOut.new(response)
|
485
|
+
|
486
|
+
end
|
487
|
+
|
488
|
+
def calculate_tax (body,opts={})
|
489
|
+
query_param_keys = []
|
490
|
+
|
491
|
+
# verify existence of params
|
492
|
+
raise "body is required" if body.nil?
|
493
|
+
# set default values and merge with input
|
494
|
+
options = {
|
495
|
+
:body => body}.merge(opts)
|
496
|
+
|
497
|
+
#resource path
|
498
|
+
path = "/api/v1/tax/calculate".sub('{format}','json')
|
499
|
+
|
500
|
+
|
501
|
+
# pull querystring keys from options
|
502
|
+
queryopts = options.select do |key,value|
|
503
|
+
query_param_keys.include? key
|
504
|
+
end
|
505
|
+
|
506
|
+
headers = nil
|
507
|
+
post_body = nil
|
508
|
+
if body != nil
|
509
|
+
if body.is_a?(Array)
|
510
|
+
array = Array.new
|
511
|
+
body.each do |item|
|
512
|
+
if item.respond_to?("to_body".to_sym)
|
513
|
+
array.push item.to_body
|
514
|
+
else
|
515
|
+
array.push item
|
516
|
+
end
|
517
|
+
end
|
518
|
+
post_body = array
|
519
|
+
|
520
|
+
else
|
521
|
+
if body.respond_to?("to_body".to_sym)
|
522
|
+
post_body = body.to_body
|
523
|
+
else
|
524
|
+
post_body = body
|
525
|
+
end
|
526
|
+
end
|
527
|
+
end
|
528
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
529
|
+
CalculateTaxOut.new(response)
|
530
|
+
|
531
|
+
end
|
532
|
+
|
533
|
+
def calculate_simple_tax (buyer_credit_card_prefix,buyer_tax_number,product_type,force_country_code,quantity,unit_price,total_amount,tax_deducted,amount,billing_country_code,currency_code,order_date,opts={})
|
534
|
+
query_param_keys = [:buyer_credit_card_prefix,:buyer_tax_number,:product_type,:force_country_code,:quantity,:unit_price,:total_amount,:tax_deducted,:amount,:billing_country_code,:currency_code,:order_date]
|
535
|
+
|
536
|
+
# verify existence of params
|
537
|
+
raise "currency_code is required" if currency_code.nil?
|
538
|
+
# set default values and merge with input
|
539
|
+
options = {
|
540
|
+
:product_type => product_type,
|
541
|
+
:buyer_credit_card_prefix => buyer_credit_card_prefix,
|
542
|
+
:currency_code => currency_code,
|
543
|
+
:unit_price => unit_price,
|
544
|
+
:quantity => quantity,
|
545
|
+
:buyer_tax_number => buyer_tax_number,
|
546
|
+
:force_country_code => force_country_code,
|
547
|
+
:order_date => order_date,
|
548
|
+
:amount => amount,
|
549
|
+
:billing_country_code => billing_country_code,
|
550
|
+
:total_amount => total_amount,
|
551
|
+
:tax_deducted => tax_deducted}.merge(opts)
|
552
|
+
|
553
|
+
#resource path
|
554
|
+
path = "/api/v1/tax/calculate".sub('{format}','json')
|
555
|
+
|
556
|
+
|
557
|
+
# pull querystring keys from options
|
558
|
+
queryopts = options.select do |key,value|
|
559
|
+
query_param_keys.include? key
|
560
|
+
end
|
561
|
+
|
562
|
+
headers = nil
|
563
|
+
post_body = nil
|
564
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
565
|
+
CalculateSimpleTaxOut.new(response)
|
566
|
+
|
567
|
+
end
|
568
|
+
|
569
|
+
def validate_tax_number (country_code,tax_number,opts={})
|
570
|
+
query_param_keys = [:country_code]
|
571
|
+
|
572
|
+
# verify existence of params
|
573
|
+
raise "tax_number is required" if tax_number.nil?
|
574
|
+
# set default values and merge with input
|
575
|
+
options = {
|
576
|
+
:country_code => country_code,
|
577
|
+
:tax_number => tax_number}.merge(opts)
|
578
|
+
|
579
|
+
#resource path
|
580
|
+
path = "/api/v1/tax/vat_numbers/{tax_number}/validate".sub('{format}','json').sub('{' + 'tax_number' + '}', escapeString(tax_number))
|
581
|
+
|
582
|
+
|
583
|
+
# pull querystring keys from options
|
584
|
+
queryopts = options.select do |key,value|
|
585
|
+
query_param_keys.include? key
|
586
|
+
end
|
587
|
+
|
588
|
+
headers = nil
|
589
|
+
post_body = nil
|
590
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
591
|
+
ValidateTaxNumberOut.new(response)
|
592
|
+
|
593
|
+
end
|
594
|
+
|
595
|
+
def calculate_tax_location (billing_country_code,buyer_credit_card_prefix,opts={})
|
596
|
+
query_param_keys = [:billing_country_code,:buyer_credit_card_prefix]
|
597
|
+
|
598
|
+
# set default values and merge with input
|
599
|
+
options = {
|
600
|
+
:billing_country_code => billing_country_code,
|
601
|
+
:buyer_credit_card_prefix => buyer_credit_card_prefix}.merge(opts)
|
602
|
+
|
603
|
+
#resource path
|
604
|
+
path = "/api/v1/tax/location/calculate".sub('{format}','json')
|
605
|
+
|
606
|
+
|
607
|
+
# pull querystring keys from options
|
608
|
+
queryopts = options.select do |key,value|
|
609
|
+
query_param_keys.include? key
|
610
|
+
end
|
611
|
+
|
612
|
+
headers = nil
|
613
|
+
post_body = nil
|
614
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
615
|
+
CalculateTaxLocationOut.new(response)
|
616
|
+
|
617
|
+
end
|
618
|
+
|
619
|
+
def locate_my_i_p (opts={})
|
620
|
+
query_param_keys = []
|
621
|
+
|
622
|
+
# set default values and merge with input
|
623
|
+
options = {
|
624
|
+
}.merge(opts)
|
625
|
+
|
626
|
+
#resource path
|
627
|
+
path = "/api/v1/geoip".sub('{format}','json')
|
628
|
+
|
629
|
+
|
630
|
+
# pull querystring keys from options
|
631
|
+
queryopts = options.select do |key,value|
|
632
|
+
query_param_keys.include? key
|
633
|
+
end
|
634
|
+
|
635
|
+
headers = nil
|
636
|
+
post_body = nil
|
637
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
638
|
+
LocateMyIPOut.new(response)
|
639
|
+
|
640
|
+
end
|
641
|
+
|
642
|
+
def locate_given_i_p (ip,opts={})
|
643
|
+
query_param_keys = []
|
644
|
+
|
645
|
+
# verify existence of params
|
646
|
+
raise "ip is required" if ip.nil?
|
647
|
+
# set default values and merge with input
|
648
|
+
options = {
|
649
|
+
:ip => ip}.merge(opts)
|
650
|
+
|
651
|
+
#resource path
|
652
|
+
path = "/api/v1/geoip/{ip}".sub('{format}','json').sub('{' + 'ip' + '}', escapeString(ip))
|
653
|
+
|
654
|
+
|
655
|
+
# pull querystring keys from options
|
656
|
+
queryopts = options.select do |key,value|
|
657
|
+
query_param_keys.include? key
|
658
|
+
end
|
659
|
+
|
660
|
+
headers = nil
|
661
|
+
post_body = nil
|
662
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
663
|
+
LocateGivenIPOut.new(response)
|
664
|
+
|
665
|
+
end
|
666
|
+
|
667
|
+
def get_transactions_stats (date_from,date_to,interval,opts={})
|
668
|
+
query_param_keys = [:date_from,:date_to,:interval]
|
669
|
+
|
670
|
+
# verify existence of params
|
671
|
+
raise "date_from is required" if date_from.nil?
|
672
|
+
raise "date_to is required" if date_to.nil?
|
673
|
+
# set default values and merge with input
|
674
|
+
options = {
|
675
|
+
:date_from => date_from,
|
676
|
+
:date_to => date_to,
|
677
|
+
:interval => interval}.merge(opts)
|
678
|
+
|
679
|
+
#resource path
|
680
|
+
path = "/api/v1/stats/transactions".sub('{format}','json')
|
681
|
+
|
682
|
+
|
683
|
+
# pull querystring keys from options
|
684
|
+
queryopts = options.select do |key,value|
|
685
|
+
query_param_keys.include? key
|
686
|
+
end
|
687
|
+
|
688
|
+
headers = nil
|
689
|
+
post_body = nil
|
690
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
691
|
+
GetTransactionsStatsOut.new(response)
|
692
|
+
|
693
|
+
end
|
694
|
+
|
695
|
+
def get_settlement_stats_by_country (date_from,date_to,opts={})
|
696
|
+
query_param_keys = [:date_from,:date_to]
|
697
|
+
|
698
|
+
# verify existence of params
|
699
|
+
raise "date_from is required" if date_from.nil?
|
700
|
+
raise "date_to is required" if date_to.nil?
|
701
|
+
# set default values and merge with input
|
702
|
+
options = {
|
703
|
+
:date_from => date_from,
|
704
|
+
:date_to => date_to}.merge(opts)
|
705
|
+
|
706
|
+
#resource path
|
707
|
+
path = "/api/v1/stats/settlement/by_country".sub('{format}','json')
|
708
|
+
|
709
|
+
|
710
|
+
# pull querystring keys from options
|
711
|
+
queryopts = options.select do |key,value|
|
712
|
+
query_param_keys.include? key
|
713
|
+
end
|
714
|
+
|
715
|
+
headers = nil
|
716
|
+
post_body = nil
|
717
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
718
|
+
GetSettlementStatsByCountryOut.new(response)
|
719
|
+
|
720
|
+
end
|
721
|
+
|
722
|
+
def get_settlement_stats_by_taxation_type (date_from,date_to,opts={})
|
723
|
+
query_param_keys = [:date_from,:date_to]
|
724
|
+
|
725
|
+
# verify existence of params
|
726
|
+
raise "date_from is required" if date_from.nil?
|
727
|
+
raise "date_to is required" if date_to.nil?
|
728
|
+
# set default values and merge with input
|
729
|
+
options = {
|
730
|
+
:date_from => date_from,
|
731
|
+
:date_to => date_to}.merge(opts)
|
732
|
+
|
733
|
+
#resource path
|
734
|
+
path = "/api/v1/stats/settlement/by_taxation_type".sub('{format}','json')
|
735
|
+
|
736
|
+
|
737
|
+
# pull querystring keys from options
|
738
|
+
queryopts = options.select do |key,value|
|
739
|
+
query_param_keys.include? key
|
740
|
+
end
|
741
|
+
|
742
|
+
headers = nil
|
743
|
+
post_body = nil
|
744
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
745
|
+
GetSettlementStatsByTaxationTypeOut.new(response)
|
746
|
+
|
747
|
+
end
|
748
|
+
|
749
|
+
def get_daily_settlement_stats (interval,date_from,date_to,opts={})
|
750
|
+
query_param_keys = [:interval,:date_from,:date_to]
|
751
|
+
|
752
|
+
# verify existence of params
|
753
|
+
raise "interval is required" if interval.nil?
|
754
|
+
raise "date_from is required" if date_from.nil?
|
755
|
+
raise "date_to is required" if date_to.nil?
|
756
|
+
# set default values and merge with input
|
757
|
+
options = {
|
758
|
+
:interval => interval,
|
759
|
+
:date_from => date_from,
|
760
|
+
:date_to => date_to}.merge(opts)
|
761
|
+
|
762
|
+
#resource path
|
763
|
+
path = "/api/v1/stats/settlement/daily".sub('{format}','json')
|
764
|
+
|
765
|
+
|
766
|
+
# pull querystring keys from options
|
767
|
+
queryopts = options.select do |key,value|
|
768
|
+
query_param_keys.include? key
|
769
|
+
end
|
770
|
+
|
771
|
+
headers = nil
|
772
|
+
post_body = nil
|
773
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
774
|
+
GetDailySettlementStatsOut.new(response)
|
775
|
+
|
776
|
+
end
|
777
|
+
|
778
|
+
def get_refunds (format,moss_country_code,date_from,opts={})
|
779
|
+
query_param_keys = [:format,:moss_country_code,:date_from]
|
780
|
+
|
781
|
+
# verify existence of params
|
782
|
+
raise "date_from is required" if date_from.nil?
|
783
|
+
# set default values and merge with input
|
784
|
+
options = {
|
785
|
+
:format => format,
|
786
|
+
:moss_country_code => moss_country_code,
|
787
|
+
:date_from => date_from}.merge(opts)
|
788
|
+
|
789
|
+
#resource path
|
790
|
+
path = "/api/v1/settlement/refunds".sub('{format}','json')
|
791
|
+
|
792
|
+
|
793
|
+
# pull querystring keys from options
|
794
|
+
queryopts = options.select do |key,value|
|
795
|
+
query_param_keys.include? key
|
796
|
+
end
|
797
|
+
|
798
|
+
headers = nil
|
799
|
+
post_body = nil
|
800
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
801
|
+
GetRefundsOut.new(response)
|
802
|
+
|
803
|
+
end
|
804
|
+
|
805
|
+
def get_settlement (format,moss_country_code,moss_tax_id,quarter,opts={})
|
806
|
+
query_param_keys = [:format,:moss_country_code,:moss_tax_id]
|
807
|
+
|
808
|
+
# verify existence of params
|
809
|
+
raise "quarter is required" if quarter.nil?
|
810
|
+
# set default values and merge with input
|
811
|
+
options = {
|
812
|
+
:format => format,
|
813
|
+
:moss_country_code => moss_country_code,
|
814
|
+
:moss_tax_id => moss_tax_id,
|
815
|
+
:quarter => quarter}.merge(opts)
|
816
|
+
|
817
|
+
#resource path
|
818
|
+
path = "/api/v1/settlement/{quarter}".sub('{format}','json').sub('{' + 'quarter' + '}', escapeString(quarter))
|
819
|
+
|
820
|
+
|
821
|
+
# pull querystring keys from options
|
822
|
+
queryopts = options.select do |key,value|
|
823
|
+
query_param_keys.include? key
|
824
|
+
end
|
825
|
+
|
826
|
+
headers = nil
|
827
|
+
post_body = nil
|
828
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
829
|
+
GetSettlementOut.new(response)
|
830
|
+
|
831
|
+
end
|
832
|
+
|
833
|
+
def get_settlement_summary (moss_country_code,quarter,opts={})
|
834
|
+
query_param_keys = [:moss_country_code]
|
835
|
+
|
836
|
+
# verify existence of params
|
837
|
+
raise "quarter is required" if quarter.nil?
|
838
|
+
# set default values and merge with input
|
839
|
+
options = {
|
840
|
+
:moss_country_code => moss_country_code,
|
841
|
+
:quarter => quarter}.merge(opts)
|
842
|
+
|
843
|
+
#resource path
|
844
|
+
path = "/api/v1/settlement/summary/{quarter}".sub('{format}','json').sub('{' + 'quarter' + '}', escapeString(quarter))
|
845
|
+
|
846
|
+
|
847
|
+
# pull querystring keys from options
|
848
|
+
queryopts = options.select do |key,value|
|
849
|
+
query_param_keys.include? key
|
850
|
+
end
|
851
|
+
|
852
|
+
headers = nil
|
853
|
+
post_body = nil
|
854
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
855
|
+
GetSettlementSummaryOut.new(response)
|
856
|
+
|
857
|
+
end
|
858
|
+
|
859
|
+
def create_s_m_s_token (body,opts={})
|
860
|
+
query_param_keys = []
|
861
|
+
|
862
|
+
# verify existence of params
|
863
|
+
raise "body is required" if body.nil?
|
864
|
+
# set default values and merge with input
|
865
|
+
options = {
|
866
|
+
:body => body}.merge(opts)
|
867
|
+
|
868
|
+
#resource path
|
869
|
+
path = "/api/v1/verification/sms".sub('{format}','json')
|
870
|
+
|
871
|
+
|
872
|
+
# pull querystring keys from options
|
873
|
+
queryopts = options.select do |key,value|
|
874
|
+
query_param_keys.include? key
|
875
|
+
end
|
876
|
+
|
877
|
+
headers = nil
|
878
|
+
post_body = nil
|
879
|
+
if body != nil
|
880
|
+
if body.is_a?(Array)
|
881
|
+
array = Array.new
|
882
|
+
body.each do |item|
|
883
|
+
if item.respond_to?("to_body".to_sym)
|
884
|
+
array.push item.to_body
|
885
|
+
else
|
886
|
+
array.push item
|
887
|
+
end
|
888
|
+
end
|
889
|
+
post_body = array
|
890
|
+
|
891
|
+
else
|
892
|
+
if body.respond_to?("to_body".to_sym)
|
893
|
+
post_body = body.to_body
|
894
|
+
else
|
895
|
+
post_body = body
|
896
|
+
end
|
897
|
+
end
|
898
|
+
end
|
899
|
+
response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
900
|
+
CreateSMSTokenOut.new(response)
|
901
|
+
|
902
|
+
end
|
903
|
+
|
904
|
+
def verify_s_m_s_token (token,opts={})
|
905
|
+
query_param_keys = []
|
906
|
+
|
907
|
+
# verify existence of params
|
908
|
+
raise "token is required" if token.nil?
|
909
|
+
# set default values and merge with input
|
910
|
+
options = {
|
911
|
+
:token => token}.merge(opts)
|
912
|
+
|
913
|
+
#resource path
|
914
|
+
path = "/api/v1/verification/sms/{token}".sub('{format}','json').sub('{' + 'token' + '}', escapeString(token))
|
915
|
+
|
916
|
+
|
917
|
+
# pull querystring keys from options
|
918
|
+
queryopts = options.select do |key,value|
|
919
|
+
query_param_keys.include? key
|
920
|
+
end
|
921
|
+
|
922
|
+
headers = nil
|
923
|
+
post_body = nil
|
924
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
925
|
+
VerifySMSTokenOut.new(response)
|
926
|
+
|
927
|
+
end
|
928
|
+
|
929
|
+
def get_currencies_dict (opts={})
|
930
|
+
query_param_keys = []
|
931
|
+
|
932
|
+
# set default values and merge with input
|
933
|
+
options = {
|
934
|
+
}.merge(opts)
|
935
|
+
|
936
|
+
#resource path
|
937
|
+
path = "/api/v1/dictionaries/currencies".sub('{format}','json')
|
938
|
+
|
939
|
+
|
940
|
+
# pull querystring keys from options
|
941
|
+
queryopts = options.select do |key,value|
|
942
|
+
query_param_keys.include? key
|
943
|
+
end
|
944
|
+
|
945
|
+
headers = nil
|
946
|
+
post_body = nil
|
947
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
948
|
+
GetCurrenciesDictOut.new(response)
|
949
|
+
|
950
|
+
end
|
951
|
+
|
952
|
+
def get_product_types_dict (opts={})
|
953
|
+
query_param_keys = []
|
954
|
+
|
955
|
+
# set default values and merge with input
|
956
|
+
options = {
|
957
|
+
}.merge(opts)
|
958
|
+
|
959
|
+
#resource path
|
960
|
+
path = "/api/v1/dictionaries/product_types".sub('{format}','json')
|
961
|
+
|
962
|
+
|
963
|
+
# pull querystring keys from options
|
964
|
+
queryopts = options.select do |key,value|
|
965
|
+
query_param_keys.include? key
|
966
|
+
end
|
967
|
+
|
968
|
+
headers = nil
|
969
|
+
post_body = nil
|
970
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
971
|
+
GetProductTypesDictOut.new(response)
|
972
|
+
|
973
|
+
end
|
974
|
+
|
975
|
+
def get_countries_dict (tax_supported,opts={})
|
976
|
+
query_param_keys = [:tax_supported]
|
977
|
+
|
978
|
+
# set default values and merge with input
|
979
|
+
options = {
|
980
|
+
:tax_supported => tax_supported}.merge(opts)
|
981
|
+
|
982
|
+
#resource path
|
983
|
+
path = "/api/v1/dictionaries/countries".sub('{format}','json')
|
984
|
+
|
985
|
+
|
986
|
+
# pull querystring keys from options
|
987
|
+
queryopts = options.select do |key,value|
|
988
|
+
query_param_keys.include? key
|
989
|
+
end
|
990
|
+
|
991
|
+
headers = nil
|
992
|
+
post_body = nil
|
993
|
+
response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }).make.body
|
994
|
+
GetCountriesDictOut.new(response)
|
995
|
+
|
996
|
+
end
|
997
|
+
|
998
|
+
end
|
999
|
+
end
|