tpaga 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f0e1a22b59a371a358aa8d8f843098875a4079bf
4
+ data.tar.gz: 0d9e2cd91d18c82f3a2eead1c201ec1f49c13fd3
5
+ SHA512:
6
+ metadata.gz: 1c08897af95d8e26dd5d068cc248a99837cf27e4267d8146a25db4533947d4d234b5fdb89a267ffb372321e7997e1932b3070a98588eaf4920c680dd21c7e90a
7
+ data.tar.gz: e6d69f8c6d8abda52ff0a8ce9056a49cbfbccefc03fdc62070967333575d986cd3a9e1b04778e30e3a5f4915d047b72b24cf2a6cb1dd73ee79126c3d1e927a07
@@ -0,0 +1,135 @@
1
+ require "uri"
2
+
3
+ module Tpaga
4
+ class ChargeAPI
5
+ basePath = "https://api.tpaga.co.local:8443/api"
6
+ # apiInvoker = APIInvoker
7
+
8
+ def self.escapeString(string)
9
+ URI.encode(string.to_s)
10
+ end
11
+
12
+
13
+
14
+ # Add a new Charge to Customer's CreditCard
15
+ # A new `Charge` to a `CreditCard` is created.
16
+ # @param body Charge object that needs to be authorized.
17
+ # @return Charge
18
+ def self.add_charge (body,opts={})
19
+ query_param_keys = []
20
+
21
+ # verify existence of params
22
+ raise "body is required" if body.nil?
23
+ # set default values and merge with input
24
+ options = {
25
+ }.merge(opts)
26
+
27
+ required_options = {
28
+ :'body' => body}
29
+
30
+ options.merge!(required_options)
31
+
32
+ #resource path
33
+ path = "/charge"
34
+
35
+
36
+ # pull querystring keys from options
37
+ queryopts = options.select do |key,value|
38
+ query_param_keys.include? key
39
+ end
40
+
41
+ # header parameter
42
+ headers = {}
43
+ # additional http headers
44
+ headers['Accept'] = 'application/json'
45
+ headers['Content-Type'] = 'application/json'
46
+
47
+ # http body
48
+ post_body = nil
49
+ if body != nil
50
+ if body.is_a?(Array)
51
+ array = Array.new
52
+ body.each do |item|
53
+ if item.respond_to?("to_body".to_sym)
54
+ array.push item.to_body
55
+ else
56
+ array.push item
57
+ end
58
+ end
59
+ post_body = array
60
+
61
+ else
62
+ if body.respond_to?("to_body".to_sym)
63
+ post_body = body.to_body
64
+ else
65
+ post_body = body
66
+ end
67
+ end
68
+ end
69
+ # form parameter
70
+ form_parameter_hash = {}
71
+
72
+
73
+
74
+ # authentication setting
75
+ require_auth = true
76
+
77
+ response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :form_params => form_parameter_hash, :body=>post_body, :require_auth => require_auth }).make.body
78
+ Charge.new(response)
79
+
80
+ end
81
+
82
+
83
+
84
+ # Find a Charge by ID
85
+ # Returns a `Charge` when id is `charge_token_id` or anything else will simulate API error conditions
86
+ # @param id Identification of `Charge` that needs to be fetched
87
+ # @return Charge
88
+ def self.get_charge_by_id (id,opts={})
89
+ query_param_keys = []
90
+
91
+ # verify existence of params
92
+ raise "id is required" if id.nil?
93
+ # set default values and merge with input
94
+ options = {
95
+ }.merge(opts)
96
+
97
+ required_options = {
98
+ :'id' => id}
99
+
100
+ options.merge!(required_options)
101
+
102
+ #resource path
103
+ path = "/charge/{id}".sub('{' + 'id' + '}', escapeString(id))
104
+
105
+
106
+
107
+ # pull querystring keys from options
108
+ queryopts = options.select do |key,value|
109
+ query_param_keys.include? key
110
+ end
111
+
112
+ # header parameter
113
+ headers = {}
114
+ # additional http headers
115
+ headers['Accept'] = 'application/json'
116
+ headers['Content-Type'] = 'application/x-www-form-urlencoded'
117
+
118
+ # http body
119
+ post_body = nil
120
+ # form parameter
121
+ form_parameter_hash = {}
122
+
123
+
124
+
125
+ # authentication setting
126
+ require_auth = true
127
+
128
+ response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :form_params => form_parameter_hash, :body=>post_body, :require_auth => require_auth }).make.body
129
+ Charge.new(response)
130
+
131
+ end
132
+
133
+ end
134
+ end
135
+
@@ -0,0 +1,368 @@
1
+ require "uri"
2
+
3
+ module Tpaga
4
+ class CustomerAPI
5
+ basePath = "https://api.tpaga.co.local:8443/api"
6
+ # apiInvoker = APIInvoker
7
+
8
+ def self.escapeString(string)
9
+ URI.encode(string.to_s)
10
+ end
11
+
12
+
13
+
14
+ # Add a new Customer to the Merchant
15
+ # Creates a new `Customer` associated to the Merchant
16
+ # @param body Customer object that needs to be added to the Merchant
17
+ # @return Customer
18
+ def self.add_customer (body,opts={})
19
+ query_param_keys = []
20
+
21
+ # verify existence of params
22
+ raise "body is required" if body.nil?
23
+ # set default values and merge with input
24
+ options = {
25
+ }.merge(opts)
26
+
27
+ required_options = {
28
+ :'body' => body}
29
+
30
+ options.merge!(required_options)
31
+
32
+ #resource path
33
+ path = "/customer"
34
+
35
+
36
+ # pull querystring keys from options
37
+ queryopts = options.select do |key,value|
38
+ query_param_keys.include? key
39
+ end
40
+
41
+ # header parameter
42
+ headers = {}
43
+ # additional http headers
44
+ headers['Accept'] = 'application/json'
45
+ headers['Content-Type'] = 'application/json'
46
+
47
+ # http body
48
+ post_body = nil
49
+ if body != nil
50
+ if body.is_a?(Array)
51
+ array = Array.new
52
+ body.each do |item|
53
+ if item.respond_to?("to_body".to_sym)
54
+ array.push item.to_body
55
+ else
56
+ array.push item
57
+ end
58
+ end
59
+ post_body = array
60
+
61
+ else
62
+ if body.respond_to?("to_body".to_sym)
63
+ post_body = body.to_body
64
+ else
65
+ post_body = body
66
+ end
67
+ end
68
+ end
69
+ # form parameter
70
+ form_parameter_hash = {}
71
+
72
+
73
+
74
+ # authentication setting
75
+ require_auth = true
76
+
77
+ response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :form_params => form_parameter_hash, :body=>post_body, :require_auth => require_auth }).make.body
78
+ Customer.new(response)
79
+
80
+ end
81
+
82
+
83
+
84
+ # Add a new Credit Card payment method to the Customer
85
+ # Creates a new `CreditCard` and associated to the `Customer`
86
+ # @param customer_id Identificaiton of `Customer` to associate the new `CreditCard`
87
+ # @param body CreditCard object that needs to be added to the Customer
88
+ # @return CreditCard
89
+ def self.add_credit_card (customer_id,body,opts={})
90
+ query_param_keys = []
91
+
92
+ # verify existence of params
93
+ raise "customer_id is required" if customer_id.nil?
94
+ raise "body is required" if body.nil?
95
+ # set default values and merge with input
96
+ options = {
97
+ }.merge(opts)
98
+
99
+ required_options = {
100
+ :'customer_id' => customer_id,
101
+ :'body' => body}
102
+
103
+ options.merge!(required_options)
104
+
105
+ #resource path
106
+ path = "/customer/{customer_id}/credit_card".sub('{' + 'customer_id' + '}', escapeString(customer_id))
107
+
108
+
109
+
110
+ # pull querystring keys from options
111
+ queryopts = options.select do |key,value|
112
+ query_param_keys.include? key
113
+ end
114
+
115
+ # header parameter
116
+ headers = {}
117
+ # additional http headers
118
+ headers['Accept'] = 'application/json'
119
+ headers['Content-Type'] = 'application/json'
120
+
121
+ # http body
122
+ post_body = nil
123
+ if body != nil
124
+ if body.is_a?(Array)
125
+ array = Array.new
126
+ body.each do |item|
127
+ if item.respond_to?("to_body".to_sym)
128
+ array.push item.to_body
129
+ else
130
+ array.push item
131
+ end
132
+ end
133
+ post_body = array
134
+
135
+ else
136
+ if body.respond_to?("to_body".to_sym)
137
+ post_body = body.to_body
138
+ else
139
+ post_body = body
140
+ end
141
+ end
142
+ end
143
+ # form parameter
144
+ form_parameter_hash = {}
145
+
146
+
147
+
148
+ # authentication setting
149
+ require_auth = true
150
+
151
+ response = Swagger::Request.new(:POST, path, {:params=>queryopts,:headers=>headers, :form_params => form_parameter_hash, :body=>post_body, :require_auth => require_auth }).make.body
152
+ CreditCard.new(response)
153
+
154
+ end
155
+
156
+
157
+
158
+ # Find a Customer by ID
159
+ # Returns a `Customer` when ID is `customer_token_id` or anything else will simulate API error conditions
160
+ # @param id Identification of `Customer` that needs to be fetched
161
+ # @return Customer
162
+ def self.get_customer_by_id (id,opts={})
163
+ query_param_keys = []
164
+
165
+ # verify existence of params
166
+ raise "id is required" if id.nil?
167
+ # set default values and merge with input
168
+ options = {
169
+ }.merge(opts)
170
+
171
+ required_options = {
172
+ :'id' => id}
173
+
174
+ options.merge!(required_options)
175
+
176
+ #resource path
177
+ path = "/customer/{id}".sub('{' + 'id' + '}', escapeString(id))
178
+
179
+
180
+
181
+ # pull querystring keys from options
182
+ queryopts = options.select do |key,value|
183
+ query_param_keys.include? key
184
+ end
185
+
186
+ # header parameter
187
+ headers = {}
188
+ # additional http headers
189
+ headers['Accept'] = 'application/json'
190
+ headers['Content-Type'] = 'application/x-www-form-urlencoded'
191
+
192
+ # http body
193
+ post_body = nil
194
+ # form parameter
195
+ form_parameter_hash = {}
196
+
197
+
198
+
199
+ # authentication setting
200
+ require_auth = true
201
+
202
+ response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :form_params => form_parameter_hash, :body=>post_body, :require_auth => require_auth }).make.body
203
+ Customer.new(response)
204
+
205
+ end
206
+
207
+
208
+
209
+ # Deletes a Customer by ID
210
+ # Deletes a Customer when ID is `customer_token_id_delete` or anything else will simulate API error conditions. Only available when the customer does not have associated payment methods.
211
+ # @param id Identificaiton of customer that needs to be deleted
212
+ # @return void
213
+ def self.delete_customer_by_id (id,opts={})
214
+ query_param_keys = []
215
+
216
+ # verify existence of params
217
+ raise "id is required" if id.nil?
218
+ # set default values and merge with input
219
+ options = {
220
+ }.merge(opts)
221
+
222
+ required_options = {
223
+ :'id' => id}
224
+
225
+ options.merge!(required_options)
226
+
227
+ #resource path
228
+ path = "/customer/{id}".sub('{' + 'id' + '}', escapeString(id))
229
+
230
+
231
+
232
+ # pull querystring keys from options
233
+ queryopts = options.select do |key,value|
234
+ query_param_keys.include? key
235
+ end
236
+
237
+ # header parameter
238
+ headers = {}
239
+ # additional http headers
240
+ headers['Accept'] = 'application/json'
241
+ headers['Content-Type'] = 'application/x-www-form-urlencoded'
242
+
243
+ # http body
244
+ post_body = nil
245
+ # form parameter
246
+ form_parameter_hash = {}
247
+
248
+
249
+
250
+ # authentication setting
251
+ require_auth = true
252
+
253
+ Swagger::Request.new(:DELETE, path, {:params=>queryopts,:headers=>headers, :form_params => form_parameter_hash, :body=>post_body, :require_auth => require_auth }).make
254
+
255
+
256
+ end
257
+
258
+
259
+
260
+ # Find a `CreditCard` by ID
261
+ # Returns a CreditCard when ID is `credit_card_token` or anything else will simulate API error conditions
262
+ # @param customer_id Identificaiton of `Customer` associated with the card
263
+ # @param card_id Identification of `CreditCard` that needs to be fetched
264
+ # @return CreditCard
265
+ def self.get_credit_card_by_id (customer_id,card_id,opts={})
266
+ query_param_keys = []
267
+
268
+ # verify existence of params
269
+ raise "customer_id is required" if customer_id.nil?
270
+ raise "card_id is required" if card_id.nil?
271
+ # set default values and merge with input
272
+ options = {
273
+ }.merge(opts)
274
+
275
+ required_options = {
276
+ :'customer_id' => customer_id,
277
+ :'card_id' => card_id}
278
+
279
+ options.merge!(required_options)
280
+
281
+ #resource path
282
+ path = "/customer/{customer_id}/credit_card/{card_id}".sub('{' + 'customer_id' + '}', escapeString(customer_id))
283
+ path = path.sub('{' + 'card_id' + '}', escapeString(card_id))
284
+
285
+
286
+ # pull querystring keys from options
287
+ queryopts = options.select do |key,value|
288
+ query_param_keys.include? key
289
+ end
290
+
291
+ # header parameter
292
+ headers = {}
293
+ # additional http headers
294
+ headers['Accept'] = 'application/json'
295
+ headers['Content-Type'] = 'application/x-www-form-urlencoded'
296
+
297
+ # http body
298
+ post_body = nil
299
+ # form parameter
300
+ form_parameter_hash = {}
301
+
302
+
303
+
304
+ # authentication setting
305
+ require_auth = true
306
+
307
+ response = Swagger::Request.new(:GET, path, {:params=>queryopts,:headers=>headers, :form_params => form_parameter_hash, :body=>post_body, :require_auth => require_auth }).make.body
308
+ CreditCard.new(response)
309
+
310
+ end
311
+
312
+
313
+
314
+ # Deletes a Credit Card by ID
315
+ # Deletes a `CreditCard` when ID is `credit_card_token_delete` or anything else will simulate API error conditions. Only available when the CreditCard does not have associated Charges.
316
+ # @param customer_id Identificaiton token of `Customer` associated with the card
317
+ # @param card_id Identification token of `CreditCard` that needs to be deleted
318
+ # @return void
319
+ def self.delete_credit_card_by_id (customer_id,card_id,opts={})
320
+ query_param_keys = []
321
+
322
+ # verify existence of params
323
+ raise "customer_id is required" if customer_id.nil?
324
+ raise "card_id is required" if card_id.nil?
325
+ # set default values and merge with input
326
+ options = {
327
+ }.merge(opts)
328
+
329
+ required_options = {
330
+ :'customer_id' => customer_id,
331
+ :'card_id' => card_id}
332
+
333
+ options.merge!(required_options)
334
+
335
+ #resource path
336
+ path = "/customer/{customer_id}/credit_card/{card_id}".sub('{' + 'customer_id' + '}', escapeString(customer_id))
337
+ path = path.sub('{' + 'card_id' + '}', escapeString(card_id))
338
+
339
+
340
+
341
+ # pull querystring keys from options
342
+ queryopts = options.select do |key,value|
343
+ query_param_keys.include? key
344
+ end
345
+
346
+ # header parameter
347
+ headers = {}
348
+ # additional http headers
349
+ headers['Accept'] = 'application/json'
350
+ headers['Content-Type'] = 'application/x-www-form-urlencoded'
351
+
352
+ # http body
353
+ post_body = nil
354
+ # form parameter
355
+ form_parameter_hash = {}
356
+
357
+
358
+
359
+ # authentication setting
360
+ require_auth = true
361
+
362
+ Swagger::Request.new(:DELETE, path, {:params=>queryopts,:headers=>headers, :form_params => form_parameter_hash, :body=>post_body, :require_auth => require_auth }).make
363
+
364
+
365
+ end
366
+
367
+ end
368
+ end
@@ -0,0 +1,67 @@
1
+ require 'date'
2
+
3
+ module Tpaga
4
+ class Address
5
+ attr_accessor :addressLine1, :addressLine2, :city, :postalCode
6
+
7
+ # :internal => :external
8
+ def self.attribute_map
9
+ {
10
+ :addressLine1 => :'addressLine1',
11
+ :addressLine2 => :'addressLine2',
12
+ :city => :'city',
13
+ :postalCode => :'postalCode'
14
+
15
+ }
16
+ end
17
+
18
+ def initialize(attributes = {})
19
+ return if attributes.empty?
20
+
21
+ # convert hash key from symbol to string
22
+ # and convert object to hash
23
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_s] = Swagger.to_body(v); memo}
24
+
25
+ # Morph attribute keys into undescored rubyish style
26
+ if self.class.attribute_map[:"addressLine1"]
27
+ @addressLine1 = attributes["addressLine1"]
28
+ end
29
+ if self.class.attribute_map[:"addressLine2"]
30
+ @addressLine2 = attributes["addressLine2"]
31
+ end
32
+ if self.class.attribute_map[:"city"]
33
+ @city = City.new(attributes["city"]) if (attributes["city"].kind_of? Hash)
34
+ end
35
+ if self.class.attribute_map[:"postalCode"]
36
+ @postalCode = attributes["postalCode"]
37
+ end
38
+
39
+
40
+ end
41
+
42
+ def to_body
43
+ body = {}
44
+ self.class.attribute_map.each_pair do |key, value|
45
+ next if self.send(key).nil?
46
+
47
+ if self.send(key).respond_to? :to_body
48
+ body[value] = self.send(key).to_body
49
+ elsif self.send(key).kind_of?(Array)
50
+ body[value] = []
51
+ self.send(key).each do |arr|
52
+ if arr.respond_to? :to_body
53
+ body[value] << arr.to_body
54
+ else
55
+ body[value] << arr
56
+ end
57
+ end
58
+ else
59
+ body[value] = self.send(key)
60
+ end
61
+
62
+ end
63
+ body
64
+ end
65
+ end
66
+ end
67
+
@@ -0,0 +1,75 @@
1
+ require 'date'
2
+
3
+ module Tpaga
4
+ class BillingAddress
5
+ attr_accessor :addressLine1, :addressLine2, :city, :country, :postalCode, :state
6
+
7
+ # :internal => :external
8
+ def self.attribute_map
9
+ {
10
+ :addressLine1 => :'addressLine1',
11
+ :addressLine2 => :'addressLine2',
12
+ :city => :'city',
13
+ :country => :'country',
14
+ :postalCode => :'postalCode',
15
+ :state => :'state'
16
+
17
+ }
18
+ end
19
+
20
+ def initialize(attributes = {})
21
+ return if attributes.empty?
22
+
23
+ # convert hash key from symbol to string
24
+ # and convert object to hash
25
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_s] = Swagger.to_body(v); memo}
26
+
27
+ # Morph attribute keys into undescored rubyish style
28
+ if self.class.attribute_map[:"addressLine1"]
29
+ @addressLine1 = attributes["addressLine1"]
30
+ end
31
+ if self.class.attribute_map[:"addressLine2"]
32
+ @addressLine2 = attributes["addressLine2"]
33
+ end
34
+ if self.class.attribute_map[:"city"]
35
+ @city = attributes["city"]
36
+ end
37
+ if self.class.attribute_map[:"country"]
38
+ @country = attributes["country"]
39
+ end
40
+ if self.class.attribute_map[:"postalCode"]
41
+ @postalCode = attributes["postalCode"]
42
+ end
43
+ if self.class.attribute_map[:"state"]
44
+ @state = attributes["state"]
45
+ end
46
+
47
+
48
+ end
49
+
50
+ def to_body
51
+ body = {}
52
+ self.class.attribute_map.each_pair do |key, value|
53
+ next if self.send(key).nil?
54
+
55
+ if self.send(key).respond_to? :to_body
56
+ body[value] = self.send(key).to_body
57
+ elsif self.send(key).kind_of?(Array)
58
+ body[value] = []
59
+ self.send(key).each do |arr|
60
+ if arr.respond_to? :to_body
61
+ body[value] << arr.to_body
62
+ else
63
+ body[value] << arr
64
+ end
65
+ end
66
+ else
67
+ body[value] = self.send(key)
68
+ end
69
+
70
+ end
71
+ body
72
+ end
73
+ end
74
+ end
75
+