stripe 4.20.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +17 -4
  3. data/.rubocop_todo.yml +10 -9
  4. data/.travis.yml +2 -6
  5. data/CHANGELOG.md +52 -1
  6. data/Gemfile +2 -12
  7. data/README.md +10 -10
  8. data/Rakefile +8 -7
  9. data/VERSION +1 -1
  10. data/lib/stripe/api_operations/list.rb +0 -6
  11. data/lib/stripe/api_resource.rb +16 -0
  12. data/lib/stripe/connection_manager.rb +131 -0
  13. data/lib/stripe/error_object.rb +94 -0
  14. data/lib/stripe/errors.rb +15 -2
  15. data/lib/stripe/list_object.rb +2 -1
  16. data/lib/stripe/multipart_encoder.rb +131 -0
  17. data/lib/stripe/object_types.rb +1 -4
  18. data/lib/stripe/resources/account.rb +7 -7
  19. data/lib/stripe/resources/account_link.rb +1 -1
  20. data/lib/stripe/resources/alipay_account.rb +1 -1
  21. data/lib/stripe/resources/apple_pay_domain.rb +1 -1
  22. data/lib/stripe/resources/application_fee.rb +1 -12
  23. data/lib/stripe/resources/application_fee_refund.rb +1 -1
  24. data/lib/stripe/resources/balance.rb +1 -1
  25. data/lib/stripe/resources/balance_transaction.rb +1 -5
  26. data/lib/stripe/resources/bank_account.rb +1 -1
  27. data/lib/stripe/resources/bitcoin_receiver.rb +1 -1
  28. data/lib/stripe/resources/bitcoin_transaction.rb +1 -1
  29. data/lib/stripe/resources/capability.rb +1 -1
  30. data/lib/stripe/resources/card.rb +1 -1
  31. data/lib/stripe/resources/charge.rb +7 -69
  32. data/lib/stripe/resources/checkout/session.rb +1 -1
  33. data/lib/stripe/resources/country_spec.rb +1 -1
  34. data/lib/stripe/resources/coupon.rb +1 -1
  35. data/lib/stripe/resources/credit_note.rb +7 -3
  36. data/lib/stripe/resources/customer.rb +5 -66
  37. data/lib/stripe/resources/customer_balance_transaction.rb +1 -1
  38. data/lib/stripe/resources/discount.rb +1 -1
  39. data/lib/stripe/resources/dispute.rb +7 -9
  40. data/lib/stripe/resources/ephemeral_key.rb +1 -1
  41. data/lib/stripe/resources/event.rb +1 -1
  42. data/lib/stripe/resources/exchange_rate.rb +1 -1
  43. data/lib/stripe/resources/file.rb +3 -13
  44. data/lib/stripe/resources/file_link.rb +1 -1
  45. data/lib/stripe/resources/invoice.rb +36 -11
  46. data/lib/stripe/resources/invoice_item.rb +1 -1
  47. data/lib/stripe/resources/invoice_line_item.rb +1 -1
  48. data/lib/stripe/resources/issuing/authorization.rb +13 -5
  49. data/lib/stripe/resources/issuing/card.rb +7 -3
  50. data/lib/stripe/resources/issuing/card_details.rb +1 -1
  51. data/lib/stripe/resources/issuing/cardholder.rb +1 -1
  52. data/lib/stripe/resources/issuing/dispute.rb +1 -1
  53. data/lib/stripe/resources/issuing/transaction.rb +1 -1
  54. data/lib/stripe/resources/login_link.rb +1 -1
  55. data/lib/stripe/resources/order.rb +13 -13
  56. data/lib/stripe/resources/order_return.rb +1 -1
  57. data/lib/stripe/resources/payment_intent.rb +19 -7
  58. data/lib/stripe/resources/payment_method.rb +13 -5
  59. data/lib/stripe/resources/payout.rb +7 -9
  60. data/lib/stripe/resources/person.rb +1 -1
  61. data/lib/stripe/resources/plan.rb +1 -1
  62. data/lib/stripe/resources/product.rb +1 -1
  63. data/lib/stripe/resources/radar/early_fraud_warning.rb +1 -1
  64. data/lib/stripe/resources/radar/value_list.rb +1 -1
  65. data/lib/stripe/resources/radar/value_list_item.rb +1 -1
  66. data/lib/stripe/resources/recipient.rb +1 -5
  67. data/lib/stripe/resources/recipient_transfer.rb +1 -1
  68. data/lib/stripe/resources/refund.rb +1 -1
  69. data/lib/stripe/resources/reporting/report_run.rb +1 -1
  70. data/lib/stripe/resources/reporting/report_type.rb +1 -1
  71. data/lib/stripe/resources/reversal.rb +1 -1
  72. data/lib/stripe/resources/review.rb +7 -3
  73. data/lib/stripe/resources/setup_intent.rb +32 -0
  74. data/lib/stripe/resources/sigma/scheduled_query_run.rb +1 -1
  75. data/lib/stripe/resources/sku.rb +1 -1
  76. data/lib/stripe/resources/source.rb +7 -9
  77. data/lib/stripe/resources/source_transaction.rb +1 -1
  78. data/lib/stripe/resources/subscription.rb +9 -9
  79. data/lib/stripe/resources/subscription_item.rb +4 -1
  80. data/lib/stripe/resources/subscription_schedule.rb +13 -13
  81. data/lib/stripe/resources/tax_id.rb +1 -1
  82. data/lib/stripe/resources/tax_rate.rb +1 -1
  83. data/lib/stripe/resources/terminal/connection_token.rb +1 -1
  84. data/lib/stripe/resources/terminal/location.rb +1 -1
  85. data/lib/stripe/resources/terminal/reader.rb +1 -1
  86. data/lib/stripe/resources/three_d_secure.rb +1 -1
  87. data/lib/stripe/resources/token.rb +1 -1
  88. data/lib/stripe/resources/topup.rb +7 -3
  89. data/lib/stripe/resources/transfer.rb +7 -8
  90. data/lib/stripe/resources/usage_record.rb +1 -17
  91. data/lib/stripe/resources/usage_record_summary.rb +1 -1
  92. data/lib/stripe/resources/webhook_endpoint.rb +1 -1
  93. data/lib/stripe/resources.rb +1 -2
  94. data/lib/stripe/stripe_client.rb +281 -183
  95. data/lib/stripe/stripe_object.rb +4 -23
  96. data/lib/stripe/stripe_response.rb +53 -21
  97. data/lib/stripe/util.rb +14 -11
  98. data/lib/stripe/version.rb +1 -1
  99. data/lib/stripe/webhook.rb +1 -1
  100. data/lib/stripe.rb +56 -15
  101. data/stripe.gemspec +10 -3
  102. data/test/stripe/account_test.rb +0 -16
  103. data/test/stripe/api_operations_test.rb +2 -2
  104. data/test/stripe/api_resource_test.rb +98 -8
  105. data/test/stripe/balance_transaction_test.rb +20 -0
  106. data/test/stripe/charge_test.rb +0 -16
  107. data/test/stripe/connection_manager_test.rb +138 -0
  108. data/test/stripe/customer_test.rb +1 -44
  109. data/test/stripe/errors_test.rb +29 -8
  110. data/test/stripe/file_test.rb +0 -10
  111. data/test/stripe/invoice_test.rb +17 -1
  112. data/test/stripe/list_object_test.rb +0 -16
  113. data/test/stripe/login_link_test.rb +1 -1
  114. data/test/stripe/multipart_encoder_test.rb +130 -0
  115. data/test/stripe/payment_intent_test.rb +2 -2
  116. data/test/stripe/setup_intent_test.rb +84 -0
  117. data/test/stripe/source_test.rb +0 -18
  118. data/test/stripe/stripe_client_test.rb +214 -29
  119. data/test/stripe/stripe_object_test.rb +7 -35
  120. data/test/stripe/stripe_response_test.rb +70 -24
  121. data/test/stripe/subscription_item_test.rb +12 -0
  122. data/test/stripe/subscription_schedule_test.rb +0 -34
  123. data/test/stripe/subscription_test.rb +2 -2
  124. data/test/stripe/webhook_test.rb +2 -2
  125. data/test/stripe_mock.rb +4 -3
  126. data/test/stripe_test.rb +0 -13
  127. data/test/test_helper.rb +10 -5
  128. metadata +23 -43
  129. data/lib/stripe/resources/issuer_fraud_record.rb +0 -9
  130. data/lib/stripe/resources/subscription_schedule_revision.rb +0 -34
  131. data/test/stripe/file_upload_test.rb +0 -79
  132. data/test/stripe/issuer_fraud_record_test.rb +0 -20
  133. data/test/stripe/subscription_schedule_revision_test.rb +0 -37
  134. data/test/stripe/usage_record_test.rb +0 -28
