processout 2.19.0 → 2.20.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. metadata +4 -67
  3. data/.gitignore +0 -52
  4. data/.rspec +0 -2
  5. data/.travis.yml +0 -5
  6. data/Dockerfile +0 -7
  7. data/Gemfile +0 -4
  8. data/LICENSE.txt +0 -21
  9. data/Makefile +0 -4
  10. data/README.md +0 -12
  11. data/Rakefile +0 -6
  12. data/bin/console +0 -14
  13. data/bin/setup +0 -8
  14. data/lib/processout/activity.rb +0 -206
  15. data/lib/processout/addon.rb +0 -401
  16. data/lib/processout/alternative_merchant_certificate.rb +0 -94
  17. data/lib/processout/api_request.rb +0 -295
  18. data/lib/processout/api_version.rb +0 -92
  19. data/lib/processout/apple_pay_alternative_merchant_certificates.rb +0 -110
  20. data/lib/processout/balance.rb +0 -81
  21. data/lib/processout/balances.rb +0 -111
  22. data/lib/processout/card.rb +0 -503
  23. data/lib/processout/card_information.rb +0 -164
  24. data/lib/processout/coupon.rb +0 -352
  25. data/lib/processout/customer.rb +0 -755
  26. data/lib/processout/customer_action.rb +0 -81
  27. data/lib/processout/discount.rb +0 -360
  28. data/lib/processout/dunning_action.rb +0 -81
  29. data/lib/processout/errors/authentication_error.rb +0 -9
  30. data/lib/processout/errors/generic_error.rb +0 -9
  31. data/lib/processout/errors/internal_error.rb +0 -9
  32. data/lib/processout/errors/notfound_error.rb +0 -9
  33. data/lib/processout/errors/validation_error.rb +0 -9
  34. data/lib/processout/event.rb +0 -237
  35. data/lib/processout/gateway.rb +0 -210
  36. data/lib/processout/gateway_configuration.rb +0 -346
  37. data/lib/processout/gateway_request.rb +0 -26
  38. data/lib/processout/invoice.rb +0 -945
  39. data/lib/processout/invoice_detail.rb +0 -235
  40. data/lib/processout/invoice_device.rb +0 -92
  41. data/lib/processout/invoice_external_fraud_tools.rb +0 -70
  42. data/lib/processout/invoice_risk.rb +0 -81
  43. data/lib/processout/invoice_shipping.rb +0 -191
  44. data/lib/processout/invoice_tax.rb +0 -81
  45. data/lib/processout/networking/request.rb +0 -102
  46. data/lib/processout/networking/response.rb +0 -67
  47. data/lib/processout/payment_data_network_authentication.rb +0 -70
  48. data/lib/processout/payment_data_three_ds_authentication.rb +0 -70
  49. data/lib/processout/payment_data_three_ds_request.rb +0 -103
  50. data/lib/processout/payout.rb +0 -379
  51. data/lib/processout/payout_item.rb +0 -238
  52. data/lib/processout/plan.rb +0 -368
  53. data/lib/processout/product.rb +0 -368
  54. data/lib/processout/project.rb +0 -353
  55. data/lib/processout/refund.rb +0 -277
  56. data/lib/processout/subscription.rb +0 -910
  57. data/lib/processout/three_ds.rb +0 -158
  58. data/lib/processout/token.rb +0 -493
  59. data/lib/processout/transaction.rb +0 -905
  60. data/lib/processout/transaction_operation.rb +0 -418
  61. data/lib/processout/version.rb +0 -3
  62. data/lib/processout/webhook.rb +0 -237
  63. data/lib/processout/webhook_endpoint.rb +0 -149
  64. data/lib/processout.rb +0 -263
  65. data/processout.gemspec +0 -26
