stripe 6.3.0 → 6.6.0.pre.beta.1

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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -3
  3. data/Makefile +1 -1
  4. data/OPENAPI_VERSION +1 -1
  5. data/VERSION +1 -1
  6. data/lib/stripe/api_operations/create.rb +6 -2
  7. data/lib/stripe/api_operations/delete.rb +12 -7
  8. data/lib/stripe/api_operations/list.rb +6 -9
  9. data/lib/stripe/api_operations/nested_resource.rb +62 -34
  10. data/lib/stripe/api_operations/request.rb +10 -0
  11. data/lib/stripe/api_operations/save.rb +6 -3
  12. data/lib/stripe/api_operations/search.rb +6 -9
  13. data/lib/stripe/api_resource.rb +1 -1
  14. data/lib/stripe/api_version.rb +8 -0
  15. data/lib/stripe/object_types.rb +1 -0
  16. data/lib/stripe/resources/account.rb +28 -8
  17. data/lib/stripe/resources/apps/secret.rb +10 -12
  18. data/lib/stripe/resources/charge.rb +10 -3
  19. data/lib/stripe/resources/checkout/session.rb +10 -3
  20. data/lib/stripe/resources/credit_note.rb +24 -9
  21. data/lib/stripe/resources/customer.rb +67 -27
  22. data/lib/stripe/resources/dispute.rb +10 -3
  23. data/lib/stripe/resources/financial_connections/account.rb +30 -7
  24. data/lib/stripe/resources/identity/verification_session.rb +20 -5
  25. data/lib/stripe/resources/invoice.rb +64 -17
  26. data/lib/stripe/resources/issuing/authorization.rb +20 -5
  27. data/lib/stripe/resources/issuing/card.rb +90 -3
  28. data/lib/stripe/resources/issuing/dispute.rb +10 -3
  29. data/lib/stripe/resources/order.rb +40 -9
  30. data/lib/stripe/resources/payment_intent.rb +60 -13
  31. data/lib/stripe/resources/payment_link.rb +10 -3
  32. data/lib/stripe/resources/payment_method.rb +20 -5
  33. data/lib/stripe/resources/payout.rb +20 -5
  34. data/lib/stripe/resources/quote.rb +50 -11
  35. data/lib/stripe/resources/quote_phase.rb +28 -0
  36. data/lib/stripe/resources/refund.rb +19 -5
  37. data/lib/stripe/resources/review.rb +10 -3
  38. data/lib/stripe/resources/setup_intent.rb +30 -7
  39. data/lib/stripe/resources/source.rb +16 -6
  40. data/lib/stripe/resources/subscription.rb +10 -3
  41. data/lib/stripe/resources/subscription_item.rb +6 -2
  42. data/lib/stripe/resources/subscription_schedule.rb +37 -4
  43. data/lib/stripe/resources/terminal/reader.rb +49 -11
  44. data/lib/stripe/resources/test_helpers/test_clock.rb +10 -3
  45. data/lib/stripe/resources/topup.rb +10 -3
  46. data/lib/stripe/resources/transfer.rb +10 -3
  47. data/lib/stripe/resources/treasury/financial_account.rb +20 -5
  48. data/lib/stripe/resources/treasury/inbound_transfer.rb +39 -9
  49. data/lib/stripe/resources/treasury/outbound_payment.rb +39 -9
  50. data/lib/stripe/resources/treasury/outbound_transfer.rb +43 -9
  51. data/lib/stripe/resources/treasury/received_credit.rb +5 -6
  52. data/lib/stripe/resources/treasury/received_debit.rb +5 -6
  53. data/lib/stripe/resources.rb +1 -0
  54. data/lib/stripe/stripe_configuration.rb +2 -0
  55. data/lib/stripe/util.rb +38 -3
  56. data/lib/stripe/version.rb +1 -1
  57. data/lib/stripe.rb +1 -0
  58. metadata +6 -4
@@ -11,15 +11,10 @@ module Stripe
11
11
 
12
12
  OBJECT_NAME = "terminal.reader"
13
13
 
