stripe 5.28.0 → 5.38.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -0
  3. data/Gemfile +0 -1
  4. data/README.md +5 -1
  5. data/VERSION +1 -1
  6. data/lib/stripe/api_operations/request.rb +35 -2
  7. data/lib/stripe/api_resource.rb +8 -0
  8. data/lib/stripe/connection_manager.rb +27 -10
  9. data/lib/stripe/error_object.rb +2 -3
  10. data/lib/stripe/instrumentation.rb +3 -1
  11. data/lib/stripe/oauth.rb +4 -3
  12. data/lib/stripe/object_types.rb +7 -1
  13. data/lib/stripe/resources/account.rb +3 -8
  14. data/lib/stripe/resources/application_fee_refund.rb +2 -1
  15. data/lib/stripe/resources/billing_portal/configuration.rb +14 -0
  16. data/lib/stripe/resources/bitcoin_transaction.rb +3 -2
  17. data/lib/stripe/resources/capability.rb +2 -1
  18. data/lib/stripe/resources/credit_note_line_item.rb +1 -0
  19. data/lib/stripe/resources/customer.rb +6 -1
  20. data/lib/stripe/resources/customer_balance_transaction.rb +3 -2
  21. data/lib/stripe/resources/file.rb +2 -1
  22. data/lib/stripe/resources/identity/verification_report.rb +12 -0
  23. data/lib/stripe/resources/identity/verification_session.rb +35 -0
  24. data/lib/stripe/resources/invoice_line_item.rb +1 -0
  25. data/lib/stripe/resources/line_item.rb +1 -0
  26. data/lib/stripe/resources/login_link.rb +1 -0
  27. data/lib/stripe/resources/person.rb +1 -0
  28. data/lib/stripe/resources/quote.rb +105 -0
  29. data/lib/stripe/resources/reversal.rb +3 -2
  30. data/lib/stripe/resources/tax_code.rb +10 -0
  31. data/lib/stripe/resources/tax_id.rb +1 -0
  32. data/lib/stripe/resources/usage_record.rb +1 -0
  33. data/lib/stripe/resources/usage_record_summary.rb +1 -0
  34. data/lib/stripe/resources.rb +6 -0
  35. data/lib/stripe/stripe_client.rb +242 -111
  36. data/lib/stripe/stripe_configuration.rb +25 -9
  37. data/lib/stripe/stripe_object.rb +23 -0
  38. data/lib/stripe/stripe_response.rb +80 -52
  39. data/lib/stripe/util.rb +15 -7
  40. data/lib/stripe/version.rb +1 -1
  41. data/lib/stripe.rb +23 -22
  42. data/stripe.gemspec +9 -2
  43. metadata +8 -192
  44. data/.editorconfig +0 -10
  45. data/.gitattributes +0 -4
  46. data/.github/ISSUE_TEMPLATE.md +0 -5
  47. data/.gitignore +0 -8
  48. data/.rubocop.yml +0 -80
  49. data/.rubocop_todo.yml +0 -33
  50. data/.travis.yml +0 -38
  51. data/.vscode/extensions.json +0 -7
  52. data/.vscode/settings.json +0 -8
  53. data/test/openapi/README.md +0 -9
  54. data/test/stripe/account_link_test.rb +0 -18
  55. data/test/stripe/account_test.rb +0 -412
  56. data/test/stripe/alipay_account_test.rb +0 -37
  57. data/test/stripe/api_operations_test.rb +0 -80
  58. data/test/stripe/api_resource_test.rb +0 -646
  59. data/test/stripe/apple_pay_domain_test.rb +0 -46
  60. data/test/stripe/application_fee_refund_test.rb +0 -37
  61. data/test/stripe/application_fee_test.rb +0 -58
  62. data/test/stripe/balance_test.rb +0 -13
  63. data/test/stripe/balance_transaction_test.rb +0 -20
  64. data/test/stripe/bank_account_test.rb +0 -36
  65. data/test/stripe/billing_portal/session_test.rb +0 -18
  66. data/test/stripe/capability_test.rb +0 -45
  67. data/test/stripe/charge_test.rb +0 -64
  68. data/test/stripe/checkout/session_test.rb +0 -53
  69. data/test/stripe/connection_manager_test.rb +0 -167
  70. data/test/stripe/country_spec_test.rb +0 -20
  71. data/test/stripe/coupon_test.rb +0 -61
  72. data/test/stripe/credit_note_test.rb +0 -90
  73. data/test/stripe/customer_balance_transaction_test.rb +0 -37
  74. data/test/stripe/customer_card_test.rb +0 -48
  75. data/test/stripe/customer_test.rb +0 -226
  76. data/test/stripe/dispute_test.rb +0 -51
  77. data/test/stripe/ephemeral_key_test.rb +0 -93
  78. data/test/stripe/errors_test.rb +0 -53
  79. data/test/stripe/exchange_rate_test.rb +0 -20
  80. data/test/stripe/file_link_test.rb +0 -41
  81. data/test/stripe/file_test.rb +0 -87
  82. data/test/stripe/instrumentation_test.rb +0 -74
  83. data/test/stripe/invoice_item_test.rb +0 -66
  84. data/test/stripe/invoice_line_item_test.rb +0 -8
  85. data/test/stripe/invoice_test.rb +0 -229
  86. data/test/stripe/issuing/authorization_test.rb +0 -72
  87. data/test/stripe/issuing/card_test.rb +0 -74
  88. data/test/stripe/issuing/cardholder_test.rb +0 -53
  89. data/test/stripe/issuing/dispute_test.rb +0 -54
  90. data/test/stripe/issuing/transaction_test.rb +0 -48
  91. data/test/stripe/list_object_test.rb +0 -202
  92. data/test/stripe/login_link_test.rb +0 -37
  93. data/test/stripe/mandate_test.rb +0 -14
  94. data/test/stripe/multipart_encoder_test.rb +0 -130
  95. data/test/stripe/oauth_test.rb +0 -104
  96. data/test/stripe/order_return_test.rb +0 -21
  97. data/test/stripe/order_test.rb +0 -82
  98. data/test/stripe/payment_intent_test.rb +0 -107
  99. data/test/stripe/payment_method_test.rb +0 -84
  100. data/test/stripe/payout_test.rb +0 -72
  101. data/test/stripe/person_test.rb +0 -46
  102. data/test/stripe/plan_test.rb +0 -98
  103. data/test/stripe/price_test.rb +0 -48
  104. data/test/stripe/product_test.rb +0 -58
  105. data/test/stripe/promotion_code_test.rb +0 -42
  106. data/test/stripe/radar/early_fraud_warning_test.rb +0 -22
  107. data/test/stripe/radar/value_list_item_test.rb +0 -48
  108. data/test/stripe/radar/value_list_test.rb +0 -61
  109. data/test/stripe/recipient_test.rb +0 -62
  110. data/test/stripe/refund_test.rb +0 -39
  111. data/test/stripe/reporting/report_run_test.rb +0 -33
  112. data/test/stripe/reporting/report_type_test.rb +0 -22
  113. data/test/stripe/reversal_test.rb +0 -43
  114. data/test/stripe/review_test.rb +0 -27
  115. data/test/stripe/setup_attempt_test.rb +0 -16
  116. data/test/stripe/setup_intent_test.rb +0 -84
  117. data/test/stripe/sigma/scheduled_query_run_test.rb +0 -22
  118. data/test/stripe/sku_test.rb +0 -60
  119. data/test/stripe/source_test.rb +0 -119
  120. data/test/stripe/stripe_client_test.rb +0 -1291
  121. data/test/stripe/stripe_configuration_test.rb +0 -131
  122. data/test/stripe/stripe_object_test.rb +0 -500
  123. data/test/stripe/stripe_response_test.rb +0 -95
  124. data/test/stripe/subscription_item_test.rb +0 -84
  125. data/test/stripe/subscription_schedule_test.rb +0 -82
  126. data/test/stripe/subscription_test.rb +0 -80
  127. data/test/stripe/tax_id_test.rb +0 -31
  128. data/test/stripe/tax_rate_test.rb +0 -43
  129. data/test/stripe/terminal/connection_token_test.rb +0 -16
  130. data/test/stripe/terminal/location_test.rb +0 -68
  131. data/test/stripe/terminal/reader_test.rb +0 -62
  132. data/test/stripe/three_d_secure_test.rb +0 -23
  133. data/test/stripe/topup_test.rb +0 -62
  134. data/test/stripe/transfer_test.rb +0 -88
  135. data/test/stripe/usage_record_summary_test.rb +0 -29
  136. data/test/stripe/util_test.rb +0 -402
  137. data/test/stripe/webhook_endpoint_test.rb +0 -59
  138. data/test/stripe/webhook_test.rb +0 -135
  139. data/test/stripe_mock.rb +0 -78
  140. data/test/stripe_test.rb +0 -132
  141. data/test/test_data.rb +0 -61
  142. data/test/test_helper.rb +0 -77
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc768f1967f8b5d8d925a101dffc820bd4dfa96155cecc9bd86926cb30f07cbe
4
- data.tar.gz: 7dcd29fb83035f6f6af335bf3a4acde40ea4ce7e0e097413b9f76c696bb3e529
3
+ metadata.gz: 1c7a2e67a4d91e1a22dff9303644b5f2efb74675bce05e364fff8d287f3fa8bd
4
+ data.tar.gz: a560d866c948d0bbc8f3389571c313da67a26650a771159fa785d7a1e3beccc9
5
5
  SHA512:
