stripe 5.20.0 → 5.24.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.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +4 -4
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +16 -0
  5. data/VERSION +1 -1
  6. data/lib/stripe.rb +32 -166
  7. data/lib/stripe/api_operations/create.rb +1 -1
  8. data/lib/stripe/api_operations/delete.rb +7 -3
  9. data/lib/stripe/api_operations/list.rb +1 -1
  10. data/lib/stripe/api_operations/nested_resource.rb +6 -5
  11. data/lib/stripe/api_operations/request.rb +19 -3
  12. data/lib/stripe/api_operations/save.rb +7 -4
  13. data/lib/stripe/api_resource.rb +4 -3
  14. data/lib/stripe/list_object.rb +2 -2
  15. data/lib/stripe/oauth.rb +3 -3
  16. data/lib/stripe/object_types.rb +3 -0
  17. data/lib/stripe/resources.rb +3 -0
  18. data/lib/stripe/resources/account.rb +2 -1
  19. data/lib/stripe/resources/account_link.rb +1 -0
  20. data/lib/stripe/resources/apple_pay_domain.rb +1 -0
  21. data/lib/stripe/resources/application_fee.rb +1 -0
  22. data/lib/stripe/resources/balance.rb +1 -0
  23. data/lib/stripe/resources/balance_transaction.rb +1 -0
  24. data/lib/stripe/resources/bank_account.rb +2 -1
  25. data/lib/stripe/resources/billing_portal/session.rb +1 -0
  26. data/lib/stripe/resources/bitcoin_receiver.rb +1 -0
  27. data/lib/stripe/resources/card.rb +1 -0
  28. data/lib/stripe/resources/charge.rb +1 -0
  29. data/lib/stripe/resources/checkout/session.rb +4 -0
  30. data/lib/stripe/resources/country_spec.rb +1 -0
  31. data/lib/stripe/resources/coupon.rb +1 -0
  32. data/lib/stripe/resources/credit_note.rb +3 -2
  33. data/lib/stripe/resources/customer.rb +2 -1
  34. data/lib/stripe/resources/dispute.rb +1 -0
  35. data/lib/stripe/resources/ephemeral_key.rb +1 -0
  36. data/lib/stripe/resources/event.rb +1 -0
  37. data/lib/stripe/resources/exchange_rate.rb +1 -0
  38. data/lib/stripe/resources/file.rb +1 -0
  39. data/lib/stripe/resources/file_link.rb +1 -0
  40. data/lib/stripe/resources/invoice.rb +3 -2
  41. data/lib/stripe/resources/invoice_item.rb +1 -0
  42. data/lib/stripe/resources/issuing/authorization.rb +1 -0
  43. data/lib/stripe/resources/issuing/card.rb +1 -0
  44. data/lib/stripe/resources/issuing/cardholder.rb +1 -0
  45. data/lib/stripe/resources/issuing/dispute.rb +1 -0
  46. data/lib/stripe/resources/issuing/transaction.rb +1 -0
  47. data/lib/stripe/resources/line_item.rb +7 -0
  48. data/lib/stripe/resources/mandate.rb +1 -0
  49. data/lib/stripe/resources/order.rb +1 -0
  50. data/lib/stripe/resources/order_return.rb +1 -0
  51. data/lib/stripe/resources/payment_intent.rb +1 -0
  52. data/lib/stripe/resources/payment_method.rb +1 -0
  53. data/lib/stripe/resources/payout.rb +1 -0
  54. data/lib/stripe/resources/plan.rb +1 -0
  55. data/lib/stripe/resources/price.rb +12 -0
  56. data/lib/stripe/resources/product.rb +1 -0
  57. data/lib/stripe/resources/promotion_code.rb +12 -0
  58. data/lib/stripe/resources/radar/early_fraud_warning.rb +1 -0
  59. data/lib/stripe/resources/radar/value_list.rb +1 -0
  60. data/lib/stripe/resources/radar/value_list_item.rb +1 -0
  61. data/lib/stripe/resources/recipient.rb +1 -0
  62. data/lib/stripe/resources/refund.rb +1 -0
  63. data/lib/stripe/resources/reporting/report_run.rb +1 -0
  64. data/lib/stripe/resources/reporting/report_type.rb +1 -0
  65. data/lib/stripe/resources/review.rb +1 -0
  66. data/lib/stripe/resources/setup_intent.rb +1 -0
  67. data/lib/stripe/resources/sigma/scheduled_query_run.rb +1 -0
  68. data/lib/stripe/resources/sku.rb +1 -0
  69. data/lib/stripe/resources/source.rb +4 -3
  70. data/lib/stripe/resources/subscription.rb +1 -0
  71. data/lib/stripe/resources/subscription_item.rb +2 -1
  72. data/lib/stripe/resources/subscription_schedule.rb +1 -0
  73. data/lib/stripe/resources/tax_rate.rb +1 -0
  74. data/lib/stripe/resources/terminal/connection_token.rb +1 -0
  75. data/lib/stripe/resources/terminal/location.rb +1 -0
  76. data/lib/stripe/resources/terminal/reader.rb +1 -0
  77. data/lib/stripe/resources/three_d_secure.rb +1 -0
  78. data/lib/stripe/resources/token.rb +1 -0
  79. data/lib/stripe/resources/topup.rb +1 -0
  80. data/lib/stripe/resources/transfer.rb +1 -0
  81. data/lib/stripe/resources/webhook_endpoint.rb +1 -0
  82. data/lib/stripe/stripe_configuration.rb +167 -0
  83. data/lib/stripe/stripe_object.rb +1 -1
  84. data/lib/stripe/version.rb +1 -1
  85. data/test/stripe/account_link_test.rb +3 -3
  86. data/test/stripe/checkout/session_test.rb +12 -0
  87. data/test/stripe/price_test.rb +48 -0
  88. data/test/stripe/promotion_code_test.rb +42 -0
  89. data/test/stripe/stripe_configuration_test.rb +128 -0
  90. data/test/stripe/subscription_item_test.rb +1 -1
  91. data/test/stripe_test.rb +88 -19
  92. data/test/test_helper.rb +1 -1
  93. metadata +12 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53d5362cf3395da735662c079302a68f77a067db5ed0b33d9049ab47a5d610e6