@@ -5,40 +5,30 @@ module Stripe
5
5
  extend Stripe::APIOperations::Create
6
6
  extend Stripe::APIOperations::List
7
7
 
8
- OBJECT_NAME = "file".freeze
8
+ OBJECT_NAME = "file"
9
9
 
10
10
  # This resource can have two different object names. In latter API
11
11
  # versions, only `file` is used, but since stripe-ruby may be used with
12
12
  # any API version, we need to support deserializing the older
13
13
  # `file_upload` object into the same class.
14
- OBJECT_NAME_ALT = "file_upload".freeze
14
+ OBJECT_NAME_ALT = "file_upload"
15
15
 
16
16
  def self.resource_url
17
17
  "/v1/files"
18
18
  end
19
19
 
20
20
  def self.create(params = {}, opts = {})
21
- # rest-client would accept a vanilla `File` for upload, but Faraday does
22
- # not. Support the old API by wrapping a `File`-like object with an
23
- # `UploadIO` object if we're given one.
24
21
  if params[:file] && !params[:file].is_a?(String)
25
22
  unless params[:file].respond_to?(:read)
26
23
  raise ArgumentError, "file must respond to `#read`"
27
24
  end
28
-
29
- params[:file] = Faraday::UploadIO.new(params[:file], nil)
30
25
  end