6
- metadata.gz: e911a5c3138805c0aeb5abe270186e4d4219b8414e3336579cda3caa02ad32797d0d088cce8468156f4dff27a6ff55ac107419e7a0b01040eec36be8684073d7
7
- data.tar.gz: 6fd38cd5ffde35f1065ce18104382f106eec79fb3494099e49723745ada158f7f63df1164653a6ada3fe0c62ae0ed764cbf9e40e878f4e3bb4dbd6c799cffbfa
6
+ metadata.gz: a257d84bec5ef9fe3005b362da5c5194a71e257e77baa71c5872b990fefc3e3ee7cc26201d773cf4f5ca29af0fd8b2d3f3b047e11a833c51aba7bca2f6b3947a
7
+ data.tar.gz: eae3ef2579f9ce37a5e447cd46ca67bdfebc2324e5767cc0925d7f2bee5d8f289a69512ff9221cb28bdd9c4ec39a8cea1f7b5af14b67d18b2fa8a3c9ce7dbb47
data/CHANGELOG.md CHANGED
@@ -1,5 +1,51 @@
1
1
  # Changelog
2
2
 
3
+ ## 5.38.0 - 2021-08-10
4
+ * [#993](https://github.com/stripe/stripe-ruby/pull/993) Add `request_id` to RequestEndEvent
5
+ * [#991](https://github.com/stripe/stripe-ruby/pull/991) Codegen more files
6
+ * [#989](https://github.com/stripe/stripe-ruby/pull/989) Remove unused API error types from docs.
7
+
8
+ ## 5.37.0 - 2021-07-14
9
+ * [#988](https://github.com/stripe/stripe-ruby/pull/988) API Updates
10
+ * Add support for `list_computed_upfront_line_items` method on resource `Quote`
11
+
12
+ ## 5.36.0 - 2021-07-09
13
+ * [#987](https://github.com/stripe/stripe-ruby/pull/987) Add support for `Quote` API
14
+
15
+ ## 5.35.0 - 2021-06-30
16
+ * [#985](https://github.com/stripe/stripe-ruby/pull/985) Update normalize_opts to use dup instead of clone.
17
+ * [#982](https://github.com/stripe/stripe-ruby/pull/982) Deprecate travis
18
+ * [#983](https://github.com/stripe/stripe-ruby/pull/983) Add support for making a request and receiving the response as a stream.
19
+
20
+ ## 5.34.0 - 2021-06-04
21
+ * [#981](https://github.com/stripe/stripe-ruby/pull/981) API Updates
22
+ * Add support for `TaxCode` API.
23
+
24
+ ## 5.33.0 - 2021-05-19
25
+ * [#979](https://github.com/stripe/stripe-ruby/pull/979) Add support for the Identify VerificationSession and VerificationReport APIs
26
+
27
+ ## 5.32.1 - 2021-04-05
28
+ * Correct use of regexp `match` in gemspec for old versions of Ruby
29
+
30
+ ## 5.32.0 - 2021-04-05
31
+ * [#973](https://github.com/stripe/stripe-ruby/pull/973) Reduce packed gem size
32
+
33
+ ## 5.31.0 - 2021-04-02
34
+ * [#968](https://github.com/stripe/stripe-ruby/pull/968) Allow StripeClient to be configured per instance
35
+ * [#971](https://github.com/stripe/stripe-ruby/pull/971) On config change, only clear connection managers for changed config
36
+ * [#972](https://github.com/stripe/stripe-ruby/pull/972) Rename `Stripe.configuration` to `Stripe.config`
37
+ * [#970](https://github.com/stripe/stripe-ruby/pull/970) Reserve some critical field names when adding `StripeObject` accessors
38
+ * [#967](https://github.com/stripe/stripe-ruby/pull/967) CI: github actions
39
+
40
+ ## 5.30.0 - 2021-02-22
41
+ * [#965](https://github.com/stripe/stripe-ruby/pull/965) Add support for the Billing Portal Configuration API
42
+
43
+ ## 5.29.1 - 2021-02-09
44
+ * [#964](https://github.com/stripe/stripe-ruby/pull/964) Fix return value of `Customer#delete_discount`
45
+
46
+ ## 5.29.0 - 2021-01-05
47
+ * [#952](https://github.com/stripe/stripe-ruby/pull/952) Allow client_id configuration on instance config
48
+
3
49
  ## 5.28.0 - 2020-10-14
4
50
  * [#950](https://github.com/stripe/stripe-ruby/pull/950) Add configuration option for `write_timeout` for connections on Ruby 2.6+
5
51
 
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ source "https://rubygems.org"
5
5
  gemspec
6
6
 
7
7
  group :development do
8
- gem "coveralls", require: false
9
8
  gem "mocha", "~> 0.13.2"
10
9
  gem "rack", ">= 2.0.6"
11
10
  gem "rake"
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Gem Version](https://badge.fury.io/rb/stripe.svg)](https://badge.fury.io/rb/stripe)
4
4
  [![Build Status](https://travis-ci.org/stripe/stripe-ruby.svg?branch=master)](https://travis-ci.org/stripe/stripe-ruby)
5
- [![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-ruby/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-ruby?branch=master)
6
5
 
7
6
  The Stripe Ruby library provides convenient access to the Stripe API from
8
7
  applications written in the Ruby language. It includes a pre-defined set of
@@ -21,6 +20,9 @@ The library also provides other features. For example:
21
20
 
22
21
  See the [Ruby API docs](https://stripe.com/docs/api/ruby#intro).
23
22
 
23
+ See [video demonstrations][youtube-playlist] covering how to use the library.
24
+
25
+
24
26
  ## Installation
25
27
 
26
28
  You don't need this source code unless you want to modify the gem. If you just
@@ -250,6 +252,7 @@ a success or error. Receives `RequestEndEvent` with the following properties:
250
252
  - `path`: Request path. (`String`)
251
253
  - `user_data`: A hash on which users may have set arbitrary data in
252
254
  `request_begin`. See above for more information. (`Hash`)
255
+ - `request_id`. HTTP request identifier.
253
256
 
254
257
  #### Example
255
258
 
@@ -340,6 +343,7 @@ Update the bundled [stripe-mock] by editing the version number found in
340
343
  [idempotency-keys]: https://stripe.com/docs/api/ruby#idempotent_requests
341
344
  [stripe-mock]: https://github.com/stripe/stripe-mock
342
345
  [versioning]: https://stripe.com/docs/api/ruby#versioning
346
+ [youtube-playlist]: https://www.youtube.com/playlist?list=PLy1nL-pvL2M50RmP6ie-gdcSnfOuQCRYk
343
347
 
344
348
  <!--
345
349
  # vim: set tw=79:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 5.28.0
1
+ 5.38.0
@@ -6,6 +6,28 @@ module Stripe
6
6
  module ClassMethods
7
7
  def execute_resource_request(method, url,
8
8
  params = {}, opts = {})
9
+ execute_resource_request_internal(
10
+ :execute_request, method, url, params, opts
11
+ )
12
+ end
13
+
14
+ def execute_resource_request_stream(method, url,
15
+ params = {}, opts = {},
16
+ &read_body_chunk_block)
17
+ execute_resource_request_internal(
18
+ :execute_request_stream,
19
+ method,
20
+ url,
21
+ params,
22
+ opts,
23
+ &read_body_chunk_block
24
+ )
25
+ end
26
+
27
+ private def execute_resource_request_internal(client_request_method_sym,
28
+ method, url,
29
+ params, opts,
30
+ &read_body_chunk_block)
9
31
  params ||= {}
10
32
 
11
33
  error_on_invalid_params(params)
@@ -22,10 +44,12 @@ module Stripe
22
44
  client = headers.delete(:client)
23
45
  # Assume all remaining opts must be headers
24
46
 
25
- resp, opts[:api_key] = client.execute_request(
47
+ resp, opts[:api_key] = client.send(
48
+ client_request_method_sym,
26
49
  method, url,
27
50
  api_base: api_base, api_key: api_key,
28
- headers: headers, params: params
51
+ headers: headers, params: params,
52
+ &read_body_chunk_block
29
53
  )
30
54
 
31
55
  # Hash#select returns an array before 1.9
@@ -89,6 +113,15 @@ module Stripe
89
113
  self.class.execute_resource_request(method, url, params, opts)
90
114
  end
91
115
 
116
+ protected def execute_resource_request_stream(method, url,
117
+ params = {}, opts = {},
118
+ &read_body_chunk_block)
119
+ opts = @opts.merge(Util.normalize_opts(opts))
120
+ self.class.execute_resource_request_stream(
121
+ method, url, params, opts, &read_body_chunk_block
122
+ )
123
+ end
124
+
92
125
  # See notes on `alias` above.
93
126
  alias request execute_resource_request
94
127
  end
@@ -115,5 +115,13 @@ module Stripe
115
115
  Util.convert_to_stripe_object(resp.data, opts)
116
116
  end
117
117
  end
118
+
119
+ protected def request_stream(method:, path:, params:, opts: {},
120
+ &read_body_chunk_block)
121
+ resp, = execute_resource_request_stream(
122
+ method, path, params, opts, &read_body_chunk_block
123
+ )
124
+ resp
125
+ end
118
126
  end
119
127
  end
@@ -15,8 +15,10 @@ module Stripe
15
15
  # by `StripeClient` to determine whether a connection manager should be
16
16
  # garbage collected or not.
17
17
  attr_reader :last_used
18
+ attr_reader :config
18
19
 
19
- def initialize
20
+ def initialize(config = Stripe.config)
21
+ @config = config
20
22
  @active_connections = {}
21
23
  @last_used = Util.monotonic_time
22
24
 
@@ -64,7 +66,8 @@ module Stripe
64
66
 
65
67
  # Executes an HTTP request to the given URI with the given method. Also
66
68
  # allows a request body, headers, and query string to be specified.
67
- def execute_request(method, uri, body: nil, headers: nil, query: nil)
69
+ def execute_request(method, uri, body: nil, headers: nil, query: nil,
70
+ &block)
68
71
  # Perform some basic argument validation because it's easy to get
69
72
  # confused between strings and hashes for things like body and query
70
73
  # parameters.
@@ -90,8 +93,22 @@ module Stripe
90
93
  u.path
91
94
  end
92
95
 
96
+ method_name = method.to_s.upcase
97
+ has_response_body = method_name != "HEAD"
98
+ request = Net::HTTPGenericRequest.new(
99
+ method_name,
100
+ (body ? true : false),
101
+ has_response_body,
102
+ path,
103
+ headers
104
+ )
105
+
93
106
  @mutex.synchronize do
94
- connection.send_request(method.to_s.upcase, path, body, headers)
107
+ # The block parameter is special here. If a block is provided, the block
108
+ # is invoked with the Net::HTTPResponse. However, the body will not have
109
+ # been read yet in the block, and can be streamed by calling
110
+ # HTTPResponse#read_body.
111
+ connection.request(request, body, &block)
95
112
  end
96
113
  end
97
114
 
@@ -117,17 +134,17 @@ module Stripe
117
134
  # reused Go's default for `DefaultTransport`.
118
135
  connection.keep_alive_timeout = 30
119
136
 
120
- connection.open_timeout = Stripe.open_timeout
121
- connection.read_timeout = Stripe.read_timeout
137
+ connection.open_timeout = config.open_timeout
138
+ connection.read_timeout = config.read_timeout
122
139
  if connection.respond_to?(:write_timeout=)
123
- connection.write_timeout = Stripe.write_timeout
140
+ connection.write_timeout = config.write_timeout
124
141
  end
125
142
 
126
143
  connection.use_ssl = uri.scheme == "https"
127
144
 
128
- if Stripe.verify_ssl_certs
145
+ if config.verify_ssl_certs
129
146
  connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
130
- connection.cert_store = Stripe.ca_store
147
+ connection.cert_store = config.ca_store
131
148
  else
132
149
  connection.verify_mode = OpenSSL::SSL::VERIFY_NONE
133
150
  warn_ssl_verify_none
@@ -141,10 +158,10 @@ module Stripe
141
158
  # out those pieces to make passing them into a new connection a little less
142
159
  # ugly.
143
160
  private def proxy_parts
144
- if Stripe.proxy.nil?
161
+ if config.proxy.nil?
145
162
  [nil, nil, nil, nil]
146
163
  else
147
- u = URI.parse(Stripe.proxy)
164
+ u = URI.parse(config.proxy)
148
165
  [u.host, u.port, u.user, u.password]
149
166
  end
150
167
  end
@@ -69,9 +69,8 @@ module Stripe
69
69
  @values[:source]
70
70
  end
71
71
 
72
- # The type of error returned. One of `api_connection_error`, `api_error`,
73
- # `authentication_error`, `card_error`, `idempotency_error`,
74
- # `invalid_request_error`, or `rate_limit_error`.
72
+ # The type of error returned. One of `api_error`, `card_error`,
73
+ # `idempotency_error`, or `invalid_request_error`.
75
74
  def type
76
75
  @values[:type]
77
76
  end
@@ -32,6 +32,7 @@ module Stripe
32
32
  attr_reader :method
33
33
  attr_reader :num_retries
34
34
  attr_reader :path
35
+ attr_reader :request_id
35
36
 
36
37
  # Arbitrary user-provided data in the form of a Ruby hash that's passed
37
38
  # from subscribers on `request_begin` to subscribers on `request_end`.
@@ -40,12 +41,13 @@ module Stripe
40
41
  attr_reader :user_data
41
42
 
42
43
  def initialize(duration:, http_status:, method:, num_retries:, path:,
43
- user_data: nil)
44
+ request_id:, user_data: nil)
44
45
  @duration = duration
45
46
  @http_status = http_status
46
47
  @method = method
47
48
  @num_retries = num_retries
48
49
  @path = path
50
+ @request_id = request_id
49
51
  @user_data = user_data
50
52
  freeze
51
53
  end
data/lib/stripe/oauth.rb CHANGED
@@ -7,8 +7,8 @@ module Stripe
7
7
 
8
8
  def self.execute_resource_request(method, url, params, opts)
9
9
  opts = Util.normalize_opts(opts)
10
- opts[:client] ||= StripeClient.active_client
11
- opts[:api_base] ||= Stripe.connect_base
10
+ opts[:client] ||= opts[:client] || StripeClient.active_client
11
+ opts[:api_base] ||= opts[:client].config.connect_base
12
12
 
13
13
  super(method, url, params, opts)
14
14
  end
@@ -29,7 +29,8 @@ module Stripe
29
29
  end
30
30
 
31
31
  def self.authorize_url(params = {}, opts = {})
32
- base = opts[:connect_base] || Stripe.connect_base
32
+ client = opts[:client] || StripeClient.active_client
33
+ base = opts[:connect_base] || client.config.connect_base
33
34
 
34
35
  path = "/oauth/authorize"
35
36
  path = "/express" + path if opts[:express]
@@ -1,3 +1,4 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  # rubocop:disable Metrics/MethodLength
@@ -19,6 +20,7 @@ module Stripe
19
20
  Balance::OBJECT_NAME => Balance,
20
21
  BalanceTransaction::OBJECT_NAME => BalanceTransaction,
21
22
  BankAccount::OBJECT_NAME => BankAccount,
23
+ BillingPortal::Configuration::OBJECT_NAME => BillingPortal::Configuration,
22
24
  BillingPortal::Session::OBJECT_NAME => BillingPortal::Session,
23
25
  BitcoinReceiver::OBJECT_NAME => BitcoinReceiver,
24
26
  BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
@@ -40,6 +42,8 @@ module Stripe
40
42
  File::OBJECT_NAME => File,
41
43
  File::OBJECT_NAME_ALT => File,
42
44
  FileLink::OBJECT_NAME => FileLink,
45
+ Identity::VerificationReport::OBJECT_NAME => Identity::VerificationReport,
46
+ Identity::VerificationSession::OBJECT_NAME => Identity::VerificationSession,
43
47
  Invoice::OBJECT_NAME => Invoice,
44
48
  InvoiceItem::OBJECT_NAME => InvoiceItem,
45
49
  InvoiceLineItem::OBJECT_NAME => InvoiceLineItem,
@@ -62,6 +66,7 @@ module Stripe
62
66
  Price::OBJECT_NAME => Price,
63
67
  Product::OBJECT_NAME => Product,
64
68
  PromotionCode::OBJECT_NAME => PromotionCode,
69
+ Quote::OBJECT_NAME => Quote,
65
70
  Radar::EarlyFraudWarning::OBJECT_NAME => Radar::EarlyFraudWarning,
66
71
  Radar::ValueList::OBJECT_NAME => Radar::ValueList,
67
72
  Radar::ValueListItem::OBJECT_NAME => Radar::ValueListItem,
@@ -72,15 +77,16 @@ module Stripe
72
77
  Reporting::ReportType::OBJECT_NAME => Reporting::ReportType,
73
78
  Reversal::OBJECT_NAME => Reversal,
74
79
  Review::OBJECT_NAME => Review,
75
- SKU::OBJECT_NAME => SKU,
76
80
  SetupAttempt::OBJECT_NAME => SetupAttempt,
77
81
  SetupIntent::OBJECT_NAME => SetupIntent,
78
82
  Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
83
+ SKU::OBJECT_NAME => SKU,
79
84
  Source::OBJECT_NAME => Source,
80
85
  SourceTransaction::OBJECT_NAME => SourceTransaction,
81
86
  Subscription::OBJECT_NAME => Subscription,
82
87
  SubscriptionItem::OBJECT_NAME => SubscriptionItem,
83
88
  SubscriptionSchedule::OBJECT_NAME => SubscriptionSchedule,
89
+ TaxCode::OBJECT_NAME => TaxCode,
84
90
  TaxId::OBJECT_NAME => TaxId,
85
91
  TaxRate::OBJECT_NAME => TaxRate,
86
92
  Terminal::ConnectionToken::OBJECT_NAME => Terminal::ConnectionToken,
@@ -45,12 +45,8 @@ module Stripe
45
45
  end
46
46
 
47
47
  # @override To make id optional
48
- def self.retrieve(id = ARGUMENT_NOT_PROVIDED, opts = {})
49
- id = if id.equal?(ARGUMENT_NOT_PROVIDED)
50
- nil
51
- else
52
- Util.check_string_argument!(id)
53
- end
48
+ def self.retrieve(id = nil, opts = {})
49
+ Util.check_string_argument!(id) if id
54
50
 
55
51
  # Account used to be a singleton, where this method's signature was
56
52
  # `(opts={})`. For the sake of not breaking folks who pass in an OAuth
@@ -136,11 +132,10 @@ module Stripe
136
132
  client_id: client_id,
137
133
  stripe_user_id: id,
138
134
  }
135
+ opts = @opts.merge(Util.normalize_opts(opts))
139
136
  OAuth.deauthorize(params, opts)
140
137
  end
141
138
 
142
- ARGUMENT_NOT_PROVIDED = Object.new
143
-
144
139
  private def serialize_additional_owners(legal_entity, additional_owners)
145
140
  original_value =
146
141
  legal_entity
@@ -1,9 +1,10 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
4
5
  class ApplicationFeeRefund < APIResource
5
- include Stripe::APIOperations::Save
6
6
  extend Stripe::APIOperations::List
7
+ include Stripe::APIOperations::Save
7
8
 
8
9
  OBJECT_NAME = "fee_refund"
9
10
 
@@ -0,0 +1,14 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module BillingPortal
6
+ class Configuration < APIResource
7
+ extend Stripe::APIOperations::Create
8
+ extend Stripe::APIOperations::List
9
+ include Stripe::APIOperations::Save
10
+
11
+ OBJECT_NAME = "billing_portal.configuration"
12
+ end
13
+ end
14
+ end
@@ -1,9 +1,10 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
5
+ # Directly retrieving BitcoinTransactions is deprecated. Please use
6
+ # the Sources API instead: https://stripe.com/docs/sources/bitcoin
4
7
  class BitcoinTransaction < APIResource
5
- # Directly retrieving BitcoinTransactions is deprecated. Please use the
6
- # Sources API instead: https://stripe.com/docs/sources/bitcoin
7
8
  extend Stripe::APIOperations::List
8
9
 
9
10
  OBJECT_NAME = "bitcoin_transaction"
@@ -1,3 +1,4 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
@@ -26,7 +27,7 @@ module Stripe
26
27
  def self.update(_id, _params = nil, _opts = nil)
27
28
  raise NotImplementedError,
28
29
  "Capabilities cannot be updated without an account ID. Update a " \
29
- "capability using Account.update_capability('account_id', " \
30
+ "capability using `Account.update_capability('account_id', " \
30
31
  "'capability_id', update_params)`"
31
32
  end
32
33
  end
@@ -1,3 +1,4 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
@@ -28,9 +28,14 @@ module Stripe
28
28
  alias detach_source delete_source
29
29
  end
30
30
 
31
+ # Deletes a discount associated with the customer.
32
+ #
33
+ # Returns the deleted discount. The customer object is not updated,
34
+ # so you must call `refresh` on it to get a new version with the
35
+ # discount removed.
31
36
  def delete_discount
32
37
  resp, opts = execute_resource_request(:delete, resource_url + "/discount")
33
- initialize_from(resp.data, opts, true)
38
+ Util.convert_to_stripe_object(resp.data, opts)
34
39
  end
35
40
  end
36
41
  end
@@ -1,3 +1,4 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
@@ -18,13 +19,13 @@ module Stripe
18
19
  def self.retrieve(_id, _opts = {})
19
20
  raise NotImplementedError,
20
21
  "Customer Balance Transactions cannot be retrieved without a customer ID. " \
21
- "Retrieve a Customer Balance Transaction using Customer.retrieve_balance_transaction('cus_123', 'cbtxn_123')"
22
+ "Retrieve a Customer Balance Transaction using `Customer.retrieve_balance_transaction('cus_123', 'cbtxn_123')`"
22
23
  end
23
24
 
24
25
  def self.update(_id, _params = nil, _opts = nil)
25
26
  raise NotImplementedError,
26
27
  "Customer Balance Transactions cannot be retrieved without a customer ID. " \
27
- "Update a Customer Balance Transaction using Customer.update_balance_transaction('cus_123', 'cbtxn_123', params)"
28
+ "Update a Customer Balance Transaction using `Customer.update_balance_transaction('cus_123', 'cbtxn_123', params)`"
28
29
  end
29
30
  end
30
31
  end
@@ -25,8 +25,9 @@ module Stripe
25
25
  end
26
26
  end
27
27
 
28
+ config = opts[:client]&.config || Stripe.config
28
29
  opts = {
29
- api_base: Stripe.uploads_base,
30
+ api_base: config.uploads_base,
30
31
  content_type: MultipartEncoder::MULTIPART_FORM_DATA,
31
32
  }.merge(Util.normalize_opts(opts))
32
33
  super
@@ -0,0 +1,12 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Identity
6
+ class VerificationReport < APIResource
7
+ extend Stripe::APIOperations::List
8
+
9
+ OBJECT_NAME = "identity.verification_report"
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,35 @@
1
+ # File generated from our OpenAPI spec
2
+ # frozen_string_literal: true
3
+
4
+ module Stripe
5
+ module Identity
6
+ class VerificationSession < APIResource
7
+ extend Stripe::APIOperations::Create
8
+ extend Stripe::APIOperations::List
9
+ include Stripe::APIOperations::Save
10
+
11
+ OBJECT_NAME = "identity.verification_session"
12
+
13
+ custom_method :cancel, http_verb: :post
14
+ custom_method :redact, http_verb: :post
15
+
16
+ def cancel(params = {}, opts = {})
17
+ request_stripe_object(
18
+ method: :post,
19
+ path: resource_url + "/cancel",
20
+ params: params,
21
+ opts: opts
22
+ )
23
+ end
24
+
25
+ def redact(params = {}, opts = {})
26
+ request_stripe_object(
27
+ method: :post,
28
+ path: resource_url + "/redact",
29
+ params: params,
30
+ opts: opts
31
+ )
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,4 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
@@ -1,3 +1,4 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
@@ -1,3 +1,4 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe
@@ -1,3 +1,4 @@
1
+ # File generated from our OpenAPI spec
1
2
  # frozen_string_literal: true
2
3
 
3
4
  module Stripe