14
- custom_method :cancel_action, http_verb: :post
15
- custom_method :process_payment_intent, http_verb: :post
16
- custom_method :process_setup_intent, http_verb: :post
17
- custom_method :set_reader_display, http_verb: :post
18
-
19
14
  def cancel_action(params = {}, opts = {})
20
15
  request_stripe_object(
21
16
  method: :post,
22
- path: resource_url + "/cancel_action",
17
+ path: format("/v1/terminal/readers/%<reader>s/cancel_action", { reader: CGI.escape(self["id"]) }),
23
18
  params: params,
24
19
  opts: opts
25
20
  )
@@ -28,7 +23,7 @@ module Stripe
28
23
  def process_payment_intent(params = {}, opts = {})
29
24
  request_stripe_object(
30
25
  method: :post,
31
- path: resource_url + "/process_payment_intent",
26
+ path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(self["id"]) }),
32
27
  params: params,
33
28
  opts: opts
34
29
  )
@@ -37,7 +32,7 @@ module Stripe
37
32
  def process_setup_intent(params = {}, opts = {})
38
33
  request_stripe_object(
39
34
  method: :post,
40
- path: resource_url + "/process_setup_intent",
35
+ path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(self["id"]) }),
41
36
  params: params,
42
37
  opts: opts
43
38
  )
@@ -46,7 +41,43 @@ module Stripe
46
41
  def set_reader_display(params = {}, opts = {})
47
42
  request_stripe_object(
48
43
  method: :post,
49
- path: resource_url + "/set_reader_display",
44
+ path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(self["id"]) }),
45
+ params: params,
46
+ opts: opts
47
+ )
48
+ end
49
+
50
+ def self.cancel_action(reader, params = {}, opts = {})
51
+ request_stripe_object(
52
+ method: :post,
53
+ path: format("/v1/terminal/readers/%<reader>s/cancel_action", { reader: CGI.escape(reader) }),
54
+ params: params,
55
+ opts: opts
56
+ )
57
+ end
58
+
59
+ def self.process_payment_intent(reader, params = {}, opts = {})
60
+ request_stripe_object(
61
+ method: :post,
62
+ path: format("/v1/terminal/readers/%<reader>s/process_payment_intent", { reader: CGI.escape(reader) }),
63
+ params: params,
64
+ opts: opts
65
+ )
66
+ end
67
+
68
+ def self.process_setup_intent(reader, params = {}, opts = {})
69
+ request_stripe_object(
70
+ method: :post,
71
+ path: format("/v1/terminal/readers/%<reader>s/process_setup_intent", { reader: CGI.escape(reader) }),
72
+ params: params,
73
+ opts: opts
74
+ )
75
+ end
76
+
77
+ def self.set_reader_display(reader, params = {}, opts = {})
78
+ request_stripe_object(
79
+ method: :post,
80
+ path: format("/v1/terminal/readers/%<reader>s/set_reader_display", { reader: CGI.escape(reader) }),
50
81
  params: params,
51
82
  opts: opts
52
83
  )
@@ -59,12 +90,19 @@ module Stripe
59
90
  class TestHelpers < APIResourceTestHelpers
60
91
  RESOURCE_CLASS = Reader
61
92
 
62
- custom_method :present_payment_method, http_verb: :post
93
+ def self.present_payment_method(reader, params = {}, opts = {})
94
+ request_stripe_object(
95
+ method: :post,
96
+ path: format("/v1/test_helpers/terminal/readers/%<reader>s/present_payment_method", { reader: CGI.escape(reader) }),
97
+ params: params,
98
+ opts: opts
99
+ )
100
+ end
63
101
 
64
102
  def present_payment_method(params = {}, opts = {})
65
103
  @resource.request_stripe_object(
66
104
  method: :post,
67
- path: resource_url + "/present_payment_method",
105
+ path: format("/v1/test_helpers/terminal/readers/%<reader>s/present_payment_method", { reader: CGI.escape(@resource["id"]) }),
68
106
  params: params,
69
107
  opts: opts
70
108
  )
@@ -10,12 +10,19 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "test_helpers.test_clock"
12
12
 
13
- custom_method :advance, http_verb: :post
14
-
15
13
  def advance(params = {}, opts = {})