31
26
 
32
27
  opts = {
33
28
  api_base: Stripe.uploads_base,
34
- content_type: "multipart/form-data",
29
+ content_type: MultipartEncoder::MULTIPART_FORM_DATA,
35
30
  }.merge(Util.normalize_opts(opts))
36
31
  super
37
32
  end
38
33
  end
39
34
  end
40
-
41
- module Stripe
42
- # For backwards compatibility, the `File` class is aliased to `FileUpload`.
43
- FileUpload = File
44
- end
@@ -6,6 +6,6 @@ module Stripe
6
6
  extend Stripe::APIOperations::List
7
7
  include Stripe::APIOperations::Save
8
8
 
9
- OBJECT_NAME = "file_link".freeze
9
+ OBJECT_NAME = "file_link"
10
10
  end
11
11
  end
@@ -7,7 +7,7 @@ module Stripe
7
7
  extend Stripe::APIOperations::List
8
8
  include Stripe::APIOperations::Save
9
9
 
10
- OBJECT_NAME = "invoice".freeze
10
+ OBJECT_NAME = "invoice"
11
11
 
12
12
  custom_method :finalize_invoice, http_verb: :post, http_path: "finalize"
13
13
  custom_method :mark_uncollectible, http_verb: :post
@@ -16,33 +16,58 @@ module Stripe
16
16
  custom_method :void_invoice, http_verb: :post, http_path: "void"
17
17
 
18
18
  def finalize_invoice(params = {}, opts = {})
19
- resp, opts = request(:post, resource_url + "/finalize", params, opts)
20
- Util.convert_to_stripe_object(resp.data, opts)
19
+ request_stripe_object(
20
+ method: :post,
21
+ path: resource_url + "/finalize",
22
+ params: params,
23
+ opts: opts
24
+ )
21
25
  end