4
- data.tar.gz: a33095d14ba39ec3d3a178c5b6a7aaf477f3290a060bc9955d840d30f284d9ad
3
+ metadata.gz: dad4d3bffd7ba2748a3331de5d3b97108732144b33818a5e79efd6eb597e4834
4
+ data.tar.gz: c46abe2511c5316276921da29766c22aed11bb92b136b53fb7ea82fb542640c5
5
5
  SHA512:
6
- metadata.gz: 5708098cb83cae3806edc15aa7baa946f7e1107e380282e64012b59d849a8e5b1a6c394b23347b20dc94a81922760cdaea7cb6b634c8c2f35f8b8c74694e5bee
7
- data.tar.gz: 3add4e8a981bf84adabf38d6c6ee98c7dbebb0254709e38e3ee9c4aeddd68c9ce1b78cf594cf1aad7c1bb587767952cba0be15a273bdb6bf31ed215040c5162b
6
+ metadata.gz: 824c459fec4234b09e6d04d20b79728db4ccd19e0dc5cbe9874d319a995b62cb7c252dff31fad3c0fae295682bd68cfbb9fb52f0e98044f3708f1999c0f55d16
7
+ data.tar.gz: 6f1557c58e7c0ab6e407444208c142953889ec1f2746464804cf38d6766550aca0577902982211a696522f47e5ffc06d304f17c4fc7b4fdfbe60c1603077a72d
@@ -44,10 +44,10 @@ Metrics/ClassLength:
44
44
  - "test/**/*.rb"
45
45
 
46
46
  Metrics/MethodLength:
47
- # There's ~2 long methods in `StripeClient`. If we want to truncate those a
48
- # little, we could move this to be closer to ~30 (but the default of 10 is
49
- # probably too short).
50
- Max: 50
47
+ # There's ~2 long methods in `StripeClient` and one in `NestedResource`. If
48
+ # we want to truncate those a little, we could move this to be closer to ~30
49
+ # (but the default of 10 is probably too short).
50
+ Max: 55
51
51
 
52
52
  Metrics/ModuleLength:
53
53
  Enabled: false
@@ -17,7 +17,7 @@ sudo: false
17
17
  env:
18
18
  global:
19
19
  # If changing this number, please also change it in `test/test_helper.rb`.
20
- - STRIPE_MOCK_VERSION=0.88.0
20
+ - STRIPE_MOCK_VERSION=0.95.0
21
21
 
22
22
  cache:
23
23
  directories:
