stripe 10.2.0 → 11.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +130 -21
- data/Gemfile +4 -1
- data/Makefile +8 -1
- data/OPENAPI_VERSION +1 -1
- data/README.md +29 -13
- data/VERSION +1 -1
- data/lib/stripe/api_operations/request.rb +15 -13
- data/lib/stripe/api_operations/save.rb +2 -2
- data/lib/stripe/api_operations/search.rb +5 -0
- data/lib/stripe/api_operations/singleton_save.rb +86 -0
- data/lib/stripe/api_resource.rb +13 -4
- data/lib/stripe/api_resource_test_helpers.rb +6 -2
- data/lib/stripe/api_version.rb +1 -1
- data/lib/stripe/list_object.rb +3 -0
- data/lib/stripe/object_types.rb +133 -119
- data/lib/stripe/resources/account.rb +97 -15
- data/lib/stripe/resources/account_link.rb +8 -0
- data/lib/stripe/resources/account_session.rb +8 -0
- data/lib/stripe/resources/apple_pay_domain.rb +43 -0
- data/lib/stripe/resources/application_fee.rb +8 -0
- data/lib/stripe/resources/application_fee_refund.rb +3 -1
- data/lib/stripe/resources/apps/secret.rb +15 -0
- data/lib/stripe/resources/balance.rb +3 -0
- data/lib/stripe/resources/balance_transaction.rb +15 -0
- data/lib/stripe/resources/bank_account.rb +34 -3
- data/lib/stripe/resources/billing/meter.rb +83 -0
- data/lib/stripe/resources/billing/meter_event.rb +27 -0
- data/lib/stripe/resources/billing/meter_event_adjustment.rb +26 -0
- data/lib/stripe/resources/billing/meter_event_summary.rb +15 -0
- data/lib/stripe/resources/billing_portal/configuration.rb +33 -0
- data/lib/stripe/resources/billing_portal/session.rb +13 -0
- data/lib/stripe/resources/capability.rb +3 -1
- data/lib/stripe/resources/card.rb +30 -0
- data/lib/stripe/resources/cash_balance.rb +3 -0
- data/lib/stripe/resources/charge.rb +39 -1
- data/lib/stripe/resources/checkout/session.rb +36 -5
- data/lib/stripe/resources/climate/order.rb +33 -0
- data/lib/stripe/resources/climate/product.rb +13 -0
- data/lib/stripe/resources/climate/supplier.rb +13 -0
- data/lib/stripe/resources/confirmation_token.rb +39 -0
- data/lib/stripe/resources/country_spec.rb +8 -0
- data/lib/stripe/resources/coupon.rb +45 -0
- data/lib/stripe/resources/credit_note.rb +47 -7
- data/lib/stripe/resources/credit_note_line_item.rb +3 -0
- data/lib/stripe/resources/customer.rb +89 -26
- data/lib/stripe/resources/customer_balance_transaction.rb +3 -1
- data/lib/stripe/resources/customer_cash_balance_transaction.rb +3 -2
- data/lib/stripe/resources/customer_session.rb +25 -0
- data/lib/stripe/resources/discount.rb +3 -0
- data/lib/stripe/resources/dispute.rb +26 -0
- data/lib/stripe/resources/entitlements/active_entitlement.rb +26 -0
- data/lib/stripe/resources/entitlements/feature.rb +49 -0
- data/lib/stripe/resources/ephemeral_key.rb +23 -0
- data/lib/stripe/resources/event.rb +10 -2
- data/lib/stripe/resources/exchange_rate.rb +8 -0
- data/lib/stripe/resources/file.rb +12 -1
- data/lib/stripe/resources/file_link.rb +23 -0
- data/lib/stripe/resources/financial_connections/account.rb +66 -7
- data/lib/stripe/resources/financial_connections/account_owner.rb +3 -0
- data/lib/stripe/resources/financial_connections/account_ownership.rb +3 -0
- data/lib/stripe/resources/financial_connections/session.rb +13 -0
- data/lib/stripe/resources/financial_connections/transaction.rb +26 -0
- data/lib/stripe/resources/forwarding/request.rb +52 -0
- data/lib/stripe/resources/funding_instructions.rb +3 -0
- data/lib/stripe/resources/identity/verification_report.rb +13 -0
- data/lib/stripe/resources/identity/verification_session.rb +90 -4
- data/lib/stripe/resources/invoice.rb +113 -23
- data/lib/stripe/resources/invoice_item.rb +43 -0
- data/lib/stripe/resources/invoice_line_item.rb +18 -0
- data/lib/stripe/resources/issuing/authorization.rb +76 -22
- data/lib/stripe/resources/issuing/card.rb +50 -16
- data/lib/stripe/resources/issuing/cardholder.rb +33 -0
- data/lib/stripe/resources/issuing/dispute.rb +35 -0
- data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
- data/lib/stripe/resources/issuing/physical_bundle.rb +26 -0
- data/lib/stripe/resources/issuing/token.rb +18 -0
- data/lib/stripe/resources/issuing/transaction.rb +30 -0
- data/lib/stripe/resources/line_item.rb +3 -0
- data/lib/stripe/resources/login_link.rb +4 -1
- data/lib/stripe/resources/mandate.rb +3 -0
- data/lib/stripe/resources/payment_intent.rb +184 -25
- data/lib/stripe/resources/payment_link.rb +25 -0
- data/lib/stripe/resources/payment_method.rb +57 -4
- data/lib/stripe/resources/payment_method_configuration.rb +33 -0
- data/lib/stripe/resources/payment_method_domain.rb +45 -0
- data/lib/stripe/resources/payout.rb +39 -4
- data/lib/stripe/resources/person.rb +5 -4
- data/lib/stripe/resources/plan.rb +43 -0
- data/lib/stripe/resources/price.rb +24 -1
- data/lib/stripe/resources/product.rb +47 -1
- data/lib/stripe/resources/product_feature.rb +13 -0
- data/lib/stripe/resources/promotion_code.rb +23 -0
- data/lib/stripe/resources/quote.rb +67 -32
- data/lib/stripe/resources/radar/early_fraud_warning.rb +13 -0
- data/lib/stripe/resources/radar/value_list.rb +53 -0
- data/lib/stripe/resources/radar/value_list_item.rb +43 -0
- data/lib/stripe/resources/refund.rb +46 -0
- data/lib/stripe/resources/reporting/report_run.rb +23 -0
- data/lib/stripe/resources/reporting/report_type.rb +13 -0
- data/lib/stripe/resources/reversal.rb +4 -2
- data/lib/stripe/resources/review.rb +10 -0
- data/lib/stripe/resources/setup_attempt.rb +8 -0
- data/lib/stripe/resources/setup_intent.rb +72 -10
- data/lib/stripe/resources/shipping_rate.rb +23 -0
- data/lib/stripe/resources/sigma/scheduled_query_run.rb +13 -0
- data/lib/stripe/resources/source.rb +23 -1
- data/lib/stripe/resources/source_transaction.rb +3 -0
- data/lib/stripe/resources/subscription.rb +81 -13
- data/lib/stripe/resources/subscription_item.rb +54 -1
- data/lib/stripe/resources/subscription_schedule.rb +41 -4
- data/lib/stripe/resources/tax/calculation.rb +15 -0
- data/lib/stripe/resources/tax/calculation_line_item.rb +3 -0
- data/lib/stripe/resources/tax/registration.rb +35 -0
- data/lib/stripe/resources/tax/settings.rb +4 -2
- data/lib/stripe/resources/tax/transaction.rb +15 -8
- data/lib/stripe/resources/tax/transaction_line_item.rb +3 -0
- data/lib/stripe/resources/tax_code.rb +8 -0
- data/lib/stripe/resources/tax_id.rb +30 -12
- data/lib/stripe/resources/tax_rate.rb +23 -0
- data/lib/stripe/resources/terminal/configuration.rb +53 -0
- data/lib/stripe/resources/terminal/connection_token.rb +13 -0
- data/lib/stripe/resources/terminal/location.rb +54 -0
- data/lib/stripe/resources/terminal/reader.rb +80 -12
- data/lib/stripe/resources/test_helpers/test_clock.rb +45 -0
- data/lib/stripe/resources/token.rb +10 -1
- data/lib/stripe/resources/topup.rb +25 -0
- data/lib/stripe/resources/transfer.rb +26 -1
- data/lib/stripe/resources/treasury/credit_reversal.rb +23 -0
- data/lib/stripe/resources/treasury/debit_reversal.rb +23 -0
- data/lib/stripe/resources/treasury/financial_account.rb +42 -5
- data/lib/stripe/resources/treasury/financial_account_features.rb +3 -0
- data/lib/stripe/resources/treasury/inbound_transfer.rb +44 -10
- data/lib/stripe/resources/treasury/outbound_payment.rb +44 -10
- data/lib/stripe/resources/treasury/outbound_transfer.rb +44 -10
- data/lib/stripe/resources/treasury/received_credit.rb +17 -0
- data/lib/stripe/resources/treasury/received_debit.rb +17 -0
- data/lib/stripe/resources/treasury/transaction.rb +13 -0
- data/lib/stripe/resources/treasury/transaction_entry.rb +13 -0
- data/lib/stripe/resources/usage_record.rb +5 -0
- data/lib/stripe/resources/usage_record_summary.rb +3 -0
- data/lib/stripe/resources/webhook_endpoint.rb +55 -2
- data/lib/stripe/resources.rb +13 -0
- data/lib/stripe/search_result_object.rb +4 -1
- data/lib/stripe/singleton_api_resource.rb +20 -3
- data/lib/stripe/stripe_client.rb +22 -20
- data/lib/stripe/stripe_object.rb +8 -3
- data/lib/stripe/util.rb +3 -3
- data/lib/stripe/version.rb +1 -1
- data/lib/stripe.rb +1 -0
- data/stripe.gemspec +5 -3
- metadata +19 -5
- /data/{bin → exe}/stripe-console +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d194f568d73d4b7aad08e89250b62192c4577cc97da642287a83b487f3d3e6ce
|
4
|
+
data.tar.gz: e4ba60356e5de058254e19f71ca72f665adedbc1c9fa7cc85bcac7754ac04e0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6cbcc13a8f5d0549d8e910f437900f5e52889df9d41f919d617ade29a463f5a101baecf9c3d25ed19f1fdcd1da91e4e0103234f8ba701bc622e8083a1085513
|
7
|
+
data.tar.gz: '08feaf01a76272eb6d9923f88988ef68808b24ced8d9df06c38347809e92dd0223e141ba1078bbf367b5d0f2f4b8e934ae36b82ef6eacd71088d8d0a4a0184be'
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,113 @@
|
|
1
1
|
# Changelog
|
2
|
+
## 11.3.0 - 2024-05-02
|
3
|
+
* [#1387](https://github.com/stripe/stripe-ruby/pull/1387) Update generated code
|
4
|
+
|
5
|
+
* [#1392](https://github.com/stripe/stripe-ruby/pull/1392) Deprecate Ruby methods based on OpenAPI spec
|
6
|
+
- Mark as deprecated the `approve` and `decline` methods in `lib/stripe/resources/issuing/authorization.rb`. Instead, [respond directly to the webhook request to approve an authorization](https://stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).
|
7
|
+
* [#1391](https://github.com/stripe/stripe-ruby/pull/1391) Add Ruby 3.3 to CI test matrix
|
8
|
+
|
9
|
+
## 11.2.0 - 2024-04-18
|
10
|
+
* [#1385](https://github.com/stripe/stripe-ruby/pull/1385) Update generated code
|
11
|
+
* Add support for `create_preview` method on resource `Invoice`
|
12
|
+
|
13
|
+
## 11.1.0 - 2024-04-16
|
14
|
+
* [#1379](https://github.com/stripe/stripe-ruby/pull/1379) Update generated code
|
15
|
+
* Add support for new resource `Entitlements.ActiveEntitlementSummary`
|
16
|
+
|
17
|
+
## 11.0.0 - 2024-04-10
|
18
|
+
* [#1374](https://github.com/stripe/stripe-ruby/pull/1374)
|
19
|
+
|
20
|
+
* This release changes the pinned API version to `2024-04-10`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-04-10) and carefully review the API changes before upgrading.
|
21
|
+
|
22
|
+
### ⚠️ Breaking changes
|
23
|
+
|
24
|
+
* When no `x-stripe-should-retry` header is set in the response, the library now retries all requests with `status >= 500`, not just non-POST methods.
|
25
|
+
|
26
|
+
## 10.15.0 - 2024-04-09
|
27
|
+
* [#1377](https://github.com/stripe/stripe-ruby/pull/1377) Add last_response to StripeObject
|
28
|
+
* Users can now retrieve raw response from the returned resource, using the `last_response` property. See [README](https://github.com/stripe/stripe-ruby/blob/master/README.md) for an example.
|
29
|
+
* [#1372](https://github.com/stripe/stripe-ruby/pull/1372) Update generated code
|
30
|
+
* Add support for new resources `Entitlements.ActiveEntitlement` and `Entitlements.Feature`
|
31
|
+
* Add support for `list` and `retrieve` methods on resource `ActiveEntitlement`
|
32
|
+
* Add support for `create`, `list`, `retrieve`, and `update` methods on resource `Feature`
|
33
|
+
* [#1366](https://github.com/stripe/stripe-ruby/pull/1366) Move executables to `exe` folder
|
34
|
+
|
35
|
+
## 10.14.0 - 2024-03-28
|
36
|
+
* [#1369](https://github.com/stripe/stripe-ruby/pull/1369) Update generated code
|
37
|
+
* Add support for new resources `Billing.MeterEventAdjustment`, `Billing.MeterEvent`, and `Billing.Meter`
|
38
|
+
* Add support for `create`, `deactivate`, `list`, `reactivate`, `retrieve`, and `update` methods on resource `Meter`
|
39
|
+
* Add support for `create` method on resources `MeterEventAdjustment` and `MeterEvent`
|
40
|
+
|
41
|
+
## 10.13.0 - 2024-03-21
|
42
|
+
* [#1367](https://github.com/stripe/stripe-ruby/pull/1367) Update generated code
|
43
|
+
* Add support for new resources `ConfirmationToken` and `Forwarding.Request`
|
44
|
+
* Add support for `retrieve` method on resource `ConfirmationToken`
|
45
|
+
* Add support for `create`, `list`, and `retrieve` methods on resource `Request`
|
46
|
+
* [#1362](https://github.com/stripe/stripe-ruby/pull/1362) Exclude sorbet directory and tapioca script when packing gem
|
47
|
+
|
48
|
+
## 10.12.0 - 2024-03-14
|
49
|
+
* [#1359](https://github.com/stripe/stripe-ruby/pull/1359) Update generated code
|
50
|
+
* Add support for new resources `Issuing.PersonalizationDesign` and `Issuing.PhysicalBundle`
|
51
|
+
* Add support for `create`, `list`, `retrieve`, and `update` methods on resource `PersonalizationDesign`
|
52
|
+
* Add support for `list` and `retrieve` methods on resource `PhysicalBundle`
|
53
|
+
* [#1354](https://github.com/stripe/stripe-ruby/pull/1354) Refactor after SDK based generation pattern
|
54
|
+
* [#1347](https://github.com/stripe/stripe-ruby/pull/1347) Reorder methods with lexographical sort
|
55
|
+
* [#1355](https://github.com/stripe/stripe-ruby/pull/1355) Disable Metrics/ClassLength
|
56
|
+
* [#1351](https://github.com/stripe/stripe-ruby/pull/1351) Update CHANGELOG.md
|
57
|
+
|
58
|
+
## 10.11.0 - 2024-02-29
|
59
|
+
* [#1348](https://github.com/stripe/stripe-ruby/pull/1348) Use sorbet gem instead of sorbet-static
|
60
|
+
* [#1342](https://github.com/stripe/stripe-ruby/pull/1342) Update generated code
|
61
|
+
* Add `list_refunds` and `retrieve_refund` methods on resource `Charge`.
|
62
|
+
* [#1345](https://github.com/stripe/stripe-ruby/pull/1345) Update README to use add_beta_version
|
63
|
+
|
64
|
+
## 10.10.0 - 2024-02-22
|
65
|
+
* [#1336](https://github.com/stripe/stripe-ruby/pull/1336) Update generated code
|
66
|
+
- Add `InvoiceLineItem.update` method.
|
67
|
+
* [#1334](https://github.com/stripe/stripe-ruby/pull/1334) Add TaxIds API
|
68
|
+
* Add support for `all`, `create`, and `retrieve` methods on resource `TaxId`
|
69
|
+
* The `delete` method now sends a DELETE request to `/v1/tax_ids/{id}` instead of `/v1/customers/{customer}/tax_ids/{id}`. The endpoints are functionally the same when operating on a Customer Tax ID.
|
70
|
+
* The `resource_url` method on `TaxId` now returns the top-level `/v1/tax_ids/{id}` path instead of the `/v1/customers/{customer}/tax_ids/{id}` path.
|
71
|
+
|
72
|
+
## 10.9.0 - 2024-02-15
|
73
|
+
* [#1329](https://github.com/stripe/stripe-ruby/pull/1329) Update generated code
|
74
|
+
* Fixed bug where `TaxId` resource `delete` method sent request to wrong URL (https://github.com/stripe/stripe-ruby/issues/1333)
|
75
|
+
* [#1324](https://github.com/stripe/stripe-ruby/pull/1324) Start running Sorbet in CI
|
76
|
+
* [#1327](https://github.com/stripe/stripe-ruby/pull/1327) Add methods for dynamically referenced constants
|
77
|
+
|
78
|
+
## 10.8.0 - 2024-02-08
|
79
|
+
* [#1322](https://github.com/stripe/stripe-ruby/pull/1322) Update generated code
|
80
|
+
* [#1323](https://github.com/stripe/stripe-ruby/pull/1323) Extract other CRUDL api operations from mixins
|
81
|
+
* Extract more CRUDL operations, namely `create`, `delete`, `update`, and `list` into the resources. These methods will no longer rely on the APIOperation mixins.
|
82
|
+
* [#1314](https://github.com/stripe/stripe-ruby/pull/1314) Update mocha gem to 1.16
|
83
|
+
|
84
|
+
## 10.7.1 - 2024-02-05
|
85
|
+
* [#1320](https://github.com/stripe/stripe-ruby/pull/1320) Remove spurious _search deprecation messages (https://github.com/stripe/stripe-ruby/issues/1319)
|
86
|
+
|
87
|
+
## 10.7.0 - 2024-02-01
|
88
|
+
* [#1317](https://github.com/stripe/stripe-ruby/pull/1317) Remove list method in child resources
|
89
|
+
* Removes list method mixin from child resources, as these methods always return `InvalidRequestError` and never succeed
|
90
|
+
* [#1311](https://github.com/stripe/stripe-ruby/pull/1311) Use the deprecation gem in search and clean up usage of the gem
|
91
|
+
|
92
|
+
## 10.6.0 - 2024-01-12
|
93
|
+
* [#1310](https://github.com/stripe/stripe-ruby/pull/1310) Update generated code
|
94
|
+
* Add support for new resource `CustomerSession`
|
95
|
+
* Add support for `create` method on resource `CustomerSession`
|
96
|
+
|
97
|
+
## 10.5.0 - 2024-01-04
|
98
|
+
* [#1306](https://github.com/stripe/stripe-ruby/pull/1306) Update generated code
|
99
|
+
* Add support for `retrieve` method on resource `Tax.Registration`
|
100
|
+
|
101
|
+
## 10.4.0 - 2023-12-22
|
102
|
+
* [#1303](https://github.com/stripe/stripe-ruby/pull/1303) Update generated code
|
103
|
+
* Add support for new resource `FinancialConnections.Transaction`
|
104
|
+
* Add support for `list` and `retrieve` methods on resource `Transaction`
|
105
|
+
* Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account`
|
106
|
+
* [#1304](https://github.com/stripe/stripe-ruby/pull/1304) Add support for updatable singleton resources
|
107
|
+
|
108
|
+
## 10.3.0 - 2023-12-14
|
109
|
+
* [#1294](https://github.com/stripe/stripe-ruby/pull/1294) Support sending parameters inside singleton retrieve
|
110
|
+
|
2
111
|
## 10.2.0 - 2023-11-30
|
3
112
|
* [#1292](https://github.com/stripe/stripe-ruby/pull/1292) Update generated code
|
4
113
|
* Add support for new resources `Climate.Order`, `Climate.Product`, and `Climate.Supplier`
|
@@ -53,32 +162,32 @@
|
|
53
162
|
**⚠️ ACTION REQUIRED: the breaking change in this release likely affects you ⚠️**
|
54
163
|
|
55
164
|
* [#1253](https://github.com/stripe/stripe-ruby/pull/1253) [#1260](https://github.com/stripe/stripe-ruby/pull/1260) Pin latest API version as the default
|
56
|
-
|
165
|
+
|
57
166
|
In this release, Stripe API Version `2023-08-16` (the latest at time of release) will be sent by default on all requests. This is a significant change with wide ramifications. The API version affects the properties you see on responses, the parameters you are allowed to send on requests, and so on. The previous default was to use your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version).
|
58
|
-
|
167
|
+
|
59
168
|
To successfully upgrade to stripe-ruby v9, you must either
|
60
|
-
|
169
|
+
|
61
170
|
1. **(Recommended) Upgrade your integration to be compatible with API Version `2023-08-16`.**
|
62
|
-
|
171
|
+
|
63
172
|
Please read the API Changelog carefully for each API Version from `2023-08-16` back to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). Determine if you are using any of the APIs that have changed in a breaking way, and adjust your integration accordingly. Carefully test your changes with Stripe [Test Mode](https://stripe.com/docs/keys#test-live-modes) before deploying them to production.
|
64
|
-
|
173
|
+
|
65
174
|
You can read the [v9 migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v9) for more detailed instructions.
|
66
175
|
2. **(Alternative option) Specify a version other than `2023-08-16` when initializing `stripe-ruby`.**
|
67
|
-
|
176
|
+
|
68
177
|
If you were previously initializing stripe-ruby without an explicit API Version, you can postpone modifying your integration by specifying a version equal to your [Stripe account's default API version](https://stripe.com/docs/development/dashboard/request-logs#view-your-default-api-version). For example:
|
69
|
-
|
178
|
+
|
70
179
|
```diff
|
71
180
|
require 'stripe'
|
72
181
|
Stripe.api_key = "sk_test_..."
|
73
182
|
+ Stripe.api_version = '2020-08-27'
|
74
183
|
```
|
75
|
-
|
184
|
+
|
76
185
|
If you were already initializing stripe-ruby with an explicit API Version, upgrading to v9 will not affect your integration.
|
77
|
-
|
186
|
+
|
78
187
|
Read the [v9 migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v9) for more details.
|
79
|
-
|
188
|
+
|
80
189
|
Going forward, each major release of this library will be *pinned* by default to the latest Stripe API Version at the time of release.
|
81
|
-
|
190
|
+
|
82
191
|
That is, instead of upgrading stripe-ruby and separately upgrading your Stripe API Version through the Stripe Dashboard. whenever you upgrade major versions of stripe-ruby, you should also upgrade your integration to be compatible with the latest Stripe API version.
|
83
192
|
|
84
193
|
## 8.7.0 - 2023-08-10
|
@@ -105,7 +214,7 @@
|
|
105
214
|
|
106
215
|
* [#1225](https://github.com/stripe/stripe-ruby/pull/1225) Downgrade jaro_winkler
|
107
216
|
* [#1219](https://github.com/stripe/stripe-ruby/pull/1219) Update generated code
|
108
|
-
|
217
|
+
|
109
218
|
Documentation updates.
|
110
219
|
* [#1215](https://github.com/stripe/stripe-ruby/pull/1215) Update generated code
|
111
220
|
|
@@ -153,7 +262,7 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
153
262
|
refund = Stripe::Refund.retrieve("re_123")
|
154
263
|
refund.description = "Refund description"
|
155
264
|
refund.save
|
156
|
-
|
265
|
+
|
157
266
|
# after
|
158
267
|
Stripe::Refund.update("re_123", description: "Refund description")
|
159
268
|
```
|
@@ -217,7 +326,7 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
217
326
|
* [#1072](https://github.com/stripe/stripe-ruby/pull/1072) Trigger workflows on beta branches
|
218
327
|
* [#1071](https://github.com/stripe/stripe-ruby/pull/1071) Use request_stripe_object for all requests
|
219
328
|
* [#1070](https://github.com/stripe/stripe-ruby/pull/1070) API Updates
|
220
|
-
|
329
|
+
|
221
330
|
Switch from using meta-programing to generating explicit methods for custom methods.
|
222
331
|
* [#1069](https://github.com/stripe/stripe-ruby/pull/1069) chore: Stop special implementation of Account.persons method.
|
223
332
|
|
@@ -233,15 +342,15 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
233
342
|
* Add support for new resources `Treasury.CreditReversal`, `Treasury.DebitReversal`, `Treasury.FinancialAccountFeatures`, `Treasury.FinancialAccount`, `Treasury.FlowDetails`, `Treasury.InboundTransfer`, `Treasury.OutboundPayment`, `Treasury.OutboundTransfer`, `Treasury.ReceivedCredit`, `Treasury.ReceivedDebit`, `Treasury.TransactionEntry`, and `Treasury.Transaction`
|
234
343
|
* Add support for `retrieve_payment_method` method on resource `Customer`
|
235
344
|
* Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account`
|
236
|
-
|
237
|
-
|
345
|
+
|
346
|
+
|
238
347
|
|
239
348
|
## 6.0.0 - 2022-05-09
|
240
349
|
* [#1056](https://github.com/stripe/stripe-ruby/pull/1056) API Updates
|
241
350
|
Major version release. The [migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-Guide-for-v6) contains more information.
|
242
|
-
|
351
|
+
|
243
352
|
(⚠️ = breaking changes):
|
244
|
-
* ⚠️ Replace the legacy `Order` API with the new `Order` API.
|
353
|
+
* ⚠️ Replace the legacy `Order` API with the new `Order` API.
|
245
354
|
* New methods: `cancel`, `list_line_items`, `reopen`, and `submit`
|
246
355
|
* Removed methods: `pay` and `return_order`
|
247
356
|
* Removed resources: `OrderItem` and `OrderReturn`
|
@@ -250,7 +359,7 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
250
359
|
## 5.55.0 - 2022-05-05
|
251
360
|
* [#1055](https://github.com/stripe/stripe-ruby/pull/1055) API Updates
|
252
361
|
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
|
253
|
-
|
362
|
+
|
254
363
|
|
255
364
|
## 5.54.0 - 2022-05-03
|
256
365
|
* [#1053](https://github.com/stripe/stripe-ruby/pull/1053) API Updates
|
@@ -261,7 +370,7 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
261
370
|
* Add support for `expire` test helper method on resource `Refund`
|
262
371
|
|
263
372
|
## 5.52.0 - 2022-04-18
|
264
|
-
* [#1046](https://github.com/stripe/stripe-ruby/pull/1046) [#1047](https://github.com/stripe/stripe-ruby/pull/1047) API Updates
|
373
|
+
* [#1046](https://github.com/stripe/stripe-ruby/pull/1046) [#1047](https://github.com/stripe/stripe-ruby/pull/1047) API Updates
|
265
374
|
* Add support for new resources `FundingInstructions` and `Terminal.Configuration`
|
266
375
|
|
267
376
|
## 5.51.0 - 2022-04-15
|
@@ -283,7 +392,7 @@ Breaking changes that arose during code generation of the library that we postpo
|
|
283
392
|
* [#1040](https://github.com/stripe/stripe-ruby/pull/1040) API Updates
|
284
393
|
* Add support for Search API
|
285
394
|
* Add support for `search` method on resources `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription`
|
286
|
-
|
395
|
+
|
287
396
|
* [#1034](https://github.com/stripe/stripe-ruby/pull/1034) Add supporting classes for test helper generation
|
288
397
|
|
289
398
|
## 5.46.0 - 2022-03-23
|
data/Gemfile
CHANGED
@@ -6,7 +6,7 @@ gemspec
|
|
6
6
|
|
7
7
|
group :development do
|
8
8
|
gem "coveralls_reborn", "~> 0.25.0" if RUBY_VERSION >= "3.1"
|
9
|
-
gem "mocha", "~>
|
9
|
+
gem "mocha", "~> 1.16.0"
|
10
10
|
gem "rack", ">= 2.0.6"
|
11
11
|
gem "rake"
|
12
12
|
|
@@ -31,6 +31,9 @@ group :development do
|
|
31
31
|
# don't install on truffleruby
|
32
32
|
gem "jaro_winkler", "1.5.4" unless RUBY_ENGINE == "truffleruby"
|
33
33
|
|
34
|
+
gem "sorbet"
|
35
|
+
gem "tapioca"
|
36
|
+
|
34
37
|
platforms :mri do
|
35
38
|
gem "byebug"
|
36
39
|
gem "pry"
|
data/Makefile
CHANGED
@@ -5,9 +5,16 @@ update-version:
|
|
5
5
|
|
6
6
|
codegen-format:
|
7
7
|
bundle install --quiet
|
8
|
-
bundle exec rubocop -o /dev/null --
|
8
|
+
bundle exec rubocop -o /dev/null --autocorrect
|
9
9
|
|
10
10
|
ci-test:
|
11
11
|
bundle install && bundle exec rake test
|
12
|
+
@version=$$(ruby -e "puts RUBY_VERSION.split('.')[0..1].join.to_i"); \
|
13
|
+
if [ $$version -ge 27 ]; then \
|
14
|
+
echo "Ruby version >= 2.7, continue with srb tc"; \
|
15
|
+
bundle exec srb tc; \
|
16
|
+
else \
|
17
|
+
echo "Ruby version < 2.7, skipping srb tc"; \
|
18
|
+
fi
|
12
19
|
|
13
20
|
test: ci-test
|
data/OPENAPI_VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
v1005
|
data/README.md
CHANGED
@@ -23,7 +23,6 @@ See the [Ruby API docs](https://stripe.com/docs/api?lang=ruby).
|
|
23
23
|
|
24
24
|
See [video demonstrations][youtube-playlist] covering how to use the library.
|
25
25
|
|
26
|
-
|
27
26
|
## Installation
|
28
27
|
|
29
28
|
You don't need this source code unless you want to modify the gem. If you just
|
@@ -131,17 +130,33 @@ Keep in mind that there are different method signatures depending on the action:
|
|
131
130
|
`retrieve(id, opts)`. In addition, it will accept a Hash for the `id` param but will extract the
|
132
131
|
`id` key out and use the others as options.
|
133
132
|
|
133
|
+
### Accessing resource properties
|
134
|
+
|
135
|
+
Both indexer and accessors can be used to retrieve values of resource properties.
|
136
|
+
|
137
|
+
```ruby
|
138
|
+
customer = Stripe::Customer.retrieve('cus_123456789')
|
139
|
+
puts customer['id']
|
140
|
+
puts customer.id
|
141
|
+
```
|
142
|
+
|
143
|
+
NOTE: If the resource property is not defined, the accessors will raise an exception, while the indexer will return `nil`.
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
customer = Stripe::Customer.retrieve('cus_123456789')
|
147
|
+
puts customer['unknown'] # nil
|
148
|
+
puts customer.unknown # raises NoMethodError
|
149
|
+
```
|
150
|
+
|
134
151
|
### Accessing a response object
|
135
152
|
|
136
|
-
Get access to response objects by
|
137
|
-
method:
|
153
|
+
Get access to response objects by using the `last_response` property of the returned resource:
|
138
154
|
|
139
155
|
```ruby
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
puts resp.request_id
|
156
|
+
customer = Stripe::Customer.retrieve('cus_123456789')
|
157
|
+
|
158
|
+
print(customer.last_response.http_status) # to retrieve status code
|
159
|
+
print(customer.last_response.http_headers) # to retrieve headers
|
145
160
|
```
|
146
161
|
|
147
162
|
### Configuring a proxy
|
@@ -291,10 +306,11 @@ Stripe.set_app_info('MyAwesomePlugin', version: '1.2.34', url: 'https://myawesom
|
|
291
306
|
This information is passed along when the library makes calls to the Stripe
|
292
307
|
API.
|
293
308
|
|
294
|
-
###
|
309
|
+
### Telemetry
|
295
310
|
|
296
|
-
By default, the library sends request latency
|
297
|
-
numbers help Stripe improve the overall latency of its API for all users
|
311
|
+
By default, the library sends telemetry to Stripe regarding request latency and feature usage. These
|
312
|
+
numbers help Stripe improve the overall latency of its API for all users, and
|
313
|
+
improve popular features.
|
298
314
|
|
299
315
|
You can disable this behavior if you prefer:
|
300
316
|
|
@@ -317,10 +333,10 @@ gem install stripe -v 7.1.0.pre.beta.2
|
|
317
333
|
|
318
334
|
We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.
|
319
335
|
|
320
|
-
If your beta feature requires a `Stripe-Version` header to be sent,
|
336
|
+
If your beta feature requires a `Stripe-Version` header to be sent, set the `Stripe.api_version` field using `Stripe.add_beta_version`:
|
321
337
|
|
322
338
|
```python
|
323
|
-
Stripe.
|
339
|
+
Stripe.add_beta_version("feature_beta", "v3")
|
324
340
|
```
|
325
341
|
|
326
342
|
## Support
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
11.3.0
|
@@ -5,14 +5,14 @@ module Stripe
|
|
5
5
|
module Request
|
6
6
|
module ClassMethods
|
7
7
|
def execute_resource_request(method, url,
|
8
|
-
params = {}, opts = {})
|
8
|
+
params = {}, opts = {}, usage = [])
|
9
9
|
execute_resource_request_internal(
|
10
|
-
:execute_request, method, url, params, opts
|
10
|
+
:execute_request, method, url, params, opts, usage
|
11
11
|
)
|
12
12
|
end
|
13
13
|
|
14
14
|
def execute_resource_request_stream(method, url,
|
15
|
-
params = {}, opts = {},
|
15
|
+
params = {}, opts = {}, usage = [],
|
16
16
|
&read_body_chunk_block)
|
17
17
|
execute_resource_request_internal(
|
18
18
|
:execute_request_stream,
|
@@ -20,18 +20,19 @@ module Stripe
|
|
20
20
|
url,
|
21
21
|
params,
|
22
22
|
opts,
|
23
|
+
usage,
|
23
24
|
&read_body_chunk_block
|
24
25
|
)
|
25
26
|
end
|
26
27
|
|
27
|
-
private def request_stripe_object(method:, path:, params:, opts: {})
|
28
|
-
resp, opts = execute_resource_request(method, path, params, opts)
|
29
|
-
Util.convert_to_stripe_object_with_params(resp.data, params, opts)
|
28
|
+
private def request_stripe_object(method:, path:, params:, opts: {}, usage: [])
|
29
|
+
resp, opts = execute_resource_request(method, path, params, opts, usage)
|
30
|
+
Util.convert_to_stripe_object_with_params(resp.data, params, opts, resp)
|
30
31
|
end
|
31
32
|
|
32
33
|
private def execute_resource_request_internal(client_request_method_sym,
|
33
34
|
method, url,
|
34
|
-
params, opts,
|
35
|
+
params, opts, usage,
|
35
36
|
&read_body_chunk_block)
|
36
37
|
params ||= {}
|
37
38
|
|
@@ -53,7 +54,7 @@ module Stripe
|
|
53
54
|
client_request_method_sym,
|
54
55
|
method, url,
|
55
56
|
api_base: api_base, api_key: api_key,
|
56
|
-
headers: headers, params: params,
|
57
|
+
headers: headers, params: params, usage: usage,
|
57
58
|
&read_body_chunk_block
|
58
59
|
)
|
59
60
|
|
@@ -66,6 +67,7 @@ module Stripe
|
|
66
67
|
[resp, opts_to_persist]
|
67
68
|
end
|
68
69
|
|
70
|
+
# TODO: (major)
|
69
71
|
# This method used to be called `request`, but it's such a short name
|
70
72
|
# that it eventually conflicted with the name of a field on an API
|
71
73
|
# resource (specifically, `Event#request`), so it was renamed to
|
@@ -111,9 +113,9 @@ module Stripe
|
|
111
113
|
end
|
112
114
|
|
113
115
|
protected def execute_resource_request(method, url,
|
114
|
-
params = {}, opts = {})
|
116
|
+
params = {}, opts = {}, usage = [])
|
115
117
|
opts = @opts.merge(Util.normalize_opts(opts))
|
116
|
-
self.class.execute_resource_request(method, url, params, opts)
|
118
|
+
self.class.execute_resource_request(method, url, params, opts, usage)
|
117
119
|
end
|
118
120
|
|
119
121
|
protected def execute_resource_request_stream(method, url,
|
@@ -125,9 +127,9 @@ module Stripe
|
|
125
127
|
)
|
126
128
|
end
|
127
129
|
|
128
|
-
private def request_stripe_object(method:, path:, params:, opts: {})
|
129
|
-
resp, opts = execute_resource_request(method, path, params, opts)
|
130
|
-
Util.convert_to_stripe_object_with_params(resp.data, params, opts)
|
130
|
+
private def request_stripe_object(method:, path:, params:, opts: {}, usage: [])
|
131
|
+
resp, opts = execute_resource_request(method, path, params, opts, usage)
|
132
|
+
Util.convert_to_stripe_object_with_params(resp.data, params, opts, resp)
|
131
133
|
end
|
132
134
|
|
133
135
|
# See notes on `alias` above.
|
@@ -66,8 +66,8 @@ module Stripe
|
|
66
66
|
# generated a uri for this object with an identifier baked in
|
67
67
|
values.delete(:id)
|
68
68
|
|
69
|
-
resp, opts = execute_resource_request(:post, save_url, values, opts)
|
70
|
-
initialize_from(resp.data, opts)
|
69
|
+
resp, opts = execute_resource_request(:post, save_url, values, opts, ["save"])
|
70
|
+
initialize_from(resp.data, opts, resp)
|
71
71
|
end
|
72
72
|
extend Gem::Deprecate
|
73
73
|
deprecate :save, "the `update` class method (for examples " \
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
module Stripe
|
4
4
|
module APIOperations
|
5
|
+
# The _search method via API Operations is deprecated.
|
6
|
+
# Please use the search method from within the resource instead.
|
5
7
|
module Search
|
6
8
|
def _search(search_url, filters = {}, opts = {})
|
7
9
|
request_stripe_object(
|
@@ -11,6 +13,9 @@ module Stripe
|
|
11
13
|
opts: opts
|
12
14
|
)
|
13
15
|
end
|
16
|
+
|
17
|
+
extend Gem::Deprecate
|
18
|
+
deprecate :_search, "request_stripe_object", 2024, 1
|
14
19
|
end
|
15
20
|
end
|
16
21
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Stripe
|
4
|
+
module APIOperations
|
5
|
+
module SingletonSave
|
6
|
+
module ClassMethods
|
7
|
+
# Updates a singleton API resource
|
8
|
+
#
|
9
|
+
# Updates the identified resource with the passed in parameters.
|
10
|
+
#
|
11
|
+
# ==== Attributes
|
12
|
+
#
|
13
|
+
# * +params+ - A hash of parameters to pass to the API
|
14
|
+
# * +opts+ - A Hash of additional options (separate from the params /
|
15
|
+
# object values) to be added to the request. E.g. to allow for an
|
16
|
+
# idempotency_key to be passed in the request headers, or for the
|
17
|
+
# api_key to be overwritten. See
|
18
|
+
# {APIOperations::Request.execute_resource_request}.
|
19
|
+
def update(params = {}, opts = {})
|
20
|
+
params.each_key do |k|
|
21
|
+
raise ArgumentError, "Cannot update protected field: #{k}" if protected_fields.include?(k)
|
22
|
+
end
|
23
|
+
|
24
|
+
request_stripe_object(
|
25
|
+
method: :post,
|
26
|
+
path: resource_url,
|
27
|
+
params: params,
|
28
|
+
opts: opts
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# The `save` method is DEPRECATED and will be removed in a future major
|
34
|
+
# version of the library. Use the `update` method on the resource instead.
|
35
|
+
#
|
36
|
+
# Updates a singleton API resource.
|
37
|
+
#
|
38
|
+
# If the resource doesn't yet have an assigned ID and the resource is one
|
39
|
+
# that can be created, then the method attempts to create the resource.
|
40
|
+
# The resource is updated otherwise.
|
41
|
+
#
|
42
|
+
# ==== Attributes
|
43
|
+
#
|
44
|
+
# * +params+ - Overrides any parameters in the resource's serialized data
|
45
|
+
# and includes them in the create or update. If +:req_url:+ is included
|
46
|
+
# in the list, it overrides the update URL used for the create or
|
47
|
+
# update.
|
48
|
+
# * +opts+ - A Hash of additional options (separate from the params /
|
49
|
+
# object values) to be added to the request. E.g. to allow for an
|
50
|
+
# idempotency_key to be passed in the request headers, or for the
|
51
|
+
# api_key to be overwritten. See
|
52
|
+
# {APIOperations::Request.execute_resource_request}.
|
53
|
+
def save(params = {}, opts = {})
|
54
|
+
# We started unintentionally (sort of) allowing attributes sent to
|
55
|
+
# +save+ to override values used during the update. So as not to break
|
56
|
+
# the API, this makes that official here.
|
57
|
+
update_attributes(params)
|
58
|
+
|
59
|
+
# Now remove any parameters that look like object attributes.
|
60
|
+
params = params.reject { |k, _| respond_to?(k) }
|
61
|
+
|
62
|
+
values = serialize_params(self).merge(params)
|
63
|
+
|
64
|
+
resp, opts = execute_resource_request(:post, resource_url, values, opts, ["save"])
|
65
|
+
initialize_from(resp.data, opts, resp)
|
66
|
+
end
|
67
|
+
extend Gem::Deprecate
|
68
|
+
deprecate :save, "the `update` class method (for examples " \
|
69
|
+
"see https://github.com/stripe/stripe-ruby" \
|
70
|
+
"/wiki/Migration-guide-for-v8)", 2022, 11
|
71
|
+
|
72
|
+
def self.included(base)
|
73
|
+
# Set `metadata` as additive so that when it's set directly we remember
|
74
|
+
# to clear keys that may have been previously set by sending empty
|
75
|
+
# values for them.
|
76
|
+
#
|
77
|
+
# It's possible that not every object with `Save` has `metadata`, but
|
78
|
+
# it's a close enough heuristic, and having this option set when there
|
79
|
+
# is no `metadata` field is not harmful.
|
80
|
+
base.additive_object_param(:metadata)
|
81
|
+
|
82
|
+
base.extend(ClassMethods)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/lib/stripe/api_resource.rb
CHANGED
@@ -11,6 +11,15 @@ module Stripe
|
|
11
11
|
# for example, where this is allowed.
|
12
12
|
attr_accessor :save_with_parent
|
13
13
|
|
14
|
+
# TODO: (major) Remove OBJECT_NAME and stop using const_get here
|
15
|
+
# This is a workaround to avoid breaking users who have defined their own
|
16
|
+
# APIResource subclasses with a custom OBJECT_NAME. We should never fallback
|
17
|
+
# on this case otherwise.
|
18
|
+
OBJECT_NAME = ""
|
19
|
+
def self.object_name
|
20
|
+
const_get(:OBJECT_NAME)
|
21
|
+
end
|
22
|
+
|
14
23
|
def self.class_name
|
15
24
|
name.split("::")[-1]
|
16
25
|
end
|
@@ -23,7 +32,7 @@ module Stripe
|
|
23
32
|
end
|
24
33
|
# Namespaces are separated in object names with periods (.) and in URLs
|
25
34
|
# with forward slashes (/), so replace the former with the latter.
|
26
|
-
"/v1/#{
|
35
|
+
"/v1/#{object_name.downcase.tr('.', '/')}s"
|
27
36
|
end
|
28
37
|
|
29
38
|
# A metaprogramming call that specifies that a field of a resource can be
|
@@ -80,7 +89,7 @@ module Stripe
|
|
80
89
|
def refresh
|
81
90
|
resp, opts = execute_resource_request(:get, resource_url,
|
82
91
|
@retrieve_params)
|
83
|
-
initialize_from(resp.data, opts)
|
92
|
+
initialize_from(resp.data, opts, resp)
|
84
93
|
end
|
85
94
|
|
86
95
|
def self.retrieve(id, opts = {})
|
@@ -95,9 +104,9 @@ module Stripe
|
|
95
104
|
|
96
105
|
# If we're getting back this thing, update; otherwise, instantiate.
|
97
106
|
if Util.object_name_matches_class?(resp.data[:object], self.class)
|
98
|
-
initialize_from(resp.data, opts)
|
107
|
+
initialize_from(resp.data, opts, resp)
|
99
108
|
else
|
100
|
-
Util.convert_to_stripe_object_with_params(resp.data, params, opts)
|
109
|
+
Util.convert_to_stripe_object_with_params(resp.data, params, opts, resp)
|
101
110
|
end
|
102
111
|
end
|
103
112
|
|
@@ -14,6 +14,10 @@ module Stripe
|
|
14
14
|
@resource = resource
|
15
15
|
end
|
16
16
|
|
17
|
+
def self.resource_class
|
18
|
+
nil
|
19
|
+
end
|
20
|
+
|
17
21
|
# Adds a custom method to a test helper. This is used to add support for
|
18
22
|
# non-CRUDL API requests, e.g. capturing charges. custom_method takes the
|
19
23
|
# following parameters:
|
@@ -27,12 +31,12 @@ module Stripe
|
|
27
31
|
# adds a `capture` class method to the resource class that, when called,
|
28
32
|
# will send a POST request to `/v1/<object_name>/capture`.
|
29
33
|
def self.custom_method(name, http_verb:, http_path: nil)
|
30
|
-
Util.custom_method
|
34
|
+
Util.custom_method resource_class, self, name, http_verb, http_path
|
31
35
|
end
|
32
36
|
|
33
37
|
def self.resource_url
|
34
38
|
"/v1/test_helpers/" \
|
35
|
-
"#{
|
39
|
+
"#{resource_class.object_name.downcase.tr('.', '/')}s"
|
36
40
|
end
|
37
41
|
|
38
42
|
def resource_url
|
data/lib/stripe/api_version.rb
CHANGED
data/lib/stripe/list_object.rb
CHANGED
@@ -8,6 +8,9 @@ module Stripe
|
|
8
8
|
include Stripe::APIOperations::Create
|
9
9
|
|
10
10
|
OBJECT_NAME = "list"
|
11
|
+
def self.object_name
|
12
|
+
"list"
|
13
|
+
end
|
11
14
|
|
12
15
|
# This accessor allows a `ListObject` to inherit various filters that were
|
13
16
|
# given to a predecessor. This allows for things like consistent limits,
|