processout 2.26.0 → 2.28.0
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 +4 -4
- data/.gitignore +3 -1
- data/lib/processout/invoice.rb +25 -1
- data/lib/processout/invoice_risk.rb +11 -0
- data/lib/processout/networking/request.rb +1 -1
- data/lib/processout/payout.rb +22 -0
- data/lib/processout/transaction.rb +44 -0
- data/lib/processout/version.rb +1 -1
- data/lib/processout.rb +0 -6
- metadata +2 -3
- data/lib/processout/api_request.rb +0 -295
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c7f68dd1c2ad91a3abcc9c4ebad513d00d8022c78e861173c0b215dcad99f2c
|
4
|
+
data.tar.gz: d6bcdb8de73326652f745663fffd0069bfda7276eadd914512bbbcbaf4d08d3b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5f99c4c073dc9b293160993deae41cf14cc4a6c9312f8fd4aacd503c6bf3bb3d24fd83208736f2bb1cbf8b0eeba1bd8b60bf3132993508bdb1322c20ced8839
|
7
|
+
data.tar.gz: c9ca949e957f07e84c76ff47e8a6e151cefbf66464a39ee5f8bd16474334bbbd837119609293a523b3307c7048214f0d4764a6dc63be3069ac1772271df70a4f
|
data/.gitignore
CHANGED
data/lib/processout/invoice.rb
CHANGED
@@ -22,6 +22,7 @@ module ProcessOut
|
|
22
22
|
attr_reader :details
|
23
23
|
attr_reader :url
|
24
24
|
attr_reader :name
|
25
|
+
attr_reader :order_id
|
25
26
|
attr_reader :amount
|
26
27
|
attr_reader :currency
|
27
28
|
attr_reader :merchant_initiator_type
|
@@ -53,6 +54,7 @@ module ProcessOut
|
|
53
54
|
attr_reader :payment_intent
|
54
55
|
attr_reader :billing
|
55
56
|
attr_reader :unsupported_feature_bypass
|
57
|
+
attr_reader :verification
|
56
58
|
|
57
59
|
|
58
60
|
def id=(val)
|
@@ -187,6 +189,10 @@ module ProcessOut
|
|
187
189
|
@name = val
|
188
190
|
end
|
189
191
|
|
192
|
+
def order_id=(val)
|
193
|
+
@order_id = val
|
194
|
+
end
|
195
|
+
|
190
196
|
def amount=(val)
|
191
197
|
@amount = val
|
192
198
|
end
|
@@ -407,6 +413,10 @@ module ProcessOut
|
|
407
413
|
|
408
414
|
end
|
409
415
|
|
416
|
+
def verification=(val)
|
417
|
+
@verification = val
|
418
|
+
end
|
419
|
+
|
410
420
|
|
411
421
|
# Initializes the Invoice object
|
412
422
|
# Params:
|
@@ -429,6 +439,7 @@ module ProcessOut
|
|
429
439
|
self.details = data.fetch(:details, nil)
|
430
440
|
self.url = data.fetch(:url, nil)
|
431
441
|
self.name = data.fetch(:name, nil)
|
442
|
+
self.order_id = data.fetch(:order_id, nil)
|
432
443
|
self.amount = data.fetch(:amount, nil)
|
433
444
|
self.currency = data.fetch(:currency, nil)
|
434
445
|
self.merchant_initiator_type = data.fetch(:merchant_initiator_type, nil)
|
@@ -460,6 +471,7 @@ module ProcessOut
|
|
460
471
|
self.payment_intent = data.fetch(:payment_intent, nil)
|
461
472
|
self.billing = data.fetch(:billing, nil)
|
462
473
|
self.unsupported_feature_bypass = data.fetch(:unsupported_feature_bypass, nil)
|
474
|
+
self.verification = data.fetch(:verification, nil)
|
463
475
|
|
464
476
|
end
|
465
477
|
|
@@ -485,6 +497,7 @@ module ProcessOut
|
|
485
497
|
"details": self.details,
|
486
498
|
"url": self.url,
|
487
499
|
"name": self.name,
|
500
|
+
"order_id": self.order_id,
|
488
501
|
"amount": self.amount,
|
489
502
|
"currency": self.currency,
|
490
503
|
"merchant_initiator_type": self.merchant_initiator_type,
|
@@ -516,6 +529,7 @@ module ProcessOut
|
|
516
529
|
"payment_intent": self.payment_intent,
|
517
530
|
"billing": self.billing,
|
518
531
|
"unsupported_feature_bypass": self.unsupported_feature_bypass,
|
532
|
+
"verification": self.verification,
|
519
533
|
}.to_json
|
520
534
|
end
|
521
535
|
|
@@ -568,6 +582,9 @@ module ProcessOut
|
|
568
582
|
if data.include? "name"
|
569
583
|
self.name = data["name"]
|
570
584
|
end
|
585
|
+
if data.include? "order_id"
|
586
|
+
self.order_id = data["order_id"]
|
587
|
+
end
|
571
588
|
if data.include? "amount"
|
572
589
|
self.amount = data["amount"]
|
573
590
|
end
|
@@ -661,6 +678,9 @@ module ProcessOut
|
|
661
678
|
if data.include? "unsupported_feature_bypass"
|
662
679
|
self.unsupported_feature_bypass = data["unsupported_feature_bypass"]
|
663
680
|
end
|
681
|
+
if data.include? "verification"
|
682
|
+
self.verification = data["verification"]
|
683
|
+
end
|
664
684
|
|
665
685
|
self
|
666
686
|
end
|
@@ -686,6 +706,7 @@ module ProcessOut
|
|
686
706
|
self.details = data.fetch(:details, self.details)
|
687
707
|
self.url = data.fetch(:url, self.url)
|
688
708
|
self.name = data.fetch(:name, self.name)
|
709
|
+
self.order_id = data.fetch(:order_id, self.order_id)
|
689
710
|
self.amount = data.fetch(:amount, self.amount)
|
690
711
|
self.currency = data.fetch(:currency, self.currency)
|
691
712
|
self.merchant_initiator_type = data.fetch(:merchant_initiator_type, self.merchant_initiator_type)
|
@@ -717,6 +738,7 @@ module ProcessOut
|
|
717
738
|
self.payment_intent = data.fetch(:payment_intent, self.payment_intent)
|
718
739
|
self.billing = data.fetch(:billing, self.billing)
|
719
740
|
self.unsupported_feature_bypass = data.fetch(:unsupported_feature_bypass, self.unsupported_feature_bypass)
|
741
|
+
self.verification = data.fetch(:verification, self.verification)
|
720
742
|
|
721
743
|
self
|
722
744
|
end
|
@@ -1062,6 +1084,7 @@ module ProcessOut
|
|
1062
1084
|
data = {
|
1063
1085
|
"customer_id" => @customer_id,
|
1064
1086
|
"name" => @name,
|
1087
|
+
"order_id" => @order_id,
|
1065
1088
|
"amount" => @amount,
|
1066
1089
|
"currency" => @currency,
|
1067
1090
|
"metadata" => @metadata,
|
@@ -1089,7 +1112,8 @@ module ProcessOut
|
|
1089
1112
|
"tax" => @tax,
|
1090
1113
|
"payment_type" => @payment_type,
|
1091
1114
|
"billing" => @billing,
|
1092
|
-
"unsupported_feature_bypass" => @unsupported_feature_bypass
|
1115
|
+
"unsupported_feature_bypass" => @unsupported_feature_bypass,
|
1116
|
+
"verification" => @verification
|
1093
1117
|
}
|
1094
1118
|
|
1095
1119
|
response = Response.new(request.post(path, data, options))
|
@@ -10,6 +10,7 @@ module ProcessOut
|
|
10
10
|
|
11
11
|
attr_reader :score
|
12
12
|
attr_reader :is_legit
|
13
|
+
attr_reader :skip_gateway_rules
|
13
14
|
|
14
15
|
|
15
16
|
def score=(val)
|
@@ -20,6 +21,10 @@ module ProcessOut
|
|
20
21
|
@is_legit = val
|
21
22
|
end
|
22
23
|
|
24
|
+
def skip_gateway_rules=(val)
|
25
|
+
@skip_gateway_rules = val
|
26
|
+
end
|
27
|
+
|
23
28
|
|
24
29
|
# Initializes the InvoiceRisk object
|
25
30
|
# Params:
|
@@ -30,6 +35,7 @@ module ProcessOut
|
|
30
35
|
|
31
36
|
self.score = data.fetch(:score, nil)
|
32
37
|
self.is_legit = data.fetch(:is_legit, nil)
|
38
|
+
self.skip_gateway_rules = data.fetch(:skip_gateway_rules, nil)
|
33
39
|
|
34
40
|
end
|
35
41
|
|
@@ -43,6 +49,7 @@ module ProcessOut
|
|
43
49
|
{
|
44
50
|
"score": self.score,
|
45
51
|
"is_legit": self.is_legit,
|
52
|
+
"skip_gateway_rules": self.skip_gateway_rules,
|
46
53
|
}.to_json
|
47
54
|
end
|
48
55
|
|
@@ -59,6 +66,9 @@ module ProcessOut
|
|
59
66
|
if data.include? "is_legit"
|
60
67
|
self.is_legit = data["is_legit"]
|
61
68
|
end
|
69
|
+
if data.include? "skip_gateway_rules"
|
70
|
+
self.skip_gateway_rules = data["skip_gateway_rules"]
|
71
|
+
end
|
62
72
|
|
63
73
|
self
|
64
74
|
end
|
@@ -72,6 +82,7 @@ module ProcessOut
|
|
72
82
|
end
|
73
83
|
self.score = data.fetch(:score, self.score)
|
74
84
|
self.is_legit = data.fetch(:is_legit, self.is_legit)
|
85
|
+
self.skip_gateway_rules = data.fetch(:skip_gateway_rules, self.skip_gateway_rules)
|
75
86
|
|
76
87
|
self
|
77
88
|
end
|
@@ -13,7 +13,7 @@ module ProcessOut
|
|
13
13
|
req.basic_auth @client.project_id, @client.project_secret
|
14
14
|
req.content_type = "application/json"
|
15
15
|
req["API-Version"] = "1.4.0.0"
|
16
|
-
req["User-Agent"] = "ProcessOut Ruby-Bindings/2.
|
16
|
+
req["User-Agent"] = "ProcessOut Ruby-Bindings/2.28.0"
|
17
17
|
|
18
18
|
unless options.nil?
|
19
19
|
req["Idempotency-Key"] = options.fetch(:idempotency_key, "")
|
data/lib/processout/payout.rb
CHANGED
@@ -371,6 +371,28 @@ module ProcessOut
|
|
371
371
|
|
372
372
|
|
373
373
|
|
374
|
+
return_values[0]
|
375
|
+
end
|
376
|
+
|
377
|
+
# Delete the payout along with its payout items
|
378
|
+
# Params:
|
379
|
+
# +payout_id+:: ID of the payout
|
380
|
+
# +options+:: +Hash+ of options
|
381
|
+
def delete(payout_id, options = {})
|
382
|
+
self.prefill(options)
|
383
|
+
|
384
|
+
request = Request.new(@client)
|
385
|
+
path = "/payouts/" + CGI.escape(payout_id) + ""
|
386
|
+
data = {
|
387
|
+
|
388
|
+
}
|
389
|
+
|
390
|
+
response = Response.new(request.delete(path, data, options))
|
391
|
+
return_values = Array.new
|
392
|
+
|
393
|
+
return_values.push(response.success)
|
394
|
+
|
395
|
+
|
374
396
|
return_values[0]
|
375
397
|
end
|
376
398
|
|
@@ -63,12 +63,16 @@ module ProcessOut
|
|
63
63
|
attr_reader :created_at
|
64
64
|
attr_reader :chargedback_at
|
65
65
|
attr_reader :refunded_at
|
66
|
+
attr_reader :authorized_at
|
67
|
+
attr_reader :captured_at
|
68
|
+
attr_reader :voided_at
|
66
69
|
attr_reader :three_d_s
|
67
70
|
attr_reader :cvc_check
|
68
71
|
attr_reader :avs_check
|
69
72
|
attr_reader :initial_scheme_transaction_id
|
70
73
|
attr_reader :scheme_id
|
71
74
|
attr_reader :payment_type
|
75
|
+
attr_reader :eci
|
72
76
|
attr_reader :native_apm
|
73
77
|
attr_reader :external_details
|
74
78
|
|
@@ -421,6 +425,18 @@ module ProcessOut
|
|
421
425
|
@refunded_at = val
|
422
426
|
end
|
423
427
|
|
428
|
+
def authorized_at=(val)
|
429
|
+
@authorized_at = val
|
430
|
+
end
|
431
|
+
|
432
|
+
def captured_at=(val)
|
433
|
+
@captured_at = val
|
434
|
+
end
|
435
|
+
|
436
|
+
def voided_at=(val)
|
437
|
+
@voided_at = val
|
438
|
+
end
|
439
|
+
|
424
440
|
def three_d_s=(val)
|
425
441
|
if val.nil?
|
426
442
|
@three_d_s = val
|
@@ -457,6 +473,10 @@ module ProcessOut
|
|
457
473
|
@payment_type = val
|
458
474
|
end
|
459
475
|
|
476
|
+
def eci=(val)
|
477
|
+
@eci = val
|
478
|
+
end
|
479
|
+
|
460
480
|
def native_apm=(val)
|
461
481
|
if val.nil?
|
462
482
|
@native_apm = val
|
@@ -541,12 +561,16 @@ module ProcessOut
|
|
541
561
|
self.created_at = data.fetch(:created_at, nil)
|
542
562
|
self.chargedback_at = data.fetch(:chargedback_at, nil)
|
543
563
|
self.refunded_at = data.fetch(:refunded_at, nil)
|
564
|
+
self.authorized_at = data.fetch(:authorized_at, nil)
|
565
|
+
self.captured_at = data.fetch(:captured_at, nil)
|
566
|
+
self.voided_at = data.fetch(:voided_at, nil)
|
544
567
|
self.three_d_s = data.fetch(:three_d_s, nil)
|
545
568
|
self.cvc_check = data.fetch(:cvc_check, nil)
|
546
569
|
self.avs_check = data.fetch(:avs_check, nil)
|
547
570
|
self.initial_scheme_transaction_id = data.fetch(:initial_scheme_transaction_id, nil)
|
548
571
|
self.scheme_id = data.fetch(:scheme_id, nil)
|
549
572
|
self.payment_type = data.fetch(:payment_type, nil)
|
573
|
+
self.eci = data.fetch(:eci, nil)
|
550
574
|
self.native_apm = data.fetch(:native_apm, nil)
|
551
575
|
self.external_details = data.fetch(:external_details, nil)
|
552
576
|
|
@@ -615,12 +639,16 @@ module ProcessOut
|
|
615
639
|
"created_at": self.created_at,
|
616
640
|
"chargedback_at": self.chargedback_at,
|
617
641
|
"refunded_at": self.refunded_at,
|
642
|
+
"authorized_at": self.authorized_at,
|
643
|
+
"captured_at": self.captured_at,
|
644
|
+
"voided_at": self.voided_at,
|
618
645
|
"three_d_s": self.three_d_s,
|
619
646
|
"cvc_check": self.cvc_check,
|
620
647
|
"avs_check": self.avs_check,
|
621
648
|
"initial_scheme_transaction_id": self.initial_scheme_transaction_id,
|
622
649
|
"scheme_id": self.scheme_id,
|
623
650
|
"payment_type": self.payment_type,
|
651
|
+
"eci": self.eci,
|
624
652
|
"native_apm": self.native_apm,
|
625
653
|
"external_details": self.external_details,
|
626
654
|
}.to_json
|
@@ -798,6 +826,15 @@ module ProcessOut
|
|
798
826
|
if data.include? "refunded_at"
|
799
827
|
self.refunded_at = data["refunded_at"]
|
800
828
|
end
|
829
|
+
if data.include? "authorized_at"
|
830
|
+
self.authorized_at = data["authorized_at"]
|
831
|
+
end
|
832
|
+
if data.include? "captured_at"
|
833
|
+
self.captured_at = data["captured_at"]
|
834
|
+
end
|
835
|
+
if data.include? "voided_at"
|
836
|
+
self.voided_at = data["voided_at"]
|
837
|
+
end
|
801
838
|
if data.include? "three_d_s"
|
802
839
|
self.three_d_s = data["three_d_s"]
|
803
840
|
end
|
@@ -816,6 +853,9 @@ module ProcessOut
|
|
816
853
|
if data.include? "payment_type"
|
817
854
|
self.payment_type = data["payment_type"]
|
818
855
|
end
|
856
|
+
if data.include? "eci"
|
857
|
+
self.eci = data["eci"]
|
858
|
+
end
|
819
859
|
if data.include? "native_apm"
|
820
860
|
self.native_apm = data["native_apm"]
|
821
861
|
end
|
@@ -888,12 +928,16 @@ module ProcessOut
|
|
888
928
|
self.created_at = data.fetch(:created_at, self.created_at)
|
889
929
|
self.chargedback_at = data.fetch(:chargedback_at, self.chargedback_at)
|
890
930
|
self.refunded_at = data.fetch(:refunded_at, self.refunded_at)
|
931
|
+
self.authorized_at = data.fetch(:authorized_at, self.authorized_at)
|
932
|
+
self.captured_at = data.fetch(:captured_at, self.captured_at)
|
933
|
+
self.voided_at = data.fetch(:voided_at, self.voided_at)
|
891
934
|
self.three_d_s = data.fetch(:three_d_s, self.three_d_s)
|
892
935
|
self.cvc_check = data.fetch(:cvc_check, self.cvc_check)
|
893
936
|
self.avs_check = data.fetch(:avs_check, self.avs_check)
|
894
937
|
self.initial_scheme_transaction_id = data.fetch(:initial_scheme_transaction_id, self.initial_scheme_transaction_id)
|
895
938
|
self.scheme_id = data.fetch(:scheme_id, self.scheme_id)
|
896
939
|
self.payment_type = data.fetch(:payment_type, self.payment_type)
|
940
|
+
self.eci = data.fetch(:eci, self.eci)
|
897
941
|
self.native_apm = data.fetch(:native_apm, self.native_apm)
|
898
942
|
self.external_details = data.fetch(:external_details, self.external_details)
|
899
943
|
|
data/lib/processout/version.rb
CHANGED
data/lib/processout.rb
CHANGED
@@ -2,7 +2,6 @@ require "processout/version"
|
|
2
2
|
require "processout/gateway_request"
|
3
3
|
require "processout/activity"
|
4
4
|
require "processout/addon"
|
5
|
-
require "processout/api_request"
|
6
5
|
require "processout/api_version"
|
7
6
|
require "processout/apple_pay_alternative_merchant_certificates"
|
8
7
|
require "processout/alternative_merchant_certificate"
|
@@ -79,11 +78,6 @@ module ProcessOut
|
|
79
78
|
obj = Addon.new(self, data)
|
80
79
|
end
|
81
80
|
|
82
|
-
# Create a new APIRequest instance
|
83
|
-
def api_request(data = {})
|
84
|
-
obj = APIRequest.new(self, data)
|
85
|
-
end
|
86
|
-
|
87
81
|
# Create a new APIVersion instance
|
88
82
|
def api_version(data = {})
|
89
83
|
obj = APIVersion.new(self, data)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: processout
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.28.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel HUEZ
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -77,7 +77,6 @@ files:
|
|
77
77
|
- lib/processout/activity.rb
|
78
78
|
- lib/processout/addon.rb
|
79
79
|
- lib/processout/alternative_merchant_certificate.rb
|
80
|
-
- lib/processout/api_request.rb
|
81
80
|
- lib/processout/api_version.rb
|
82
81
|
- lib/processout/apple_pay_alternative_merchant_certificates.rb
|
83
82
|
- lib/processout/balance.rb
|
@@ -1,295 +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 APIRequest
|
10
|
-
|
11
|
-
attr_reader :id
|
12
|
-
attr_reader :project
|
13
|
-
attr_reader :api_version
|
14
|
-
attr_reader :idempotency_key
|
15
|
-
attr_reader :url
|
16
|
-
attr_reader :method
|
17
|
-
attr_reader :headers
|
18
|
-
attr_reader :body
|
19
|
-
attr_reader :response_code
|
20
|
-
attr_reader :response_headers
|
21
|
-
attr_reader :response_body
|
22
|
-
attr_reader :response_ms
|
23
|
-
attr_reader :sandbox
|
24
|
-
attr_reader :created_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 api_version=(val)
|
48
|
-
if val.nil?
|
49
|
-
@api_version = val
|
50
|
-
return
|
51
|
-
end
|
52
|
-
|
53
|
-
if val.instance_of? APIVersion
|
54
|
-
@api_version = val
|
55
|
-
else
|
56
|
-
obj = APIVersion.new(@client)
|
57
|
-
obj.fill_with_data(val)
|
58
|
-
@api_version = obj
|
59
|
-
end
|
60
|
-
|
61
|
-
end
|
62
|
-
|
63
|
-
def idempotency_key=(val)
|
64
|
-
@idempotency_key = val
|
65
|
-
end
|
66
|
-
|
67
|
-
def url=(val)
|
68
|
-
@url = val
|
69
|
-
end
|
70
|
-
|
71
|
-
def method=(val)
|
72
|
-
@method = val
|
73
|
-
end
|
74
|
-
|
75
|
-
def headers=(val)
|
76
|
-
@headers = val
|
77
|
-
end
|
78
|
-
|
79
|
-
def body=(val)
|
80
|
-
@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_body=(val)
|
92
|
-
@response_body = val
|
93
|
-
end
|
94
|
-
|
95
|
-
def response_ms=(val)
|
96
|
-
@response_ms = val
|
97
|
-
end
|
98
|
-
|
99
|
-
def sandbox=(val)
|
100
|
-
@sandbox = val
|
101
|
-
end
|
102
|
-
|
103
|
-
def created_at=(val)
|
104
|
-
@created_at = val
|
105
|
-
end
|
106
|
-
|
107
|
-
|
108
|
-
# Initializes the APIRequest 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.api_version = data.fetch(:api_version, nil)
|
118
|
-
self.idempotency_key = data.fetch(:idempotency_key, nil)
|
119
|
-
self.url = data.fetch(:url, nil)
|
120
|
-
self.method = data.fetch(:method, nil)
|
121
|
-
self.headers = data.fetch(:headers, nil)
|
122
|
-
self.body = data.fetch(:body, nil)
|
123
|
-
self.response_code = data.fetch(:response_code, nil)
|
124
|
-
self.response_headers = data.fetch(:response_headers, nil)
|
125
|
-
self.response_body = data.fetch(:response_body, nil)
|
126
|
-
self.response_ms = data.fetch(:response_ms, nil)
|
127
|
-
self.sandbox = data.fetch(:sandbox, nil)
|
128
|
-
self.created_at = data.fetch(:created_at, nil)
|
129
|
-
|
130
|
-
end
|
131
|
-
|
132
|
-
# Create a new APIRequest using the current client
|
133
|
-
def new(data = {})
|
134
|
-
APIRequest.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
|
-
"api_version": self.api_version,
|
143
|
-
"idempotency_key": self.idempotency_key,
|
144
|
-
"url": self.url,
|
145
|
-
"method": self.method,
|
146
|
-
"headers": self.headers,
|
147
|
-
"body": self.body,
|
148
|
-
"response_code": self.response_code,
|
149
|
-
"response_headers": self.response_headers,
|
150
|
-
"response_body": self.response_body,
|
151
|
-
"response_ms": self.response_ms,
|
152
|
-
"sandbox": self.sandbox,
|
153
|
-
"created_at": self.created_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? "api_version"
|
171
|
-
self.api_version = data["api_version"]
|
172
|
-
end
|
173
|
-
if data.include? "idempotency_key"
|
174
|
-
self.idempotency_key = data["idempotency_key"]
|
175
|
-
end
|
176
|
-
if data.include? "url"
|
177
|
-
self.url = data["url"]
|
178
|
-
end
|
179
|
-
if data.include? "method"
|
180
|
-
self.method = data["method"]
|
181
|
-
end
|
182
|
-
if data.include? "headers"
|
183
|
-
self.headers = data["headers"]
|
184
|
-
end
|
185
|
-
if data.include? "body"
|
186
|
-
self.body = data["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_body"
|
195
|
-
self.response_body = data["response_body"]
|
196
|
-
end
|
197
|
-
if data.include? "response_ms"
|
198
|
-
self.response_ms = data["response_ms"]
|
199
|
-
end
|
200
|
-
if data.include? "sandbox"
|
201
|
-
self.sandbox = data["sandbox"]
|
202
|
-
end
|
203
|
-
if data.include? "created_at"
|
204
|
-
self.created_at = data["created_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.api_version = data.fetch(:api_version, self.api_version)
|
220
|
-
self.idempotency_key = data.fetch(:idempotency_key, self.idempotency_key)
|
221
|
-
self.url = data.fetch(:url, self.url)
|
222
|
-
self.method = data.fetch(:method, self.method)
|
223
|
-
self.headers = data.fetch(:headers, self.headers)
|
224
|
-
self.body = data.fetch(:body, self.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_body = data.fetch(:response_body, self.response_body)
|
228
|
-
self.response_ms = data.fetch(:response_ms, self.response_ms)
|
229
|
-
self.sandbox = data.fetch(:sandbox, self.sandbox)
|
230
|
-
self.created_at = data.fetch(:created_at, self.created_at)
|
231
|
-
|
232
|
-
self
|
233
|
-
end
|
234
|
-
|
235
|
-
# Get all the API requests.
|
236
|
-
# Params:
|
237
|
-
# +options+:: +Hash+ of options
|
238
|
-
def all(options = {})
|
239
|
-
self.prefill(options)
|
240
|
-
|
241
|
-
request = Request.new(@client)
|
242
|
-
path = "/api-requests"
|
243
|
-
data = {
|
244
|
-
|
245
|
-
}
|
246
|
-
|
247
|
-
response = Response.new(request.get(path, data, options))
|
248
|
-
return_values = Array.new
|
249
|
-
|
250
|
-
a = Array.new
|
251
|
-
body = response.body
|
252
|
-
for v in body['api_requests']
|
253
|
-
tmp = APIRequest.new(@client)
|
254
|
-
tmp.fill_with_data(v)
|
255
|
-
a.push(tmp)
|
256
|
-
end
|
257
|
-
|
258
|
-
return_values.push(a)
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
return_values[0]
|
263
|
-
end
|
264
|
-
|
265
|
-
# Find an API request by its ID.
|
266
|
-
# Params:
|
267
|
-
# +api_request_id+:: ID of the API request
|
268
|
-
# +options+:: +Hash+ of options
|
269
|
-
def find(api_request_id, options = {})
|
270
|
-
self.prefill(options)
|
271
|
-
|
272
|
-
request = Request.new(@client)
|
273
|
-
path = "/api-requests/{request_id}"
|
274
|
-
data = {
|
275
|
-
|
276
|
-
}
|
277
|
-
|
278
|
-
response = Response.new(request.get(path, data, options))
|
279
|
-
return_values = Array.new
|
280
|
-
|
281
|
-
body = response.body
|
282
|
-
body = body["api_request"]
|
283
|
-
|
284
|
-
|
285
|
-
obj = APIRequest.new(@client)
|
286
|
-
return_values.push(obj.fill_with_data(body))
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
return_values[0]
|
291
|
-
end
|
292
|
-
|
293
|
-
|
294
|
-
end
|
295
|
-
end
|