@@ -1,5 +1,21 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.24.0 - 2020-08-26
4
+ * [#939](https://github.com/stripe/stripe-ruby/pull/939) Extract configurations into separate object
5
+ * [#940](https://github.com/stripe/stripe-ruby/pull/940) Fix typo in documentation of `stripe_object.rb`
6
+
7
+ ## 5.23.1 - 2020-08-05
8
+ * [#936](https://github.com/stripe/stripe-ruby/pull/936) Rename API resource's `request` method
9
+
10
+ ## 5.23.0 - 2020-08-05
11
+ * [#937](https://github.com/stripe/stripe-ruby/pull/937) Add support for the `PromotionCode` resource and APIs
12
+
13
+ ## 5.22.0 - 2020-05-11
14
+ * [#918](https://github.com/stripe/stripe-ruby/pull/918) Add support for the `LineItem` resource and APIs
15
+
16
+ ## 5.21.0 - 2020-04-29
17
+ * [#917](https://github.com/stripe/stripe-ruby/pull/917) Add support for the `Price` resource and APIs
18
+
3
19
  ## 5.20.0 - 2020-04-27
4
20
  * [#916](https://github.com/stripe/stripe-ruby/pull/916) Add new `.generate_header` method for webhooks
5
21
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.20.0
1
+ 5.24.0
@@ -12,6 +12,7 @@ require "securerandom"
12
12
  require "set"
13
13
  require "socket"
14
14
  require "uri"
15
+ require "forwardable"
15
16
 
16
17
  # Version
17
18
  require "stripe/version"
@@ -38,6 +39,7 @@ require "stripe/error_object"
38
39
  require "stripe/api_resource"
39
40
  require "stripe/singleton_api_resource"
40
41
  require "stripe/webhook"
42
+ require "stripe/stripe_configuration"
41
43
 
42
44
  # Named API resources
43
45
  require "stripe/resources"
@@ -48,47 +50,41 @@ require "stripe/oauth"
48
50
  module Stripe
49
51
  DEFAULT_CA_BUNDLE_PATH = __dir__ + "/data/ca-certificates.crt"
50
52
 
51
- @app_info = nil
52
-
53
- @api_base = "https://api.stripe.com"
54
- @connect_base = "https://connect.stripe.com"
55
- @uploads_base = "https://files.stripe.com"
56
-
57
- @log_level = nil
58
- @logger = nil
59
-
60
- @proxy = nil
61
-
62
- @max_network_retries = 0
63
- @max_network_retry_delay = 2
64
- @initial_network_retry_delay = 0.5
65
-
66
- @ca_bundle_path = DEFAULT_CA_BUNDLE_PATH
67
- @ca_store = nil
68
- @verify_ssl_certs = true
53
+ # map to the same values as the standard library's logger
54
+ LEVEL_DEBUG = Logger::DEBUG
55
+ LEVEL_ERROR = Logger::ERROR
56
+ LEVEL_INFO = Logger::INFO
69
57
 
70
- @open_timeout = 30
71
- @read_timeout = 80
58
+ @app_info = nil
72
59
 
73
- @enable_telemetry = true
60
+ @configuration = Stripe::StripeConfiguration.setup
74
61
 
75
62
  class << self
76
- attr_accessor :api_key
77
- attr_accessor :api_version
63
+ extend Forwardable
64
+
65
+ # User configurable options
66
+ def_delegators :@configuration, :api_key, :api_key=
67
+ def_delegators :@configuration, :api_version, :api_version=
68
+ def_delegators :@configuration, :stripe_account, :stripe_account=
69
+ def_delegators :@configuration, :api_base, :api_base=
70
+ def_delegators :@configuration, :uploads_base, :uploads_base=
71
+ def_delegators :@configuration, :connect_base, :connect_base=
72
+ def_delegators :@configuration, :open_timeout, :open_timeout=
73
+ def_delegators :@configuration, :read_timeout, :read_timeout=
74
+ def_delegators :@configuration, :proxy, :proxy=
75
+ def_delegators :@configuration, :verify_ssl_certs, :verify_ssl_certs=
76
+ def_delegators :@configuration, :ca_bundle_path, :ca_bundle_path=
77
+ def_delegators :@configuration, :log_level, :log_level=
78
+ def_delegators :@configuration, :logger, :logger=
79
+ def_delegators :@configuration, :max_network_retries, :max_network_retries=
80
+ def_delegators :@configuration, :enable_telemetry=, :enable_telemetry?
81
+
82
+ # Internal configurations
83
+ def_delegators :@configuration, :max_network_retry_delay
84
+ def_delegators :@configuration, :initial_network_retry_delay
85
+ def_delegators :@configuration, :ca_store
86
+
78
87
  attr_accessor :client_id
79
- attr_accessor :stripe_account
80
-
81
- # These all get manual attribute writers so that we can reset connections
82
- # if they change.
83
- attr_reader :api_base
84
- attr_reader :connect_base
85
- attr_reader :open_timeout
86
- attr_reader :proxy
87
- attr_reader :read_timeout
88
- attr_reader :uploads_base
89
- attr_reader :verify_ssl_certs
90
-
91
- attr_reader :max_network_retry_delay, :initial_network_retry_delay
92
88
  end
93
89
 
94
90
  # Gets the application for a plugin that's identified some. See
@@ -101,126 +97,6 @@ module Stripe
101
97
  @app_info = info
102
98
  end
103
99
 
104
- def self.api_base=(api_base)
105
- @api_base = api_base
106
- StripeClient.clear_all_connection_managers
107
- end
108
-
109
- # The location of a file containing a bundle of CA certificates. By default
110
- # the library will use an included bundle that can successfully validate
111
- # Stripe certificates.
112
- def self.ca_bundle_path
113
- @ca_bundle_path
114
- end
115
-
116
- def self.ca_bundle_path=(path)
117
- @ca_bundle_path = path
118
-
119
- # empty this field so a new store is initialized
120
- @ca_store = nil
121
-
122
- StripeClient.clear_all_connection_managers
123
- end
124
-
125
- # A certificate store initialized from the the bundle in #ca_bundle_path and
126
- # which is used to validate TLS on every request.
127
- #
128
- # This was added to the give the gem "pseudo thread safety" in that it seems
129
- # when initiating many parallel requests marshaling the certificate store is
130
- # the most likely point of failure (see issue #382). Any program attempting
131
- # to leverage this pseudo safety should make a call to this method (i.e.
132
- # `Stripe.ca_store`) in their initialization code because it marshals lazily
133
- # and is itself not thread safe.
134
- def self.ca_store
135
- @ca_store ||= begin
136
- store = OpenSSL::X509::Store.new
137
- store.add_file(ca_bundle_path)
138
- store
139
- end
140
- end
141
-
142
- def self.connect_base=(connect_base)
143
- @connect_base = connect_base
144
- StripeClient.clear_all_connection_managers
145
- end
146
-
147
- def self.enable_telemetry?
148
- @enable_telemetry
149
- end
150
-
151
- def self.enable_telemetry=(val)
152
- @enable_telemetry = val
153
- end
154
-
155
- # map to the same values as the standard library's logger
156
- LEVEL_DEBUG = Logger::DEBUG
157
- LEVEL_ERROR = Logger::ERROR
158
- LEVEL_INFO = Logger::INFO
159
-
160
- # When set prompts the library to log some extra information to $stdout and
161
- # $stderr about what it's doing. For example, it'll produce information about
162
- # requests, responses, and errors that are received. Valid log levels are
163
- # `debug` and `info`, with `debug` being a little more verbose in places.
164
- #
165
- # Use of this configuration is only useful when `.logger` is _not_ set. When
166
- # it is, the decision what levels to print is entirely deferred to the logger.
167
- def self.log_level
168
- @log_level
169
- end
170
-
171
- def self.log_level=(val)
172
- # Backwards compatibility for values that we briefly allowed
173
- if val == "debug"
174
- val = LEVEL_DEBUG
175
- elsif val == "info"
176
- val = LEVEL_INFO
177
- end
178
-
179
- if !val.nil? && ![LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO].include?(val)
180
- raise ArgumentError,
181
- "log_level should only be set to `nil`, `debug` or `info`"
182
- end
183
- @log_level = val
184
- end
185
-
186
- # Sets a logger to which logging output will be sent. The logger should
187
- # support the same interface as the `Logger` class that's part of Ruby's
188
- # standard library (hint, anything in `Rails.logger` will likely be
189
- # suitable).
190
- #
191
- # If `.logger` is set, the value of `.log_level` is ignored. The decision on
192
- # what levels to print is entirely deferred to the logger.
193
- def self.logger
194
- @logger
195
- end
196
-
197
- def self.logger=(val)
198
- @logger = val
199
- end
200
-
201
- def self.max_network_retries
202
- @max_network_retries
203
- end
204
-
205
- def self.max_network_retries=(val)
206
- @max_network_retries = val.to_i
207
- end
208
-
209
- def self.open_timeout=(open_timeout)
210
- @open_timeout = open_timeout
211
- StripeClient.clear_all_connection_managers
212
- end
213
-
214
- def self.proxy=(proxy)
215
- @proxy = proxy
216
- StripeClient.clear_all_connection_managers
217
- end
218
-
219
- def self.read_timeout=(read_timeout)
220
- @read_timeout = read_timeout
221
- StripeClient.clear_all_connection_managers
222
- end
223
-
224
100
  # Sets some basic information about the running application that's sent along
225
101
  # with API requests. Useful for plugin authors to identify their plugin when
226
102
  # communicating with Stripe.
@@ -234,16 +110,6 @@ module Stripe
234
110
  version: version,
235
111
  }
236
112
  end
237
-
238
- def self.uploads_base=(uploads_base)
239
- @uploads_base = uploads_base
240
- StripeClient.clear_all_connection_managers
241
- end
242
-
243
- def self.verify_ssl_certs=(verify_ssl_certs)
244
- @verify_ssl_certs = verify_ssl_certs
245
- StripeClient.clear_all_connection_managers
246
- end
247
113
  end
248
114
 
249
115
  Stripe.log_level = ENV["STRIPE_LOG"] unless ENV["STRIPE_LOG"].nil?
@@ -4,7 +4,7 @@ module Stripe
4
4
  module APIOperations
5
5
  module Create
6
6
  def create(params = {}, opts = {})
7
- resp, opts = request(:post, resource_url, params, opts)
7
+ resp, opts = execute_resource_request(:post, resource_url, params, opts)
8
8
  Util.convert_to_stripe_object(resp.data, opts)
9
9
  end
10
10
  end
@@ -15,15 +15,19 @@ module Stripe
15
15
  # * +opts+ - A Hash of additional options (separate from the params /
16
16
  # object values) to be added to the request. E.g. to allow for an
17
17
  # idempotency_key to be passed in the request headers, or for the
18
- # api_key to be overwritten. See {APIOperations::Request.request}.
18
+ # api_key to be overwritten. See
19
+ # {APIOperations::Request.execute_resource_request}.
19
20
  def delete(id, params = {}, opts = {})
20
- resp, opts = request(:delete, "#{resource_url}/#{id}", params, opts)
21
+ resp, opts = execute_resource_request(:delete,
22
+ "#{resource_url}/#{id}",
23
+ params, opts)
21
24
  Util.convert_to_stripe_object(resp.data, opts)
22
25
  end
23
26
  end
24
27
 
25
28
  def delete(params = {}, opts = {})
26
- resp, opts = request(:delete, resource_url, params, opts)
29
+ resp, opts = execute_resource_request(:delete, resource_url,
30
+ params, opts)
27
31
  initialize_from(resp.data, opts)
28
32
  end
29
33
 
@@ -6,7 +6,7 @@ module Stripe
6
6
  def list(filters = {}, opts = {})
7
7
  opts = Util.normalize_opts(opts)
8
8
 
9
- resp, opts = request(:get, resource_url, filters, opts)
9
+ resp, opts = execute_resource_request(:get, resource_url, filters, opts)
10
10
  obj = ListObject.construct_from(resp.data, opts)
11
11
 
12
12
  # set filters so that we can fetch the same limit, expansions, and
@@ -31,35 +31,36 @@ module Stripe
31
31
  define_singleton_method(:"create_#{resource}") \
32
32
  do |id, params = {}, opts = {}|
33
33
  url = send(resource_url_method, id)
34
- resp, opts = request(:post, url, params, opts)
34
+ resp, opts = execute_resource_request(:post, url, params, opts)
35
35
  Util.convert_to_stripe_object(resp.data, opts)
36
36
  end
37
37
  when :retrieve
38
38
  define_singleton_method(:"retrieve_#{resource}") \
39
39
  do |id, nested_id, opts = {}|
40
40
  url = send(resource_url_method, id, nested_id)
41
- resp, opts = request(:get, url, {}, opts)
41
+ resp, opts = execute_resource_request(:get, url, {}, opts)
42
42
  Util.convert_to_stripe_object(resp.data, opts)
43
43
  end
44
44
  when :update
45
45
  define_singleton_method(:"update_#{resource}") \
46
46
  do |id, nested_id, params = {}, opts = {}|
47
47
  url = send(resource_url_method, id, nested_id)
48
- resp, opts = request(:post, url, params, opts)
48
+ resp, opts = execute_resource_request(:post, url, params, opts)
49
49
  Util.convert_to_stripe_object(resp.data, opts)
50
50
  end
51
51
  when :delete
52
52
  define_singleton_method(:"delete_#{resource}") \
53
53
  do |id, nested_id, params = {}, opts = {}|
54
54
  url = send(resource_url_method, id, nested_id)
55
- resp, opts = request(:delete, url, params, opts)
55
+ resp, opts = execute_resource_request(:delete, url, params,
56
+ opts)
56
57
  Util.convert_to_stripe_object(resp.data, opts)
57
58
  end
58
59
  when :list
59
60
  define_singleton_method(:"list_#{resource_plural}") \
60
61
  do |id, params = {}, opts = {}|
61
62
  url = send(resource_url_method, id)
62
- resp, opts = request(:get, url, params, opts)
63
+ resp, opts = execute_resource_request(:get, url, params, opts)
63
64
  Util.convert_to_stripe_object(resp.data, opts)
64
65
  end
65
66
  else
@@ -4,7 +4,8 @@ module Stripe
4
4
  module APIOperations
5
5
  module Request
6
6
  module ClassMethods
7
- def request(method, url, params = {}, opts = {})
7
+ def execute_resource_request(method, url,
8
+ params = {}, opts = {})
8
9
  params ||= {}
9
10
 
10
11
  error_on_invalid_params(params)
@@ -36,6 +37,17 @@ module Stripe
36
37
  [resp, opts_to_persist]
37
38
  end
38
39
 
40
+ # This method used to be called `request`, but it's such a short name
41
+ # that it eventually conflicted with the name of a field on an API
42
+ # resource (specifically, `Event#request`), so it was renamed to
43
+ # something more unique.
44
+ #
45
+ # The former name had been around for just about forever though, and
46
+ # although all internal uses have been renamed, I've left this alias in
47
+ # place for backwards compatibility. Consider removing it on the next
48
+ # major.
49
+ alias request execute_resource_request
50
+
39
51
  private def error_on_non_string_user_opts(opts)
40
52
  Util::OPTS_USER_SPECIFIED.each do |opt|
41
53
  next unless opts.key?(opt)
@@ -71,10 +83,14 @@ module Stripe
71
83
  base.extend(ClassMethods)
72
84
  end
73
85
 
74
- protected def request(method, url, params = {}, opts = {})
86
+ protected def execute_resource_request(method, url,
87
+ params = {}, opts = {})
75
88
  opts = @opts.merge(Util.normalize_opts(opts))
76
- self.class.request(method, url, params, opts)
89
+ self.class.execute_resource_request(method, url, params, opts)
77
90
  end
91
+
92
+ # See notes on `alias` above.
93
+ alias request execute_resource_request
78
94
  end
79
95
  end
80
96
  end
@@ -15,7 +15,8 @@ module Stripe
15
15
  # * +opts+ - A Hash of additional options (separate from the params /
16
16
  # object values) to be added to the request. E.g. to allow for an
17
17
  # idempotency_key to be passed in the request headers, or for the
18
- # api_key to be overwritten. See {APIOperations::Request.request}.
18
+ # api_key to be overwritten. See
19
+ # {APIOperations::Request.execute_resource_request}.
19
20
  def update(id, params = {}, opts = {})
20
21
  params.each_key do |k|
21
22
  if protected_fields.include?(k)
@@ -23,7 +24,8 @@ module Stripe
23
24
  end
24
25
  end
25
26
 
26
- resp, opts = request(:post, "#{resource_url}/#{id}", params, opts)
27
+ resp, opts = execute_resource_request(:post, "#{resource_url}/#{id}",
28
+ params, opts)
27
29
  Util.convert_to_stripe_object(resp.data, opts)
28
30
  end
29
31
  end
@@ -43,7 +45,8 @@ module Stripe
43
45
  # * +opts+ - A Hash of additional options (separate from the params /
44
46
  # object values) to be added to the request. E.g. to allow for an
45
47
  # idempotency_key to be passed in the request headers, or for the
46
- # api_key to be overwritten. See {APIOperations::Request.request}.
48
+ # api_key to be overwritten. See
49
+ # {APIOperations::Request.execute_resource_request}.
47
50
  def save(params = {}, opts = {})
48
51
  # We started unintentionally (sort of) allowing attributes sent to
49
52
  # +save+ to override values used during the update. So as not to break
@@ -59,7 +62,7 @@ module Stripe
59
62
  # generated a uri for this object with an identifier baked in
60
63
  values.delete(:id)
61
64
 
62
- resp, opts = request(:post, save_url, values, opts)
65
+ resp, opts = execute_resource_request(:post, save_url, values, opts)
63
66
  initialize_from(resp.data, opts)
64
67
  end
65
68