22
26
 
23
27
  def mark_uncollectible(params = {}, opts = {})
24
- resp, opts = request(:post, resource_url + "/mark_uncollectible", params, opts)
25
- Util.convert_to_stripe_object(resp.data, opts)
28
+ request_stripe_object(
29
+ method: :post,
30
+ path: resource_url + "/mark_uncollectible",
31
+ params: params,
32
+ opts: opts
33
+ )
26
34
  end
27
35
 
28
36
  def pay(params = {}, opts = {})
29
- resp, opts = request(:post, resource_url + "/pay", params, opts)
30
- Util.convert_to_stripe_object(resp.data, opts)
37
+ request_stripe_object(
38
+ method: :post,
39
+ path: resource_url + "/pay",
40
+ params: params,
41
+ opts: opts
42
+ )
31
43
  end
32
44
 
33
45
  def send_invoice(params = {}, opts = {})
34
- resp, opts = request(:post, resource_url + "/send", params, opts)
35
- Util.convert_to_stripe_object(resp.data, opts)
46
+ request_stripe_object(
47
+ method: :post,
48
+ path: resource_url + "/send",
49
+ params: params,
50
+ opts: opts
51
+ )
36
52
  end
37
53
 
38
54
  def void_invoice(params = {}, opts = {})
39
- resp, opts = request(:post, resource_url + "/void", params, opts)
40
- Util.convert_to_stripe_object(resp.data, opts)
55
+ request_stripe_object(
56
+ method: :post,
57
+ path: resource_url + "/void",
58
+ params: params,
59
+ opts: opts
60
+ )
41
61
  end
42
62
 
43
63
  def self.upcoming(params, opts = {})
44
64
  resp, opts = request(:get, resource_url + "/upcoming", params, opts)
45
65
  Util.convert_to_stripe_object(resp.data, opts)
46
66
  end
67
+
68
+ def self.list_upcoming_line_items(params, opts = {})
69
+ resp, opts = request(:get, resource_url + "/upcoming/lines", params, opts)
70
+ Util.convert_to_stripe_object(resp.data, opts)
71
+ end
47
72
  end
48
73
  end
@@ -7,6 +7,6 @@ module Stripe
7
7
  extend Stripe::APIOperations::List
8
8
  include Stripe::APIOperations::Save
9
9
 
10
- OBJECT_NAME = "invoiceitem".freeze
10
+ OBJECT_NAME = "invoiceitem"
11
11
  end
12
12
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Stripe
4
4
  class InvoiceLineItem < StripeObject
5
- OBJECT_NAME = "line_item".freeze
5
+ OBJECT_NAME = "line_item"
6
6
  end
7
7
  end
@@ -6,19 +6,27 @@ module Stripe
6
6
  extend Stripe::APIOperations::List
7
7
  include Stripe::APIOperations::Save
8
8
 
9
- OBJECT_NAME = "issuing.authorization".freeze
9
+ OBJECT_NAME = "issuing.authorization"
10
10
 
11
11
  custom_method :approve, http_verb: :post
12
12
  custom_method :decline, http_verb: :post
13
13
 
14
14
  def approve(params = {}, opts = {})
15
- resp, opts = request(:post, resource_url + "/approve", params, opts)
16
- Util.convert_to_stripe_object(resp.data, opts)
15
+ request_stripe_object(
16
+ method: :post,
17
+ path: resource_url + "/approve",
18
+ params: params,
19
+ opts: opts
20
+ )
17
21
  end
18
22
 
19
23
  def decline(params = {}, opts = {})
20
- resp, opts = request(:post, resource_url + "/decline", params, opts)
21
- Util.convert_to_stripe_object(resp.data, opts)
24
+ request_stripe_object(
25
+ method: :post,
26
+ path: resource_url + "/decline",
27
+ params: params,
28
+ opts: opts
29
+ )
22
30
  end
23
31
  end
24
32
  end
