processout 2.20.0 → 2.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +52 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Dockerfile +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/Makefile +4 -0
- data/README.md +12 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/processout/activity.rb +206 -0
- data/lib/processout/addon.rb +401 -0
- data/lib/processout/alternative_merchant_certificate.rb +115 -0
- data/lib/processout/api_request.rb +295 -0
- data/lib/processout/api_version.rb +92 -0
- data/lib/processout/apple_pay_alternative_merchant_certificates.rb +121 -0
- data/lib/processout/balance.rb +92 -0
- data/lib/processout/balances.rb +111 -0
- data/lib/processout/card.rb +503 -0
- data/lib/processout/card_information.rb +164 -0
- data/lib/processout/coupon.rb +352 -0
- data/lib/processout/customer.rb +755 -0
- data/lib/processout/customer_action.rb +81 -0
- data/lib/processout/discount.rb +360 -0
- data/lib/processout/dunning_action.rb +81 -0
- data/lib/processout/errors/authentication_error.rb +9 -0
- data/lib/processout/errors/generic_error.rb +9 -0
- data/lib/processout/errors/internal_error.rb +9 -0
- data/lib/processout/errors/notfound_error.rb +9 -0
- data/lib/processout/errors/validation_error.rb +9 -0
- data/lib/processout/event.rb +237 -0
- data/lib/processout/gateway.rb +210 -0
- data/lib/processout/gateway_configuration.rb +346 -0
- data/lib/processout/gateway_request.rb +26 -0
- data/lib/processout/invoice.rb +984 -0
- data/lib/processout/invoice_detail.rb +235 -0
- data/lib/processout/invoice_device.rb +92 -0
- data/lib/processout/invoice_external_fraud_tools.rb +70 -0
- data/lib/processout/invoice_risk.rb +81 -0
- data/lib/processout/invoice_shipping.rb +202 -0
- data/lib/processout/invoice_tax.rb +81 -0
- data/lib/processout/networking/request.rb +102 -0
- data/lib/processout/networking/response.rb +67 -0
- data/lib/processout/payment_data_network_authentication.rb +70 -0
- data/lib/processout/payment_data_three_ds_authentication.rb +70 -0
- data/lib/processout/payment_data_three_ds_request.rb +103 -0
- data/lib/processout/payout.rb +379 -0
- data/lib/processout/payout_item.rb +238 -0
- data/lib/processout/plan.rb +368 -0
- data/lib/processout/product.rb +368 -0
- data/lib/processout/project.rb +353 -0
- data/lib/processout/refund.rb +277 -0
- data/lib/processout/subscription.rb +910 -0
- data/lib/processout/three_ds.rb +158 -0
- data/lib/processout/token.rb +493 -0
- data/lib/processout/transaction.rb +905 -0
- data/lib/processout/transaction_operation.rb +418 -0
- data/lib/processout/version.rb +3 -0
- data/lib/processout/webhook.rb +237 -0
- data/lib/processout/webhook_endpoint.rb +149 -0
- data/lib/processout.rb +263 -0
- data/processout.gemspec +26 -0
- metadata +66 -3
@@ -0,0 +1,418 @@
|
|
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 TransactionOperation
|
10
|
+
|
11
|
+
attr_reader :id
|
12
|
+
attr_reader :transaction
|
13
|
+
attr_reader :transaction_id
|
14
|
+
attr_reader :token
|
15
|
+
attr_reader :token_id
|
16
|
+
attr_reader :card
|
17
|
+
attr_reader :card_id
|
18
|
+
attr_reader :gateway_configuration
|
19
|
+
attr_reader :gateway_configuration_id
|
20
|
+
attr_reader :amount
|
21
|
+
attr_reader :currency
|
22
|
+
attr_reader :is_attempt
|
23
|
+
attr_reader :has_failed
|
24
|
+
attr_reader :is_accountable
|
25
|
+
attr_reader :type
|
26
|
+
attr_reader :gateway_operation_id
|
27
|
+
attr_reader :arn
|
28
|
+
attr_reader :error_code
|
29
|
+
attr_reader :gateway_data
|
30
|
+
attr_reader :payment_data_three_d_s_request
|
31
|
+
attr_reader :payment_data_three_d_s_authentication
|
32
|
+
attr_reader :payment_data_network_authentication
|
33
|
+
attr_reader :metadata
|
34
|
+
attr_reader :gateway_fee
|
35
|
+
attr_reader :created_at
|
36
|
+
|
37
|
+
|
38
|
+
def id=(val)
|
39
|
+
@id = val
|
40
|
+
end
|
41
|
+
|
42
|
+
def transaction=(val)
|
43
|
+
if val.nil?
|
44
|
+
@transaction = val
|
45
|
+
return
|
46
|
+
end
|
47
|
+
|
48
|
+
if val.instance_of? Transaction
|
49
|
+
@transaction = val
|
50
|
+
else
|
51
|
+
obj = Transaction.new(@client)
|
52
|
+
obj.fill_with_data(val)
|
53
|
+
@transaction = obj
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
def transaction_id=(val)
|
59
|
+
@transaction_id = val
|
60
|
+
end
|
61
|
+
|
62
|
+
def token=(val)
|
63
|
+
if val.nil?
|
64
|
+
@token = val
|
65
|
+
return
|
66
|
+
end
|
67
|
+
|
68
|
+
if val.instance_of? Token
|
69
|
+
@token = val
|
70
|
+
else
|
71
|
+
obj = Token.new(@client)
|
72
|
+
obj.fill_with_data(val)
|
73
|
+
@token = obj
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
def token_id=(val)
|
79
|
+
@token_id = val
|
80
|
+
end
|
81
|
+
|
82
|
+
def card=(val)
|
83
|
+
if val.nil?
|
84
|
+
@card = val
|
85
|
+
return
|
86
|
+
end
|
87
|
+
|
88
|
+
if val.instance_of? Card
|
89
|
+
@card = val
|
90
|
+
else
|
91
|
+
obj = Card.new(@client)
|
92
|
+
obj.fill_with_data(val)
|
93
|
+
@card = obj
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
def card_id=(val)
|
99
|
+
@card_id = val
|
100
|
+
end
|
101
|
+
|
102
|
+
def gateway_configuration=(val)
|
103
|
+
if val.nil?
|
104
|
+
@gateway_configuration = val
|
105
|
+
return
|
106
|
+
end
|
107
|
+
|
108
|
+
if val.instance_of? GatewayConfiguration
|
109
|
+
@gateway_configuration = val
|
110
|
+
else
|
111
|
+
obj = GatewayConfiguration.new(@client)
|
112
|
+
obj.fill_with_data(val)
|
113
|
+
@gateway_configuration = obj
|
114
|
+
end
|
115
|
+
|
116
|
+
end
|
117
|
+
|
118
|
+
def gateway_configuration_id=(val)
|
119
|
+
@gateway_configuration_id = val
|
120
|
+
end
|
121
|
+
|
122
|
+
def amount=(val)
|
123
|
+
@amount = val
|
124
|
+
end
|
125
|
+
|
126
|
+
def currency=(val)
|
127
|
+
@currency = val
|
128
|
+
end
|
129
|
+
|
130
|
+
def is_attempt=(val)
|
131
|
+
@is_attempt = val
|
132
|
+
end
|
133
|
+
|
134
|
+
def has_failed=(val)
|
135
|
+
@has_failed = val
|
136
|
+
end
|
137
|
+
|
138
|
+
def is_accountable=(val)
|
139
|
+
@is_accountable = val
|
140
|
+
end
|
141
|
+
|
142
|
+
def type=(val)
|
143
|
+
@type = val
|
144
|
+
end
|
145
|
+
|
146
|
+
def gateway_operation_id=(val)
|
147
|
+
@gateway_operation_id = val
|
148
|
+
end
|
149
|
+
|
150
|
+
def arn=(val)
|
151
|
+
@arn = val
|
152
|
+
end
|
153
|
+
|
154
|
+
def error_code=(val)
|
155
|
+
@error_code = val
|
156
|
+
end
|
157
|
+
|
158
|
+
def gateway_data=(val)
|
159
|
+
@gateway_data = val
|
160
|
+
end
|
161
|
+
|
162
|
+
def payment_data_three_d_s_request=(val)
|
163
|
+
if val.nil?
|
164
|
+
@payment_data_three_d_s_request = val
|
165
|
+
return
|
166
|
+
end
|
167
|
+
|
168
|
+
if val.instance_of? PaymentDataThreeDSRequest
|
169
|
+
@payment_data_three_d_s_request = val
|
170
|
+
else
|
171
|
+
obj = PaymentDataThreeDSRequest.new(@client)
|
172
|
+
obj.fill_with_data(val)
|
173
|
+
@payment_data_three_d_s_request = obj
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
177
|
+
|
178
|
+
def payment_data_three_d_s_authentication=(val)
|
179
|
+
if val.nil?
|
180
|
+
@payment_data_three_d_s_authentication = val
|
181
|
+
return
|
182
|
+
end
|
183
|
+
|
184
|
+
if val.instance_of? PaymentDataThreeDSAuthentication
|
185
|
+
@payment_data_three_d_s_authentication = val
|
186
|
+
else
|
187
|
+
obj = PaymentDataThreeDSAuthentication.new(@client)
|
188
|
+
obj.fill_with_data(val)
|
189
|
+
@payment_data_three_d_s_authentication = obj
|
190
|
+
end
|
191
|
+
|
192
|
+
end
|
193
|
+
|
194
|
+
def payment_data_network_authentication=(val)
|
195
|
+
if val.nil?
|
196
|
+
@payment_data_network_authentication = val
|
197
|
+
return
|
198
|
+
end
|
199
|
+
|
200
|
+
if val.instance_of? PaymentDataNetworkAuthentication
|
201
|
+
@payment_data_network_authentication = val
|
202
|
+
else
|
203
|
+
obj = PaymentDataNetworkAuthentication.new(@client)
|
204
|
+
obj.fill_with_data(val)
|
205
|
+
@payment_data_network_authentication = obj
|
206
|
+
end
|
207
|
+
|
208
|
+
end
|
209
|
+
|
210
|
+
def metadata=(val)
|
211
|
+
@metadata = val
|
212
|
+
end
|
213
|
+
|
214
|
+
def gateway_fee=(val)
|
215
|
+
@gateway_fee = val
|
216
|
+
end
|
217
|
+
|
218
|
+
def created_at=(val)
|
219
|
+
@created_at = val
|
220
|
+
end
|
221
|
+
|
222
|
+
|
223
|
+
# Initializes the TransactionOperation object
|
224
|
+
# Params:
|
225
|
+
# +client+:: +ProcessOut+ client instance
|
226
|
+
# +data+:: data that can be used to fill the object
|
227
|
+
def initialize(client, data = {})
|
228
|
+
@client = client
|
229
|
+
|
230
|
+
self.id = data.fetch(:id, nil)
|
231
|
+
self.transaction = data.fetch(:transaction, nil)
|
232
|
+
self.transaction_id = data.fetch(:transaction_id, nil)
|
233
|
+
self.token = data.fetch(:token, nil)
|
234
|
+
self.token_id = data.fetch(:token_id, nil)
|
235
|
+
self.card = data.fetch(:card, nil)
|
236
|
+
self.card_id = data.fetch(:card_id, nil)
|
237
|
+
self.gateway_configuration = data.fetch(:gateway_configuration, nil)
|
238
|
+
self.gateway_configuration_id = data.fetch(:gateway_configuration_id, nil)
|
239
|
+
self.amount = data.fetch(:amount, nil)
|
240
|
+
self.currency = data.fetch(:currency, nil)
|
241
|
+
self.is_attempt = data.fetch(:is_attempt, nil)
|
242
|
+
self.has_failed = data.fetch(:has_failed, nil)
|
243
|
+
self.is_accountable = data.fetch(:is_accountable, nil)
|
244
|
+
self.type = data.fetch(:type, nil)
|
245
|
+
self.gateway_operation_id = data.fetch(:gateway_operation_id, nil)
|
246
|
+
self.arn = data.fetch(:arn, nil)
|
247
|
+
self.error_code = data.fetch(:error_code, nil)
|
248
|
+
self.gateway_data = data.fetch(:gateway_data, nil)
|
249
|
+
self.payment_data_three_d_s_request = data.fetch(:payment_data_three_d_s_request, nil)
|
250
|
+
self.payment_data_three_d_s_authentication = data.fetch(:payment_data_three_d_s_authentication, nil)
|
251
|
+
self.payment_data_network_authentication = data.fetch(:payment_data_network_authentication, nil)
|
252
|
+
self.metadata = data.fetch(:metadata, nil)
|
253
|
+
self.gateway_fee = data.fetch(:gateway_fee, nil)
|
254
|
+
self.created_at = data.fetch(:created_at, nil)
|
255
|
+
|
256
|
+
end
|
257
|
+
|
258
|
+
# Create a new TransactionOperation using the current client
|
259
|
+
def new(data = {})
|
260
|
+
TransactionOperation.new(@client, data)
|
261
|
+
end
|
262
|
+
|
263
|
+
# Overrides the JSON marshaller to only send the fields we want
|
264
|
+
def to_json(options)
|
265
|
+
{
|
266
|
+
"id": self.id,
|
267
|
+
"transaction": self.transaction,
|
268
|
+
"transaction_id": self.transaction_id,
|
269
|
+
"token": self.token,
|
270
|
+
"token_id": self.token_id,
|
271
|
+
"card": self.card,
|
272
|
+
"card_id": self.card_id,
|
273
|
+
"gateway_configuration": self.gateway_configuration,
|
274
|
+
"gateway_configuration_id": self.gateway_configuration_id,
|
275
|
+
"amount": self.amount,
|
276
|
+
"currency": self.currency,
|
277
|
+
"is_attempt": self.is_attempt,
|
278
|
+
"has_failed": self.has_failed,
|
279
|
+
"is_accountable": self.is_accountable,
|
280
|
+
"type": self.type,
|
281
|
+
"gateway_operation_id": self.gateway_operation_id,
|
282
|
+
"arn": self.arn,
|
283
|
+
"error_code": self.error_code,
|
284
|
+
"gateway_data": self.gateway_data,
|
285
|
+
"payment_data_three_d_s_request": self.payment_data_three_d_s_request,
|
286
|
+
"payment_data_three_d_s_authentication": self.payment_data_three_d_s_authentication,
|
287
|
+
"payment_data_network_authentication": self.payment_data_network_authentication,
|
288
|
+
"metadata": self.metadata,
|
289
|
+
"gateway_fee": self.gateway_fee,
|
290
|
+
"created_at": self.created_at,
|
291
|
+
}.to_json
|
292
|
+
end
|
293
|
+
|
294
|
+
# Fills the object with data coming from the API
|
295
|
+
# Params:
|
296
|
+
# +data+:: +Hash+ of data coming from the API
|
297
|
+
def fill_with_data(data)
|
298
|
+
if data.nil?
|
299
|
+
return self
|
300
|
+
end
|
301
|
+
if data.include? "id"
|
302
|
+
self.id = data["id"]
|
303
|
+
end
|
304
|
+
if data.include? "transaction"
|
305
|
+
self.transaction = data["transaction"]
|
306
|
+
end
|
307
|
+
if data.include? "transaction_id"
|
308
|
+
self.transaction_id = data["transaction_id"]
|
309
|
+
end
|
310
|
+
if data.include? "token"
|
311
|
+
self.token = data["token"]
|
312
|
+
end
|
313
|
+
if data.include? "token_id"
|
314
|
+
self.token_id = data["token_id"]
|
315
|
+
end
|
316
|
+
if data.include? "card"
|
317
|
+
self.card = data["card"]
|
318
|
+
end
|
319
|
+
if data.include? "card_id"
|
320
|
+
self.card_id = data["card_id"]
|
321
|
+
end
|
322
|
+
if data.include? "gateway_configuration"
|
323
|
+
self.gateway_configuration = data["gateway_configuration"]
|
324
|
+
end
|
325
|
+
if data.include? "gateway_configuration_id"
|
326
|
+
self.gateway_configuration_id = data["gateway_configuration_id"]
|
327
|
+
end
|
328
|
+
if data.include? "amount"
|
329
|
+
self.amount = data["amount"]
|
330
|
+
end
|
331
|
+
if data.include? "currency"
|
332
|
+
self.currency = data["currency"]
|
333
|
+
end
|
334
|
+
if data.include? "is_attempt"
|
335
|
+
self.is_attempt = data["is_attempt"]
|
336
|
+
end
|
337
|
+
if data.include? "has_failed"
|
338
|
+
self.has_failed = data["has_failed"]
|
339
|
+
end
|
340
|
+
if data.include? "is_accountable"
|
341
|
+
self.is_accountable = data["is_accountable"]
|
342
|
+
end
|
343
|
+
if data.include? "type"
|
344
|
+
self.type = data["type"]
|
345
|
+
end
|
346
|
+
if data.include? "gateway_operation_id"
|
347
|
+
self.gateway_operation_id = data["gateway_operation_id"]
|
348
|
+
end
|
349
|
+
if data.include? "arn"
|
350
|
+
self.arn = data["arn"]
|
351
|
+
end
|
352
|
+
if data.include? "error_code"
|
353
|
+
self.error_code = data["error_code"]
|
354
|
+
end
|
355
|
+
if data.include? "gateway_data"
|
356
|
+
self.gateway_data = data["gateway_data"]
|
357
|
+
end
|
358
|
+
if data.include? "payment_data_three_d_s_request"
|
359
|
+
self.payment_data_three_d_s_request = data["payment_data_three_d_s_request"]
|
360
|
+
end
|
361
|
+
if data.include? "payment_data_three_d_s_authentication"
|
362
|
+
self.payment_data_three_d_s_authentication = data["payment_data_three_d_s_authentication"]
|
363
|
+
end
|
364
|
+
if data.include? "payment_data_network_authentication"
|
365
|
+
self.payment_data_network_authentication = data["payment_data_network_authentication"]
|
366
|
+
end
|
367
|
+
if data.include? "metadata"
|
368
|
+
self.metadata = data["metadata"]
|
369
|
+
end
|
370
|
+
if data.include? "gateway_fee"
|
371
|
+
self.gateway_fee = data["gateway_fee"]
|
372
|
+
end
|
373
|
+
if data.include? "created_at"
|
374
|
+
self.created_at = data["created_at"]
|
375
|
+
end
|
376
|
+
|
377
|
+
self
|
378
|
+
end
|
379
|
+
|
380
|
+
# Prefills the object with the data passed as parameters
|
381
|
+
# Params:
|
382
|
+
# +data+:: +Hash+ of data
|
383
|
+
def prefill(data)
|
384
|
+
if data.nil?
|
385
|
+
return self
|
386
|
+
end
|
387
|
+
self.id = data.fetch(:id, self.id)
|
388
|
+
self.transaction = data.fetch(:transaction, self.transaction)
|
389
|
+
self.transaction_id = data.fetch(:transaction_id, self.transaction_id)
|
390
|
+
self.token = data.fetch(:token, self.token)
|
391
|
+
self.token_id = data.fetch(:token_id, self.token_id)
|
392
|
+
self.card = data.fetch(:card, self.card)
|
393
|
+
self.card_id = data.fetch(:card_id, self.card_id)
|
394
|
+
self.gateway_configuration = data.fetch(:gateway_configuration, self.gateway_configuration)
|
395
|
+
self.gateway_configuration_id = data.fetch(:gateway_configuration_id, self.gateway_configuration_id)
|
396
|
+
self.amount = data.fetch(:amount, self.amount)
|
397
|
+
self.currency = data.fetch(:currency, self.currency)
|
398
|
+
self.is_attempt = data.fetch(:is_attempt, self.is_attempt)
|
399
|
+
self.has_failed = data.fetch(:has_failed, self.has_failed)
|
400
|
+
self.is_accountable = data.fetch(:is_accountable, self.is_accountable)
|
401
|
+
self.type = data.fetch(:type, self.type)
|
402
|
+
self.gateway_operation_id = data.fetch(:gateway_operation_id, self.gateway_operation_id)
|
403
|
+
self.arn = data.fetch(:arn, self.arn)
|
404
|
+
self.error_code = data.fetch(:error_code, self.error_code)
|
405
|
+
self.gateway_data = data.fetch(:gateway_data, self.gateway_data)
|
406
|
+
self.payment_data_three_d_s_request = data.fetch(:payment_data_three_d_s_request, self.payment_data_three_d_s_request)
|
407
|
+
self.payment_data_three_d_s_authentication = data.fetch(:payment_data_three_d_s_authentication, self.payment_data_three_d_s_authentication)
|
408
|
+
self.payment_data_network_authentication = data.fetch(:payment_data_network_authentication, self.payment_data_network_authentication)
|
409
|
+
self.metadata = data.fetch(:metadata, self.metadata)
|
410
|
+
self.gateway_fee = data.fetch(:gateway_fee, self.gateway_fee)
|
411
|
+
self.created_at = data.fetch(:created_at, self.created_at)
|
412
|
+
|
413
|
+
self
|
414
|
+
end
|
415
|
+
|
416
|
+
|
417
|
+
end
|
418
|
+
end
|
@@ -0,0 +1,237 @@
|
|
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 Webhook
|
10
|
+
|
11
|
+
attr_reader :id
|
12
|
+
attr_reader :project
|
13
|
+
attr_reader :project_id
|
14
|
+
attr_reader :event
|
15
|
+
attr_reader :event_id
|
16
|
+
attr_reader :request_url
|
17
|
+
attr_reader :request_method
|
18
|
+
attr_reader :response_body
|
19
|
+
attr_reader :response_code
|
20
|
+
attr_reader :response_headers
|
21
|
+
attr_reader :response_time_ms
|
22
|
+
attr_reader :status
|
23
|
+
attr_reader :created_at
|
24
|
+
attr_reader :release_at
|
25
|
+
|
26
|
+
|
27
|
+
def id=(val)
|
28
|
+
@id = val
|
29
|
+
end
|
30
|
+
|
31
|
+
def project=(val)
|
32
|
+
if val.nil?
|
33
|
+
@project = val
|
34
|
+
return
|
35
|
+
end
|
36
|
+
|
37
|
+
if val.instance_of? Project
|
38
|
+
@project = val
|
39
|
+
else
|
40
|
+
obj = Project.new(@client)
|
41
|
+
obj.fill_with_data(val)
|
42
|
+
@project = obj
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
def project_id=(val)
|
48
|
+
@project_id = val
|
49
|
+
end
|
50
|
+
|
51
|
+
def event=(val)
|
52
|
+
if val.nil?
|
53
|
+
@event = val
|
54
|
+
return
|
55
|
+
end
|
56
|
+
|
57
|
+
if val.instance_of? Event
|
58
|
+
@event = val
|
59
|
+
else
|
60
|
+
obj = Event.new(@client)
|
61
|
+
obj.fill_with_data(val)
|
62
|
+
@event = obj
|
63
|
+
end
|
64
|
+
|
65
|
+
end
|
66
|
+
|
67
|
+
def event_id=(val)
|
68
|
+
@event_id = val
|
69
|
+
end
|
70
|
+
|
71
|
+
def request_url=(val)
|
72
|
+
@request_url = val
|
73
|
+
end
|
74
|
+
|
75
|
+
def request_method=(val)
|
76
|
+
@request_method = val
|
77
|
+
end
|
78
|
+
|
79
|
+
def response_body=(val)
|
80
|
+
@response_body = val
|
81
|
+
end
|
82
|
+
|
83
|
+
def response_code=(val)
|
84
|
+
@response_code = val
|
85
|
+
end
|
86
|
+
|
87
|
+
def response_headers=(val)
|
88
|
+
@response_headers = val
|
89
|
+
end
|
90
|
+
|
91
|
+
def response_time_ms=(val)
|
92
|
+
@response_time_ms = val
|
93
|
+
end
|
94
|
+
|
95
|
+
def status=(val)
|
96
|
+
@status = val
|
97
|
+
end
|
98
|
+
|
99
|
+
def created_at=(val)
|
100
|
+
@created_at = val
|
101
|
+
end
|
102
|
+
|
103
|
+
def release_at=(val)
|
104
|
+
@release_at = val
|
105
|
+
end
|
106
|
+
|
107
|
+
|
108
|
+
# Initializes the Webhook object
|
109
|
+
# Params:
|
110
|
+
# +client+:: +ProcessOut+ client instance
|
111
|
+
# +data+:: data that can be used to fill the object
|
112
|
+
def initialize(client, data = {})
|
113
|
+
@client = client
|
114
|
+
|
115
|
+
self.id = data.fetch(:id, nil)
|
116
|
+
self.project = data.fetch(:project, nil)
|
117
|
+
self.project_id = data.fetch(:project_id, nil)
|
118
|
+
self.event = data.fetch(:event, nil)
|
119
|
+
self.event_id = data.fetch(:event_id, nil)
|
120
|
+
self.request_url = data.fetch(:request_url, nil)
|
121
|
+
self.request_method = data.fetch(:request_method, nil)
|
122
|
+
self.response_body = data.fetch(:response_body, nil)
|
123
|
+
self.response_code = data.fetch(:response_code, nil)
|
124
|
+
self.response_headers = data.fetch(:response_headers, nil)
|
125
|
+
self.response_time_ms = data.fetch(:response_time_ms, nil)
|
126
|
+
self.status = data.fetch(:status, nil)
|
127
|
+
self.created_at = data.fetch(:created_at, nil)
|
128
|
+
self.release_at = data.fetch(:release_at, nil)
|
129
|
+
|
130
|
+
end
|
131
|
+
|
132
|
+
# Create a new Webhook using the current client
|
133
|
+
def new(data = {})
|
134
|
+
Webhook.new(@client, data)
|
135
|
+
end
|
136
|
+
|
137
|
+
# Overrides the JSON marshaller to only send the fields we want
|
138
|
+
def to_json(options)
|
139
|
+
{
|
140
|
+
"id": self.id,
|
141
|
+
"project": self.project,
|
142
|
+
"project_id": self.project_id,
|
143
|
+
"event": self.event,
|
144
|
+
"event_id": self.event_id,
|
145
|
+
"request_url": self.request_url,
|
146
|
+
"request_method": self.request_method,
|
147
|
+
"response_body": self.response_body,
|
148
|
+
"response_code": self.response_code,
|
149
|
+
"response_headers": self.response_headers,
|
150
|
+
"response_time_ms": self.response_time_ms,
|
151
|
+
"status": self.status,
|
152
|
+
"created_at": self.created_at,
|
153
|
+
"release_at": self.release_at,
|
154
|
+
}.to_json
|
155
|
+
end
|
156
|
+
|
157
|
+
# Fills the object with data coming from the API
|
158
|
+
# Params:
|
159
|
+
# +data+:: +Hash+ of data coming from the API
|
160
|
+
def fill_with_data(data)
|
161
|
+
if data.nil?
|
162
|
+
return self
|
163
|
+
end
|
164
|
+
if data.include? "id"
|
165
|
+
self.id = data["id"]
|
166
|
+
end
|
167
|
+
if data.include? "project"
|
168
|
+
self.project = data["project"]
|
169
|
+
end
|
170
|
+
if data.include? "project_id"
|
171
|
+
self.project_id = data["project_id"]
|
172
|
+
end
|
173
|
+
if data.include? "event"
|
174
|
+
self.event = data["event"]
|
175
|
+
end
|
176
|
+
if data.include? "event_id"
|
177
|
+
self.event_id = data["event_id"]
|
178
|
+
end
|
179
|
+
if data.include? "request_url"
|
180
|
+
self.request_url = data["request_url"]
|
181
|
+
end
|
182
|
+
if data.include? "request_method"
|
183
|
+
self.request_method = data["request_method"]
|
184
|
+
end
|
185
|
+
if data.include? "response_body"
|
186
|
+
self.response_body = data["response_body"]
|
187
|
+
end
|
188
|
+
if data.include? "response_code"
|
189
|
+
self.response_code = data["response_code"]
|
190
|
+
end
|
191
|
+
if data.include? "response_headers"
|
192
|
+
self.response_headers = data["response_headers"]
|
193
|
+
end
|
194
|
+
if data.include? "response_time_ms"
|
195
|
+
self.response_time_ms = data["response_time_ms"]
|
196
|
+
end
|
197
|
+
if data.include? "status"
|
198
|
+
self.status = data["status"]
|
199
|
+
end
|
200
|
+
if data.include? "created_at"
|
201
|
+
self.created_at = data["created_at"]
|
202
|
+
end
|
203
|
+
if data.include? "release_at"
|
204
|
+
self.release_at = data["release_at"]
|
205
|
+
end
|
206
|
+
|
207
|
+
self
|
208
|
+
end
|
209
|
+
|
210
|
+
# Prefills the object with the data passed as parameters
|
211
|
+
# Params:
|
212
|
+
# +data+:: +Hash+ of data
|
213
|
+
def prefill(data)
|
214
|
+
if data.nil?
|
215
|
+
return self
|
216
|
+
end
|
217
|
+
self.id = data.fetch(:id, self.id)
|
218
|
+
self.project = data.fetch(:project, self.project)
|
219
|
+
self.project_id = data.fetch(:project_id, self.project_id)
|
220
|
+
self.event = data.fetch(:event, self.event)
|
221
|
+
self.event_id = data.fetch(:event_id, self.event_id)
|
222
|
+
self.request_url = data.fetch(:request_url, self.request_url)
|
223
|
+
self.request_method = data.fetch(:request_method, self.request_method)
|
224
|
+
self.response_body = data.fetch(:response_body, self.response_body)
|
225
|
+
self.response_code = data.fetch(:response_code, self.response_code)
|
226
|
+
self.response_headers = data.fetch(:response_headers, self.response_headers)
|
227
|
+
self.response_time_ms = data.fetch(:response_time_ms, self.response_time_ms)
|
228
|
+
self.status = data.fetch(:status, self.status)
|
229
|
+
self.created_at = data.fetch(:created_at, self.created_at)
|
230
|
+
self.release_at = data.fetch(:release_at, self.release_at)
|
231
|
+
|
232
|
+
self
|
233
|
+
end
|
234
|
+
|
235
|
+
|
236
|
+
end
|
237
|
+
end
|