16
14
  request_stripe_object(
17
15
  method: :post,
18
- path: resource_url + "/advance",
16
+ path: format("/v1/test_helpers/test_clocks/%<test_clock>s/advance", { test_clock: CGI.escape(self["id"]) }),
17
+ params: params,
18
+ opts: opts
19
+ )
20
+ end
21
+
22
+ def self.advance(test_clock, params = {}, opts = {})
23
+ request_stripe_object(
24
+ method: :post,
25
+ path: format("/v1/test_helpers/test_clocks/%<test_clock>s/advance", { test_clock: CGI.escape(test_clock) }),
19
26
  params: params,
20
27
  opts: opts
21
28
  )
@@ -9,12 +9,19 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "topup"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
-
14
12
  def cancel(params = {}, opts = {})
15
13
  request_stripe_object(
16
14
  method: :post,
17
- path: resource_url + "/cancel",
15
+ path: format("/v1/topups/%<topup>s/cancel", { topup: CGI.escape(self["id"]) }),
16
+ params: params,
17
+ opts: opts
18
+ )
19
+ end
20
+
21
+ def self.cancel(topup, params = {}, opts = {})
22
+ request_stripe_object(
23
+ method: :post,
24
+ path: format("/v1/topups/%<topup>s/cancel", { topup: CGI.escape(topup) }),
18
25
  params: params,
19
26
  opts: opts
20
27
  )
@@ -10,15 +10,22 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "transfer"
12
12
 
13
- custom_method :cancel, http_verb: :post
14
-
15
13
  nested_resource_class_methods :reversal,
16
14
  operations: %i[create retrieve update list]
17
15
 
18
16
  def cancel(params = {}, opts = {})
19
17
  request_stripe_object(
20
18
  method: :post,
21
- path: resource_url + "/cancel",
19
+ path: format("/v1/transfers/%<id>s/cancel", { id: CGI.escape(self["id"]) }),
20
+ params: params,
21
+ opts: opts
22
+ )
23
+ end
24
+
25
+ def self.cancel(id, params = {}, opts = {})
26
+ request_stripe_object(
27
+ method: :post,
28
+ path: format("/v1/transfers/%<id>s/cancel", { id: CGI.escape(id) }),
22
29
  params: params,
23
30
  opts: opts
24
31
  )
@@ -10,13 +10,10 @@ module Stripe
10
10
 
11
11
  OBJECT_NAME = "treasury.financial_account"
12
12
 
13
- custom_method :retrieve_features, http_verb: :get, http_path: "features"
14
- custom_method :update_features, http_verb: :post, http_path: "features"
15
-
16
13
  def retrieve_features(params = {}, opts = {})
17
14
  request_stripe_object(
18
15
  method: :get,
19
- path: resource_url + "/features",
16
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
20
17
  params: params,
21
18
  opts: opts
22
19
  )
@@ -25,7 +22,25 @@ module Stripe
25
22
  def update_features(params = {}, opts = {})
26
23
  request_stripe_object(
27
24
  method: :post,
28
- path: resource_url + "/features",
25
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(self["id"]) }),
26
+ params: params,
27
+ opts: opts
28
+ )
29
+ end
30
+
31
+ def self.retrieve_features(financial_account, params = {}, opts = {})
32
+ request_stripe_object(
33
+ method: :get,
34
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(financial_account) }),
35
+ params: params,
36
+ opts: opts
37
+ )
38
+ end
39
+
40
+ def self.update_features(financial_account, params = {}, opts = {})
41
+ request_stripe_object(
42
+ method: :post,
43
+ path: format("/v1/treasury/financial_accounts/%<financial_account>s/features", { financial_account: CGI.escape(financial_account) }),
29
44
  params: params,
30
45
  opts: opts
31
46
  )
@@ -9,12 +9,19 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "treasury.inbound_transfer"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
-
14
12
  def cancel(params = {}, opts = {})
15
13
  request_stripe_object(
16
14
  method: :post,
17
- path: resource_url + "/cancel",
15
+ path: format("/v1/treasury/inbound_transfers/%<inbound_transfer>s/cancel", { inbound_transfer: CGI.escape(self["id"]) }),
16
+ params: params,
17
+ opts: opts
18
+ )
19
+ end
20
+
21
+ def self.cancel(inbound_transfer, params = {}, opts = {})
22
+ request_stripe_object(
23
+ method: :post,
24
+ path: format("/v1/treasury/inbound_transfers/%<inbound_transfer>s/cancel", { inbound_transfer: CGI.escape(inbound_transfer) }),
18
25
  params: params,
19
26
  opts: opts
20
27
  )