@@ -7,13 +7,17 @@ module Stripe
7
7
  extend Stripe::APIOperations::List
8
8
  include Stripe::APIOperations::Save
9
9
 
10
- OBJECT_NAME = "issuing.card".freeze
10
+ OBJECT_NAME = "issuing.card"
11
11
 
12
12
  custom_method :details, http_verb: :get
13
13
 
14
14
  def details(params = {}, opts = {})
15
- resp, opts = request(:get, resource_url + "/details", params, opts)
16
- Util.convert_to_stripe_object(resp.data, opts)
15
+ request_stripe_object(
16
+ method: :get,
17
+ path: resource_url + "/details",
18
+ params: params,
19
+ opts: opts
20
+ )
17
21
  end
18
22
  end
19
23
  end
@@ -3,7 +3,7 @@
3
3
  module Stripe
4
4
  module Issuing
5
5
  class CardDetails < Stripe::StripeObject
6
- OBJECT_NAME = "issuing.card_details".freeze
6
+ OBJECT_NAME = "issuing.card_details"
7
7
  end
8
8
  end
9
9
  end
@@ -7,7 +7,7 @@ module Stripe
7
7
  extend Stripe::APIOperations::List
8
8
  include Stripe::APIOperations::Save
9
9
 
10
- OBJECT_NAME = "issuing.cardholder".freeze
10
+ OBJECT_NAME = "issuing.cardholder"
11
11
  end
12
12
  end
13
13
  end
@@ -7,7 +7,7 @@ module Stripe
7
7
  extend Stripe::APIOperations::List
8
8
  include Stripe::APIOperations::Save
9
9
 
10
- OBJECT_NAME = "issuing.dispute".freeze
10
+ OBJECT_NAME = "issuing.dispute"
11
11
  end
12
12
  end
13
13
  end
@@ -6,7 +6,7 @@ module Stripe
6
6
  extend Stripe::APIOperations::List
7
7
  include Stripe::APIOperations::Save
8
8
 
9
- OBJECT_NAME = "issuing.transaction".freeze
9
+ OBJECT_NAME = "issuing.transaction"
10
10
  end
11
11
  end
12
12
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Stripe
4
4
  class LoginLink < APIResource
5
- OBJECT_NAME = "login_link".freeze
5
+ OBJECT_NAME = "login_link"
6
6
 
7
7
  def self.retrieve(_id, _opts = nil)
8
8
  raise NotImplementedError,
@@ -6,27 +6,27 @@ module Stripe
6
6
  extend Stripe::APIOperations::List
7
7
  include Stripe::APIOperations::Save
8
8
 
9
- OBJECT_NAME = "order".freeze
9
+ OBJECT_NAME = "order"
10
10
 
11
11
  custom_method :pay, http_verb: :post
12
12
  custom_method :return_order, http_verb: :post, http_path: "returns"
13
13
 
14
14
  def pay(params = {}, opts = {})
15
- resp, opts = request(:post, resource_url + "/pay", params, opts)
16
- Util.convert_to_stripe_object(resp.data, opts)
15
+ request_stripe_object(
16
+ method: :post,
17
+ path: resource_url + "/pay",
18
+ params: params,
19
+ opts: opts
20
+ )
17
21
  end
18
22
 
19
23
  def return_order(params = {}, opts = {})
20
- resp, opts = request(:post, resource_url + "/returns", params, opts)
21
- Util.convert_to_stripe_object(resp.data, opts)
22
- end
23
-
24
- private def pay_url
25
- resource_url + "/pay"
26
- end
27
-
28
- private def returns_url
29
- resource_url + "/returns"
24
+ request_stripe_object(
25
+ method: :post,
26
+ path: resource_url + "/returns",
27
+ params: params,
28
+ opts: opts
29
+ )
30
30
  end
31
31
  end
32
32
  end
@@ -4,6 +4,6 @@ module Stripe
4
4
  class OrderReturn < APIResource
5
5
  extend Stripe::APIOperations::List
6
6
 