@@ -1,352 +0,0 @@
1
- # The content of this file was automatically generated
2
-
3
- require "cgi"
4
- require "json"
5
- require "processout/networking/request"
6
- require "processout/networking/response"
7
-
8
- module ProcessOut
9
- class Coupon
10
-
11
- attr_reader :id
12
- attr_reader :project
13
- attr_reader :project_id
14
- attr_reader :amount_off
15
- attr_reader :percent_off
16
- attr_reader :currency
17
- attr_reader :iteration_count
18
- attr_reader :max_redemptions
19
- attr_reader :expires_at
20
- attr_reader :metadata
21
- attr_reader :redeemed_number
22
- attr_reader :sandbox
23
- attr_reader :created_at
24
-
25
-
26
- def id=(val)
27
- @id = val
28
- end
29
-
30
- def project=(val)
31
- if val.nil?
32
- @project = val
33
- return
34
- end
35
-
36
- if val.instance_of? Project
37
- @project = val
38
- else
39
- obj = Project.new(@client)
40
- obj.fill_with_data(val)
41
- @project = obj
42
- end
43
-
44
- end
45
-
46
- def project_id=(val)
47
- @project_id = val
48
- end
49
-
50
- def amount_off=(val)
51
- @amount_off = val
52
- end
53
-
54
- def percent_off=(val)
55
- @percent_off = val
56
- end
57
-
58
- def currency=(val)
59
- @currency = val
60
- end
61
-
62
- def iteration_count=(val)
63
- @iteration_count = val
64
- end
65
-
66
- def max_redemptions=(val)
67
- @max_redemptions = val
68
- end
69
-
70
- def expires_at=(val)
71
- @expires_at = val
72
- end
73
-
74
- def metadata=(val)
75
- @metadata = val
76
- end
77
-
78
- def redeemed_number=(val)
79
- @redeemed_number = val
80
- end
81
-
82
- def sandbox=(val)
83
- @sandbox = val
84
- end
85
-
86
- def created_at=(val)
87
- @created_at = val
88
- end
89
-
90
-
91
- # Initializes the Coupon object
92
- # Params:
93
- # +client+:: +ProcessOut+ client instance
94
- # +data+:: data that can be used to fill the object
95
- def initialize(client, data = {})
96
- @client = client
97
-
98
- self.id = data.fetch(:id, nil)
99
- self.project = data.fetch(:project, nil)
100
- self.project_id = data.fetch(:project_id, nil)
101
- self.amount_off = data.fetch(:amount_off, nil)
102
- self.percent_off = data.fetch(:percent_off, nil)
103
- self.currency = data.fetch(:currency, nil)
104
- self.iteration_count = data.fetch(:iteration_count, nil)
105
- self.max_redemptions = data.fetch(:max_redemptions, nil)
106
- self.expires_at = data.fetch(:expires_at, nil)
107
- self.metadata = data.fetch(:metadata, nil)
108
- self.redeemed_number = data.fetch(:redeemed_number, nil)
109
- self.sandbox = data.fetch(:sandbox, nil)
110
- self.created_at = data.fetch(:created_at, nil)
111
-
112
- end
113
-
114
- # Create a new Coupon using the current client
115
- def new(data = {})
116
- Coupon.new(@client, data)
117
- end
118
-
119
- # Overrides the JSON marshaller to only send the fields we want
120
- def to_json(options)
121
- {
122
- "id": self.id,
123
- "project": self.project,
124
- "project_id": self.project_id,
125
- "amount_off": self.amount_off,
126
- "percent_off": self.percent_off,
127
- "currency": self.currency,
128
- "iteration_count": self.iteration_count,
129
- "max_redemptions": self.max_redemptions,
130
- "expires_at": self.expires_at,
131
- "metadata": self.metadata,
132
- "redeemed_number": self.redeemed_number,
133
- "sandbox": self.sandbox,
134
- "created_at": self.created_at,
135
- }.to_json
136
- end
137
-
138
- # Fills the object with data coming from the API
139
- # Params:
140
- # +data+:: +Hash+ of data coming from the API
141
- def fill_with_data(data)
142
- if data.nil?
143
- return self
144
- end
145
- if data.include? "id"
146
- self.id = data["id"]
147
- end
148
- if data.include? "project"
149
- self.project = data["project"]
150
- end
151
- if data.include? "project_id"
152
- self.project_id = data["project_id"]
153
- end
154
- if data.include? "amount_off"
155
- self.amount_off = data["amount_off"]
156
- end
157
- if data.include? "percent_off"
158
- self.percent_off = data["percent_off"]
159
- end
160
- if data.include? "currency"
161
- self.currency = data["currency"]
162
- end
163
- if data.include? "iteration_count"
164
- self.iteration_count = data["iteration_count"]
165
- end
166
- if data.include? "max_redemptions"
167
- self.max_redemptions = data["max_redemptions"]
168
- end
169
- if data.include? "expires_at"
170
- self.expires_at = data["expires_at"]
171
- end
172
- if data.include? "metadata"
173
- self.metadata = data["metadata"]
174
- end
175
- if data.include? "redeemed_number"
176
- self.redeemed_number = data["redeemed_number"]
177
- end
178
- if data.include? "sandbox"
179
- self.sandbox = data["sandbox"]
180
- end
181
- if data.include? "created_at"
182
- self.created_at = data["created_at"]
183
- end
184
-
185
- self
186
- end
187
-
188
- # Prefills the object with the data passed as parameters
189
- # Params:
190
- # +data+:: +Hash+ of data
191
- def prefill(data)
192
- if data.nil?
193
- return self
194
- end
195
- self.id = data.fetch(:id, self.id)
196
- self.project = data.fetch(:project, self.project)
197
- self.project_id = data.fetch(:project_id, self.project_id)
198
- self.amount_off = data.fetch(:amount_off, self.amount_off)
199
- self.percent_off = data.fetch(:percent_off, self.percent_off)
200
- self.currency = data.fetch(:currency, self.currency)
201
- self.iteration_count = data.fetch(:iteration_count, self.iteration_count)
202
- self.max_redemptions = data.fetch(:max_redemptions, self.max_redemptions)
203
- self.expires_at = data.fetch(:expires_at, self.expires_at)
204
- self.metadata = data.fetch(:metadata, self.metadata)
205
- self.redeemed_number = data.fetch(:redeemed_number, self.redeemed_number)
206
- self.sandbox = data.fetch(:sandbox, self.sandbox)
207
- self.created_at = data.fetch(:created_at, self.created_at)
208
-
209
- self
210
- end
211
-
212
- # Get all the coupons.
213
- # Params:
214
- # +options+:: +Hash+ of options
215
- def all(options = {})
216
- self.prefill(options)
217
-
218
- request = Request.new(@client)
219
- path = "/coupons"
220
- data = {
221
-
222
- }
223
-
224
- response = Response.new(request.get(path, data, options))
225
- return_values = Array.new
226
-
227
- a = Array.new
228
- body = response.body
229
- for v in body['coupons']
230
- tmp = Coupon.new(@client)
231
- tmp.fill_with_data(v)
232
- a.push(tmp)
233
- end
234
-
235
- return_values.push(a)
236
-
237
-
238
-
239
- return_values[0]
240
- end
241
-
242
- # Create a new coupon.
243
- # Params:
244
- # +options+:: +Hash+ of options
245
- def create(options = {})
246
- self.prefill(options)
247
-
248
- request = Request.new(@client)
249
- path = "/coupons"
250
- data = {
251
- "id" => @id,
252
- "amount_off" => @amount_off,
253
- "percent_off" => @percent_off,
254
- "currency" => @currency,
255
- "iteration_count" => @iteration_count,
256
- "max_redemptions" => @max_redemptions,
257
- "expires_at" => @expires_at,
258
- "metadata" => @metadata
259
- }
260
-
261
- response = Response.new(request.post(path, data, options))
262
- return_values = Array.new
263
-
264
- body = response.body
265
- body = body["coupon"]
266
-
267
-
268
- return_values.push(self.fill_with_data(body))
269
-
270
-
271
-
272
- return_values[0]
273
- end
274
-
275
- # Find a coupon by its ID.
276
- # Params:
277
- # +coupon_id+:: ID of the coupon
278
- # +options+:: +Hash+ of options
279
- def find(coupon_id, options = {})
280
- self.prefill(options)
281
-
282
- request = Request.new(@client)
283
- path = "/coupons/" + CGI.escape(coupon_id) + ""
284
- data = {
285
-
286
- }
287
-
288
- response = Response.new(request.get(path, data, options))
289
- return_values = Array.new
290
-
291
- body = response.body
292
- body = body["coupon"]
293
-
294
-
295
- obj = Coupon.new(@client)
296
- return_values.push(obj.fill_with_data(body))
297
-
298
-
299
-
300
- return_values[0]
301
- end
302
-
303
- # Save the updated coupon attributes.
304
- # Params:
305
- # +options+:: +Hash+ of options
306
- def save(options = {})
307
- self.prefill(options)
308
-
309
- request = Request.new(@client)
310
- path = "/coupons/" + CGI.escape(@id) + ""
311
- data = {
312
- "metadata" => @metadata
313
- }
314
-
315
- response = Response.new(request.put(path, data, options))
316
- return_values = Array.new
317
-
318
- body = response.body
319
- body = body["coupon"]
320
-
321
-
322
- return_values.push(self.fill_with_data(body))
323
-
324
-
325
-
326
- return_values[0]
327
- end
328
-
329
- # Delete the coupon.
330
- # Params:
331
- # +options+:: +Hash+ of options
332
- def delete(options = {})
333
- self.prefill(options)
334
-
335
- request = Request.new(@client)
336
- path = "/coupons/" + CGI.escape(@id) + ""
337
- data = {
338
-
339
- }
340
-
341
- response = Response.new(request.delete(path, data, options))
342
- return_values = Array.new
343
-
344
- return_values.push(response.success)
345
-
346
-
347
- return_values[0]
348
- end
349
-
350
-
351
- end
352
- end