@@ -27,14 +34,37 @@ module Stripe
27
34
  class TestHelpers < APIResourceTestHelpers
28
35
  RESOURCE_CLASS = InboundTransfer
29
36
 
30
- custom_method :fail, http_verb: :post
31
- custom_method :return_inbound_transfer, http_verb: :post, http_path: "return"
32
- custom_method :succeed, http_verb: :post
37
+ def self.fail(id, params = {}, opts = {})
38
+ request_stripe_object(
39
+ method: :post,
40
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/fail", { id: CGI.escape(id) }),
41
+ params: params,
42
+ opts: opts
43
+ )
44
+ end
45
+
46
+ def self.return_inbound_transfer(id, params = {}, opts = {})
47
+ request_stripe_object(
48
+ method: :post,
49
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/return", { id: CGI.escape(id) }),
50
+ params: params,
51
+ opts: opts
52
+ )
53
+ end
54
+
55
+ def self.succeed(id, params = {}, opts = {})
56
+ request_stripe_object(
57
+ method: :post,
58
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/succeed", { id: CGI.escape(id) }),
59
+ params: params,
60
+ opts: opts
61
+ )
62
+ end
33
63
 
34
64
  def fail(params = {}, opts = {})
35
65
  @resource.request_stripe_object(
36
66
  method: :post,
37
- path: resource_url + "/fail",
67
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/fail", { id: CGI.escape(@resource["id"]) }),
38
68
  params: params,
39
69
  opts: opts
40
70
  )
@@ -43,7 +73,7 @@ module Stripe
43
73
  def return_inbound_transfer(params = {}, opts = {})
44
74
  @resource.request_stripe_object(
45
75
  method: :post,
46
- path: resource_url + "/return",
76
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/return", { id: CGI.escape(@resource["id"]) }),
47
77
  params: params,
48
78
  opts: opts
49
79
  )
@@ -52,7 +82,7 @@ module Stripe
52
82
  def succeed(params = {}, opts = {})
53
83
  @resource.request_stripe_object(
54
84
  method: :post,
55
- path: resource_url + "/succeed",
85
+ path: format("/v1/test_helpers/treasury/inbound_transfers/%<id>s/succeed", { id: CGI.escape(@resource["id"]) }),
56
86
  params: params,
57
87
  opts: opts
58
88
  )
@@ -9,12 +9,19 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "treasury.outbound_payment"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
-
14
12
  def cancel(params = {}, opts = {})
15
13
  request_stripe_object(
16
14
  method: :post,
17
- path: resource_url + "/cancel",
15
+ path: format("/v1/treasury/outbound_payments/%<id>s/cancel", { id: CGI.escape(self["id"]) }),
16
+ params: params,
17
+ opts: opts
18
+ )
19
+ end
20
+
21
+ def self.cancel(id, params = {}, opts = {})
22
+ request_stripe_object(
23
+ method: :post,
24
+ path: format("/v1/treasury/outbound_payments/%<id>s/cancel", { id: CGI.escape(id) }),
18
25
  params: params,
19
26
  opts: opts
20
27
  )
@@ -27,14 +34,37 @@ module Stripe
27
34
  class TestHelpers < APIResourceTestHelpers
28
35
  RESOURCE_CLASS = OutboundPayment
29
36
 
30
- custom_method :fail, http_verb: :post
31
- custom_method :post, http_verb: :post
32
- custom_method :return_outbound_payment, http_verb: :post, http_path: "return"
37
+ def self.fail(id, params = {}, opts = {})
38
+ request_stripe_object(
39
+ method: :post,
40
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/fail", { id: CGI.escape(id) }),
41
+ params: params,
42
+ opts: opts
43
+ )
44
+ end
45
+
46
+ def self.post(id, params = {}, opts = {})
47
+ request_stripe_object(
48
+ method: :post,
49
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/post", { id: CGI.escape(id) }),
50
+ params: params,
51
+ opts: opts
52
+ )
53
+ end
54
+
55
+ def self.return_outbound_payment(id, params = {}, opts = {})
56
+ request_stripe_object(
57
+ method: :post,
58
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/return", { id: CGI.escape(id) }),
59
+ params: params,
60
+ opts: opts
61
+ )
62
+ end
33
63
 