7
- OBJECT_NAME = "order_return".freeze
7
+ OBJECT_NAME = "order_return"
8
8
  end
9
9
  end
@@ -6,25 +6,37 @@ module Stripe
6
6
  extend Stripe::APIOperations::List
7
7
  include Stripe::APIOperations::Save
8
8
 
9
- OBJECT_NAME = "payment_intent".freeze
9
+ OBJECT_NAME = "payment_intent"
10
10
 
11
11
  custom_method :cancel, http_verb: :post
12
12
  custom_method :capture, http_verb: :post
13
13
  custom_method :confirm, http_verb: :post
14
14
 
15
15
  def cancel(params = {}, opts = {})
16
- resp, opts = request(:post, resource_url + "/cancel", params, opts)
17
- Util.convert_to_stripe_object(resp.data, opts)
16
+ request_stripe_object(
17
+ method: :post,
18
+ path: resource_url + "/cancel",
19
+ params: params,
20
+ opts: opts
21
+ )
18
22
  end
19
23
 
20
24
  def capture(params = {}, opts = {})
21
- resp, opts = request(:post, resource_url + "/capture", params, opts)
22
- Util.convert_to_stripe_object(resp.data, opts)
25
+ request_stripe_object(
26
+ method: :post,
27
+ path: resource_url + "/capture",
28
+ params: params,
29
+ opts: opts
30
+ )
23
31
  end
24
32
 
25
33
  def confirm(params = {}, opts = {})
26
- resp, opts = request(:post, resource_url + "/confirm", params, opts)
27
- Util.convert_to_stripe_object(resp.data, opts)
34
+ request_stripe_object(
35
+ method: :post,
36
+ path: resource_url + "/confirm",
37
+ params: params,
38
+ opts: opts
39
+ )
28
40
  end
29
41
  end
30
42
  end
@@ -6,19 +6,27 @@ module Stripe
6
6
  extend Stripe::APIOperations::List
7
7
  include Stripe::APIOperations::Save
8
8
 
9
- OBJECT_NAME = "payment_method".freeze
9
+ OBJECT_NAME = "payment_method"
10
10
 
11
11
  custom_method :attach, http_verb: :post
12
12
  custom_method :detach, http_verb: :post
13
13
 
14
14
  def attach(params = {}, opts = {})
15
- resp, opts = request(:post, resource_url + "/attach", params, opts)
16
- Util.convert_to_stripe_object(resp.data, opts)
15
+ request_stripe_object(
16
+ method: :post,
17
+ path: resource_url + "/attach",
18
+ params: params,
19
+ opts: opts
20
+ )
17
21
  end
18
22
 
19
23
  def detach(params = {}, opts = {})
20
- resp, opts = request(:post, resource_url + "/detach", params, opts)
21
- Util.convert_to_stripe_object(resp.data, opts)
24
+ request_stripe_object(
25
+ method: :post,
26
+ path: resource_url + "/detach",
27
+ params: params,
28
+ opts: opts
29
+ )
22
30
  end
23
31
  end
24
32
  end
@@ -6,19 +6,17 @@ module Stripe
6
6
  extend Stripe::APIOperations::List
7
7
  include Stripe::APIOperations::Save
8
8
 
9
- OBJECT_NAME = "payout".freeze
9
+ OBJECT_NAME = "payout"
10
10
 
11
11
  custom_method :cancel, http_verb: :post
12
12
 
13
13
  def cancel(params = {}, opts = {})
14
- resp, opts = request(:post, resource_url + "/cancel", params, opts)
15
- Util.convert_to_stripe_object(resp.data, opts)
14
+ request_stripe_object(
15
+ method: :post,
16
+ path: resource_url + "/cancel",
17
+ params: params,
18
+ opts: opts
19
+ )
16
20
  end
17
-
18
- def cancel_url
19
- resource_url + "/cancel"
20
- end
21
- extend Gem::Deprecate
22
- deprecate :cancel_url, :none, 2019, 11
23
21
  end
24
22
  end
@@ -5,7 +5,7 @@ module Stripe
5
5
  extend Stripe::APIOperations::List
6
6
  include Stripe::APIOperations::Save
7
7
 
8
- OBJECT_NAME = "person".freeze
8
+ OBJECT_NAME = "person"
9
9
 
10
10
  def resource_url
11
11
  if !respond_to?(:account) || account.nil?
@@ -7,6 +7,6 @@ module Stripe
7
7
  extend Stripe::APIOperations::List
8
8
  include Stripe::APIOperations::Save
9
9
 
10
- OBJECT_NAME = "plan".freeze
10
+ OBJECT_NAME = "plan"
11
11
  end
12
12
  end
@@ -7,6 +7,6 @@ module Stripe
7
7
  extend Stripe::APIOperations::List
8
8
  include Stripe::APIOperations::Save
9
9
 
10
- OBJECT_NAME = "product".freeze
10
+ OBJECT_NAME = "product"
11
11
  end
12
12
  end
@@ -5,7 +5,7 @@ module Stripe
5
5
  class EarlyFraudWarning < APIResource
6
6
  extend Stripe::APIOperations::List
7
7
 
8
- OBJECT_NAME = "radar.early_fraud_warning".freeze
8
+ OBJECT_NAME = "radar.early_fraud_warning"
9
9
  end
10
10
  end
11
11
  end
@@ -8,7 +8,7 @@ module Stripe
8
8
  extend Stripe::APIOperations::List
9
9
  include Stripe::APIOperations::Save
10
10
 
11
- OBJECT_NAME = "radar.value_list".freeze
11
+ OBJECT_NAME = "radar.value_list"
12
12
  end
13
13
  end
14
14
  end
@@ -7,7 +7,7 @@ module Stripe
7
7
  include Stripe::APIOperations::Delete
8
8
  extend Stripe::APIOperations::List
9
9
 
10
- OBJECT_NAME = "radar.value_list_item".freeze
10
+ OBJECT_NAME = "radar.value_list_item"
11
11
  end
12
12
  end
13
13
  end
@@ -8,10 +8,6 @@ module Stripe
8
8
  extend Stripe::APIOperations::List
9
9
  include Stripe::APIOperations::Save
10
10
 
11
- OBJECT_NAME = "recipient".freeze
12
-
13
- def transfers
14
- Transfer.all({ recipient: id }, @api_key)
15
- end
11
+ OBJECT_NAME = "recipient"
16
12
  end
17
13
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Stripe
4
4
  class RecipientTransfer < StripeObject
5
- OBJECT_NAME = "recipient_transfer".freeze
5
+ OBJECT_NAME = "recipient_transfer"
6
6
  end
7
7
  end
@@ -6,6 +6,6 @@ module Stripe
6
6
  extend Stripe::APIOperations::List
7
7
  include Stripe::APIOperations::Save
8
8
 
9
- OBJECT_NAME = "refund".freeze
9
+ OBJECT_NAME = "refund"
10
10
  end
11
11
  end
@@ -6,7 +6,7 @@ module Stripe
6
6
  extend Stripe::APIOperations::Create
7
7
  extend Stripe::APIOperations::List
8
8
 
9
- OBJECT_NAME = "reporting.report_run".freeze
9
+ OBJECT_NAME = "reporting.report_run"
10
10
  end
11
11
  end
12
12
  end
@@ -6,7 +6,7 @@ module Stripe
6
6
  extend Stripe::APIOperations::Create
7
7
  extend Stripe::APIOperations::List
8
8
 
9
- OBJECT_NAME = "reporting.report_type".freeze
9
+ OBJECT_NAME = "reporting.report_type"
10
10
  end
11
11
  end
12
12
  end
@@ -5,7 +5,7 @@ module Stripe
5
5
  extend Stripe::APIOperations::List
6
6
  include Stripe::APIOperations::Save
7
7
 
8
- OBJECT_NAME = "transfer_reversal".freeze
8
+ OBJECT_NAME = "transfer_reversal"
9
9
 