34
64
  def fail(params = {}, opts = {})
35
65
  @resource.request_stripe_object(
36
66
  method: :post,
37
- path: resource_url + "/fail",
67
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/fail", { id: CGI.escape(@resource["id"]) }),
38
68
  params: params,
39
69
  opts: opts
40
70
  )
@@ -43,7 +73,7 @@ module Stripe
43
73
  def post(params = {}, opts = {})
44
74
  @resource.request_stripe_object(
45
75
  method: :post,
46
- path: resource_url + "/post",
76
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/post", { id: CGI.escape(@resource["id"]) }),
47
77
  params: params,
48
78
  opts: opts
49
79
  )
@@ -52,7 +82,7 @@ module Stripe
52
82
  def return_outbound_payment(params = {}, opts = {})
53
83
  @resource.request_stripe_object(
54
84
  method: :post,
55
- path: resource_url + "/return",
85
+ path: format("/v1/test_helpers/treasury/outbound_payments/%<id>s/return", { id: CGI.escape(@resource["id"]) }),
56
86
  params: params,
57
87
  opts: opts
58
88
  )
@@ -9,12 +9,19 @@ module Stripe
9
9
 
10
10
  OBJECT_NAME = "treasury.outbound_transfer"
11
11
 
12
- custom_method :cancel, http_verb: :post
13
-
14
12
  def cancel(params = {}, opts = {})
15
13
  request_stripe_object(
16
14
  method: :post,
17
- path: resource_url + "/cancel",
15
+ path: format("/v1/treasury/outbound_transfers/%<outbound_transfer>s/cancel", { outbound_transfer: CGI.escape(self["id"]) }),
16
+ params: params,
17
+ opts: opts
18
+ )
19
+ end
20
+
21
+ def self.cancel(outbound_transfer, params = {}, opts = {})
22
+ request_stripe_object(
23
+ method: :post,
24
+ path: format("/v1/treasury/outbound_transfers/%<outbound_transfer>s/cancel", { outbound_transfer: CGI.escape(outbound_transfer) }),
18
25
  params: params,
19
26
  opts: opts
20
27
  )
@@ -27,14 +34,41 @@ module Stripe
27
34
  class TestHelpers < APIResourceTestHelpers
28
35
  RESOURCE_CLASS = OutboundTransfer
29
36
 
30
- custom_method :fail, http_verb: :post
31
- custom_method :post, http_verb: :post
32
- custom_method :return_outbound_transfer, http_verb: :post, http_path: "return"
37
+ def self.fail(outbound_transfer, params = {}, opts = {})
38
+ request_stripe_object(
39
+ method: :post,
40
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/fail", { outbound_transfer: CGI.escape(outbound_transfer) }),
41
+ params: params,
42
+ opts: opts
43
+ )
44
+ end
45
+
46
+ def self.post(outbound_transfer, params = {}, opts = {})
47
+ request_stripe_object(
48
+ method: :post,
49
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/post", { outbound_transfer: CGI.escape(outbound_transfer) }),
50
+ params: params,
51
+ opts: opts
52
+ )
53
+ end
54
+
55
+ def self.return_outbound_transfer(
56
+ outbound_transfer,
57
+ params = {},
58
+ opts = {}
59
+ )
60
+ request_stripe_object(
61
+ method: :post,
62
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/return", { outbound_transfer: CGI.escape(outbound_transfer) }),
63
+ params: params,
64
+ opts: opts
65
+ )
66
+ end
33
67
 
34
68
  def fail(params = {}, opts = {})
35
69
  @resource.request_stripe_object(
36
70
  method: :post,
37
- path: resource_url + "/fail",
71
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/fail", { outbound_transfer: CGI.escape(@resource["id"]) }),
38
72
  params: params,
39
73
  opts: opts
40
74
  )