10
10
  def resource_url
11
11
  "#{Transfer.resource_url}/#{CGI.escape(transfer)}/reversals" \
@@ -4,13 +4,17 @@ module Stripe
4
4
  class Review < APIResource
5
5
  extend Stripe::APIOperations::List
6
6
 
7
- OBJECT_NAME = "review".freeze
7
+ OBJECT_NAME = "review"
8
8
 
9
9
  custom_method :approve, http_verb: :post
10
10
 
11
11
  def approve(params = {}, opts = {})
12
- resp, opts = request(:post, resource_url + "/approve", params, opts)
13
- Util.convert_to_stripe_object(resp.data, opts)
12
+ request_stripe_object(
13
+ method: :post,
14
+ path: resource_url + "/approve",
15
+ params: params,
16
+ opts: opts
17
+ )
14
18
  end
15
19
  end
16
20
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Stripe
4
+ class SetupIntent < APIResource
5
+ extend Stripe::APIOperations::Create
6
+ extend Stripe::APIOperations::List
7
+ include Stripe::APIOperations::Save
8
+
9
+ OBJECT_NAME = "setup_intent"
10
+
11
+ custom_method :cancel, http_verb: :post
12
+ custom_method :confirm, http_verb: :post
13
+
14
+ def cancel(params = {}, opts = {})
15
+ request_stripe_object(
16
+ method: :post,
17
+ path: resource_url + "/cancel",
18
+ params: params,
19
+ opts: opts
20
+ )
21
+ end
22
+
23
+ def confirm(params = {}, opts = {})
24
+ request_stripe_object(
25
+ method: :post,
26
+ path: resource_url + "/confirm",
27
+ params: params,
28
+ opts: opts
29
+ )
30
+ end
31
+ end
32
+ end
@@ -5,7 +5,7 @@ module Stripe
5
5
  class ScheduledQueryRun < APIResource
6
6
  extend Stripe::APIOperations::List
7
7
 
8
- OBJECT_NAME = "scheduled_query_run".freeze
8
+ OBJECT_NAME = "scheduled_query_run"
9
9
 
10
10
  def self.resource_url
11
11
  "/v1/sigma/scheduled_query_runs"
@@ -7,6 +7,6 @@ module Stripe
7
7
  extend Stripe::APIOperations::List
8
8
  include Stripe::APIOperations::Save
9
9
 
10
- OBJECT_NAME = "sku".freeze
10
+ OBJECT_NAME = "sku"
11
11
  end
12
12
  end
@@ -5,13 +5,17 @@ module Stripe
5
5
  extend Stripe::APIOperations::Create
6
6
  include Stripe::APIOperations::Save
7
7
 
8
- OBJECT_NAME = "source".freeze
8
+ OBJECT_NAME = "source"
9
9
 
10
10
  custom_method :verify, http_verb: :post
11
11
 
12
12
  def verify(params = {}, opts = {})
13
- resp, opts = request(:post, resource_url + "/verify", params, opts)
14
- Util.convert_to_stripe_object(resp.data, opts)
13
+ request_stripe_object(
14
+ method: :post,
15
+ path: resource_url + "/verify",
16
+ params: params,
17
+ opts: opts
18
+ )
15
19
  end
16
20
 
17
21
  def detach(params = {}, opts = {})
@@ -27,12 +31,6 @@ module Stripe
27
31
  initialize_from(resp.data, opts)
28
32
  end
29
33
 
30
- def delete(params = {}, opts = {})
31
- detach(params, opts)
32
- end
33
- extend Gem::Deprecate
34
- deprecate :delete, "#detach", 2017, 10
35
-
36
34
  def source_transactions(params = {}, opts = {})
37
35
  resp, opts = request(:get, resource_url + "/source_transactions", params,
38
36
  opts)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Stripe
4
4
  class SourceTransaction < StripeObject
5
- OBJECT_NAME = "source_transaction".freeze
5
+ OBJECT_NAME = "source_transaction"
6
6
  end
7
7
  end