@@ -43,7 +77,7 @@ module Stripe
43
77
  def post(params = {}, opts = {})
44
78
  @resource.request_stripe_object(
45
79
  method: :post,
46
- path: resource_url + "/post",
80
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/post", { outbound_transfer: CGI.escape(@resource["id"]) }),
47
81
  params: params,
48
82
  opts: opts
49
83
  )
@@ -52,7 +86,7 @@ module Stripe
52
86
  def return_outbound_transfer(params = {}, opts = {})
53
87
  @resource.request_stripe_object(
54
88
  method: :post,
55
- path: resource_url + "/return",
89
+ path: format("/v1/test_helpers/treasury/outbound_transfers/%<outbound_transfer>s/return", { outbound_transfer: CGI.escape(@resource["id"]) }),
56
90
  params: params,
57
91
  opts: opts
58
92
  )
@@ -16,13 +16,12 @@ module Stripe
16
16
  RESOURCE_CLASS = ReceivedCredit
17
17
 
18
18
  def self.create(params = {}, opts = {})
19
- resp, opts = execute_resource_request(
20
- :post,
21
- "/v1/test_helpers/treasury/received_credits",
22
- params,
23
- opts
19
+ request_stripe_object(
20
+ method: :post,
21
+ path: "/v1/test_helpers/treasury/received_credits",
22
+ params: params,
23
+ opts: opts
24
24
  )
25
- Util.convert_to_stripe_object(resp.data, opts)
26
25
  end
27
26
  end
28
27
  end
@@ -16,13 +16,12 @@ module Stripe
16
16
  RESOURCE_CLASS = ReceivedDebit
17
17
 
18
18
  def self.create(params = {}, opts = {})
19
- resp, opts = execute_resource_request(
20
- :post,
21
- "/v1/test_helpers/treasury/received_debits",
22
- params,
23
- opts
19
+ request_stripe_object(
20
+ method: :post,
21
+ path: "/v1/test_helpers/treasury/received_debits",
22
+ params: params,
23
+ opts: opts
24
24
  )
25
- Util.convert_to_stripe_object(resp.data, opts)
26
25
  end
27
26
  end
28
27
  end
@@ -63,6 +63,7 @@ require "stripe/resources/price"
63
63
  require "stripe/resources/product"
64
64
  require "stripe/resources/promotion_code"
65
65
  require "stripe/resources/quote"
66
+ require "stripe/resources/quote_phase"
66
67
  require "stripe/resources/radar/early_fraud_warning"
67
68
  require "stripe/resources/radar/value_list"
68
69
  require "stripe/resources/radar/value_list_item"
@@ -63,6 +63,8 @@ module Stripe
63
63
  end
64
64
 
65
65
  def initialize
66
+ @api_version = ApiVersion::CURRENT
67
+
66
68
  @ca_bundle_path = Stripe::DEFAULT_CA_BUNDLE_PATH
67
69
  @enable_telemetry = true
68
70
  @verify_ssl_certs = true
data/lib/stripe/util.rb CHANGED
@@ -90,7 +90,7 @@ module Stripe
90
90
  opts
91
91
  )
92
92
 
93
- Util.convert_to_stripe_object(resp.data, opts)
93
+ Util.convert_to_stripe_object_with_params(resp.data, params, opts)
94
94
  end
95
95
  end
96
96
 
@@ -104,9 +104,27 @@ module Stripe
104
104
  # ==== Attributes
105
105
  #
106
106
  # * +data+ - Hash of fields and values to be converted into a StripeObject.
107
+ # * +params+ - Params for +StripeObject+ like filters used in search that
108
+ # will be reused on subsequent API calls.
107
109
  # * +opts+ - Options for +StripeObject+ like an API key that will be reused
108
110
  # on subsequent API calls.
109
111
  def self.convert_to_stripe_object(data, opts = {})
112
+ convert_to_stripe_object_with_params(data, {}, opts)
113
+ end
114
+
115
+ # Converts a hash of fields or an array of hashes into a +StripeObject+ or
116
+ # array of +StripeObject+s. These new objects will be created as a concrete
117
+ # type as dictated by their `object` field (e.g. an `object` value of
118
+ # `charge` would create an instance of +Charge+), but if `object` is not
119
+ # present or of an unknown type, the newly created instance will fall back
120
+ # to being a +StripeObject+.
121
+ #
122
+ # ==== Attributes
123
+ #
124
+ # * +data+ - Hash of fields and values to be converted into a StripeObject.
125
+ # * +opts+ - Options for +StripeObject+ like an API key that will be reused
126
+ # on subsequent API calls.
127
+ def self.convert_to_stripe_object_with_params(data, params, opts = {})
110
128
  opts = normalize_opts(opts)
111
129
 
112
130
  case data
@@ -115,8 +133,16 @@ module Stripe
115
133
  when Hash
116
134
  # Try converting to a known object class. If none available, fall back
117
135
  # to generic StripeObject
118
- object_classes.fetch(data[:object], StripeObject)
119
- .construct_from(data, opts)
136
+ obj = object_classes.fetch(data[:object], StripeObject)
137
+ .construct_from(data, opts)
138
+
139
+ # set filters so that we can fetch the same limit, expansions, and
140
+ # predicates when accessing the next and previous pages
141
+ if obj && (obj.is_a?(SearchResultObject) || obj.is_a?(ListObject))
142
+ obj.filters = params.dup
143
+ end
144
+
145
+ obj
120
146
  else
121
147
  data
122
148
  end
@@ -390,6 +416,15 @@ module Stripe
390
416
  # Hopefully val is a string, but protect in case it's not.
391
417
  val = val.to_s
392
418
 
419
+ # Some values returned by the server are encoded in ASCII-8BIT before
420
+ # being parsed as UTF-8 by Marshal. If we don't transform these here, then
421
+ # puts will fail as it tries to render UTF-8 characters as ASCII-8BIT
422
+ # which is not valid.
423
+ if val && val.encoding == Encoding::ASCII_8BIT
424
+ # Dup the string as it is a frozen literal.
425
+ val = val.dup.force_encoding("UTF-8")
426
+ end
427
+
393
428
  if %r{[^\w\-/]} =~ val
394
429
  # If the string contains any special characters, escape any double
395
430
  # quotes it has, remove newlines, and wrap the whole thing in quotes.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Stripe
4
- VERSION = "6.3.0"
4
+ VERSION = "6.6.0-beta.1"
5
5
  end
data/lib/stripe.rb CHANGED
@@ -15,6 +15,7 @@ require "uri"
15
15
  require "forwardable"
16
16
 
17
17
  # Version
18
+ require "stripe/api_version"
18
19
  require "stripe/version"
19
20
 
20
21
  # API operations
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.3.0
4
+ version: 6.6.0.pre.beta.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-08 00:00:00.000000000 Z
11
+ date: 2022-07-22 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Stripe is the easiest way to accept payments online. See https://stripe.com
14
14
  for details.
@@ -41,6 +41,7 @@ files:
41
41
  - lib/stripe/api_operations/search.rb
42
42
  - lib/stripe/api_resource.rb
43
43
  - lib/stripe/api_resource_test_helpers.rb
44
+ - lib/stripe/api_version.rb
44
45
  - lib/stripe/connection_manager.rb
45
46
  - lib/stripe/error_object.rb
46
47
  - lib/stripe/errors.rb
@@ -112,6 +113,7 @@ files:
112
113
  - lib/stripe/resources/product.rb
113
114
  - lib/stripe/resources/promotion_code.rb
114
115
  - lib/stripe/resources/quote.rb
116
+ - lib/stripe/resources/quote_phase.rb
115
117
  - lib/stripe/resources/radar/early_fraud_warning.rb
116
118
  - lib/stripe/resources/radar/value_list.rb
117
119
  - lib/stripe/resources/radar/value_list_item.rb
@@ -188,9 +190,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
190
  version: 2.3.0
189
191
  required_rubygems_version: !ruby/object:Gem::Requirement
190
192
  requirements:
191
- - - ">="
193
+ - - ">"
192
194
  - !ruby/object:Gem::Version
193
- version: '0'
195
+ version: 1.3.1
194
196
  requirements: []
195
197
  rubygems_version: 3.3.7
196
198
  signing_key: