stripe 10.1.0 → 12.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (165) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +215 -21
  3. data/Gemfile +6 -5
  4. data/Makefile +8 -1
  5. data/OPENAPI_VERSION +1 -1
  6. data/README.md +46 -14
  7. data/Rakefile +7 -5
  8. data/VERSION +1 -1
  9. data/{bin → exe}/stripe-console +1 -1
  10. data/lib/stripe/api_operations/nested_resource.rb +22 -2
  11. data/lib/stripe/api_operations/request.rb +22 -18
  12. data/lib/stripe/api_operations/save.rb +7 -9
  13. data/lib/stripe/api_operations/search.rb +5 -0
  14. data/lib/stripe/api_operations/singleton_save.rb +86 -0
  15. data/lib/stripe/api_resource.rb +13 -4
  16. data/lib/stripe/api_resource_test_helpers.rb +7 -3
  17. data/lib/stripe/api_version.rb +1 -1
  18. data/lib/stripe/connection_manager.rb +4 -6
  19. data/lib/stripe/errors.rb +3 -11
  20. data/lib/stripe/instrumentation.rb +5 -21
  21. data/lib/stripe/list_object.rb +3 -0
  22. data/lib/stripe/multipart_encoder.rb +7 -7
  23. data/lib/stripe/oauth.rb +6 -6
  24. data/lib/stripe/object_types.rb +135 -116
  25. data/lib/stripe/resources/account.rb +103 -25
  26. data/lib/stripe/resources/account_link.rb +8 -0
  27. data/lib/stripe/resources/account_session.rb +8 -0
  28. data/lib/stripe/resources/alipay_account.rb +1 -1
  29. data/lib/stripe/resources/apple_pay_domain.rb +43 -0
  30. data/lib/stripe/resources/application_fee.rb +8 -0
  31. data/lib/stripe/resources/application_fee_refund.rb +4 -2
  32. data/lib/stripe/resources/apps/secret.rb +15 -0
  33. data/lib/stripe/resources/balance.rb +3 -0
  34. data/lib/stripe/resources/balance_transaction.rb +15 -0
  35. data/lib/stripe/resources/bank_account.rb +49 -7
  36. data/lib/stripe/resources/billing/alert.rb +87 -0
  37. data/lib/stripe/resources/billing/meter.rb +83 -0
  38. data/lib/stripe/resources/billing/meter_event.rb +27 -0
  39. data/lib/stripe/resources/billing/meter_event_adjustment.rb +26 -0
  40. data/lib/stripe/resources/billing/meter_event_summary.rb +15 -0
  41. data/lib/stripe/resources/billing_portal/configuration.rb +33 -0
  42. data/lib/stripe/resources/billing_portal/session.rb +14 -1
  43. data/lib/stripe/resources/capability.rb +4 -2
  44. data/lib/stripe/resources/card.rb +28 -0
  45. data/lib/stripe/resources/cash_balance.rb +3 -0
  46. data/lib/stripe/resources/charge.rb +39 -1
  47. data/lib/stripe/resources/checkout/session.rb +47 -5
  48. data/lib/stripe/resources/climate/order.rb +67 -0
  49. data/lib/stripe/resources/climate/product.rb +27 -0
  50. data/lib/stripe/resources/climate/supplier.rb +26 -0
  51. data/lib/stripe/resources/confirmation_token.rb +39 -0
  52. data/lib/stripe/resources/country_spec.rb +8 -0
  53. data/lib/stripe/resources/coupon.rb +45 -0
  54. data/lib/stripe/resources/credit_note.rb +47 -7
  55. data/lib/stripe/resources/credit_note_line_item.rb +3 -0
  56. data/lib/stripe/resources/customer.rb +89 -26
  57. data/lib/stripe/resources/customer_balance_transaction.rb +3 -1
  58. data/lib/stripe/resources/customer_cash_balance_transaction.rb +3 -2
  59. data/lib/stripe/resources/customer_session.rb +29 -0
  60. data/lib/stripe/resources/discount.rb +3 -0
  61. data/lib/stripe/resources/dispute.rb +26 -0
  62. data/lib/stripe/resources/entitlements/active_entitlement.rb +26 -0
  63. data/lib/stripe/resources/entitlements/feature.rb +49 -0
  64. data/lib/stripe/resources/ephemeral_key.rb +23 -0
  65. data/lib/stripe/resources/event.rb +11 -3
  66. data/lib/stripe/resources/exchange_rate.rb +8 -0
  67. data/lib/stripe/resources/file.rb +29 -16
  68. data/lib/stripe/resources/file_link.rb +23 -0
  69. data/lib/stripe/resources/financial_connections/account.rb +66 -7
  70. data/lib/stripe/resources/financial_connections/account_owner.rb +3 -0
  71. data/lib/stripe/resources/financial_connections/account_ownership.rb +3 -0
  72. data/lib/stripe/resources/financial_connections/session.rb +13 -0
  73. data/lib/stripe/resources/financial_connections/transaction.rb +26 -0
  74. data/lib/stripe/resources/forwarding/request.rb +52 -0
  75. data/lib/stripe/resources/funding_instructions.rb +3 -0
  76. data/lib/stripe/resources/identity/verification_report.rb +14 -1
  77. data/lib/stripe/resources/identity/verification_session.rb +90 -4
  78. data/lib/stripe/resources/invoice.rb +170 -17
  79. data/lib/stripe/resources/invoice_item.rb +43 -0
  80. data/lib/stripe/resources/invoice_line_item.rb +21 -0
  81. data/lib/stripe/resources/invoice_rendering_template.rb +63 -0
  82. data/lib/stripe/resources/issuing/authorization.rb +88 -14
  83. data/lib/stripe/resources/issuing/card.rb +50 -16
  84. data/lib/stripe/resources/issuing/cardholder.rb +33 -0
  85. data/lib/stripe/resources/issuing/dispute.rb +35 -0
  86. data/lib/stripe/resources/issuing/personalization_design.rb +119 -0
  87. data/lib/stripe/resources/issuing/physical_bundle.rb +26 -0
  88. data/lib/stripe/resources/issuing/token.rb +18 -0
  89. data/lib/stripe/resources/issuing/transaction.rb +30 -0
  90. data/lib/stripe/resources/line_item.rb +3 -0
  91. data/lib/stripe/resources/login_link.rb +4 -1
  92. data/lib/stripe/resources/mandate.rb +3 -0
  93. data/lib/stripe/resources/payment_intent.rb +190 -25
  94. data/lib/stripe/resources/payment_link.rb +25 -0
  95. data/lib/stripe/resources/payment_method.rb +57 -4
  96. data/lib/stripe/resources/payment_method_configuration.rb +33 -0
  97. data/lib/stripe/resources/payment_method_domain.rb +46 -1
  98. data/lib/stripe/resources/payout.rb +39 -4
  99. data/lib/stripe/resources/person.rb +5 -4
  100. data/lib/stripe/resources/plan.rb +43 -0
  101. data/lib/stripe/resources/price.rb +24 -1
  102. data/lib/stripe/resources/product.rb +47 -1
  103. data/lib/stripe/resources/product_feature.rb +13 -0
  104. data/lib/stripe/resources/promotion_code.rb +23 -0
  105. data/lib/stripe/resources/quote.rb +67 -32
  106. data/lib/stripe/resources/radar/early_fraud_warning.rb +13 -0
  107. data/lib/stripe/resources/radar/value_list.rb +53 -0
  108. data/lib/stripe/resources/radar/value_list_item.rb +43 -0
  109. data/lib/stripe/resources/refund.rb +46 -0
  110. data/lib/stripe/resources/reporting/report_run.rb +23 -0
  111. data/lib/stripe/resources/reporting/report_type.rb +13 -0
  112. data/lib/stripe/resources/reversal.rb +5 -3
  113. data/lib/stripe/resources/review.rb +10 -0
  114. data/lib/stripe/resources/setup_attempt.rb +8 -0
  115. data/lib/stripe/resources/setup_intent.rb +72 -10
  116. data/lib/stripe/resources/shipping_rate.rb +23 -0
  117. data/lib/stripe/resources/sigma/scheduled_query_run.rb +13 -0
  118. data/lib/stripe/resources/source.rb +23 -1
  119. data/lib/stripe/resources/source_transaction.rb +3 -0
  120. data/lib/stripe/resources/subscription.rb +81 -13
  121. data/lib/stripe/resources/subscription_item.rb +54 -1
  122. data/lib/stripe/resources/subscription_schedule.rb +41 -4
  123. data/lib/stripe/resources/tax/calculation.rb +15 -0
  124. data/lib/stripe/resources/tax/calculation_line_item.rb +3 -0
  125. data/lib/stripe/resources/tax/registration.rb +35 -0
  126. data/lib/stripe/resources/tax/settings.rb +4 -2
  127. data/lib/stripe/resources/tax/transaction.rb +15 -8
  128. data/lib/stripe/resources/tax/transaction_line_item.rb +3 -0
  129. data/lib/stripe/resources/tax_code.rb +8 -0
  130. data/lib/stripe/resources/tax_id.rb +30 -12
  131. data/lib/stripe/resources/tax_rate.rb +23 -0
  132. data/lib/stripe/resources/terminal/configuration.rb +53 -0
  133. data/lib/stripe/resources/terminal/connection_token.rb +13 -0
  134. data/lib/stripe/resources/terminal/location.rb +54 -0
  135. data/lib/stripe/resources/terminal/reader.rb +80 -12
  136. data/lib/stripe/resources/test_helpers/test_clock.rb +45 -0
  137. data/lib/stripe/resources/token.rb +10 -1
  138. data/lib/stripe/resources/topup.rb +25 -0
  139. data/lib/stripe/resources/transfer.rb +26 -1
  140. data/lib/stripe/resources/treasury/credit_reversal.rb +23 -0
  141. data/lib/stripe/resources/treasury/debit_reversal.rb +23 -0
  142. data/lib/stripe/resources/treasury/financial_account.rb +42 -5
  143. data/lib/stripe/resources/treasury/financial_account_features.rb +3 -0
  144. data/lib/stripe/resources/treasury/inbound_transfer.rb +47 -11
  145. data/lib/stripe/resources/treasury/outbound_payment.rb +64 -8
  146. data/lib/stripe/resources/treasury/outbound_transfer.rb +64 -8
  147. data/lib/stripe/resources/treasury/received_credit.rb +17 -0
  148. data/lib/stripe/resources/treasury/received_debit.rb +17 -0
  149. data/lib/stripe/resources/treasury/transaction.rb +13 -0
  150. data/lib/stripe/resources/treasury/transaction_entry.rb +13 -0
  151. data/lib/stripe/resources/usage_record.rb +5 -0
  152. data/lib/stripe/resources/usage_record_summary.rb +3 -0
  153. data/lib/stripe/resources/webhook_endpoint.rb +55 -2
  154. data/lib/stripe/resources.rb +18 -0
  155. data/lib/stripe/search_result_object.rb +4 -1
  156. data/lib/stripe/singleton_api_resource.rb +20 -3
  157. data/lib/stripe/stripe_client.rb +61 -63
  158. data/lib/stripe/stripe_configuration.rb +13 -29
  159. data/lib/stripe/stripe_object.rb +23 -21
  160. data/lib/stripe/stripe_response.rb +1 -3
  161. data/lib/stripe/util.rb +13 -15
  162. data/lib/stripe/version.rb +1 -1
  163. data/lib/stripe.rb +26 -0
  164. data/stripe.gemspec +7 -4
  165. metadata +25 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 161eba8138b975aa9911f0fb43639b9732d11368b870d56b2a40dc394d8ae23c
4
- data.tar.gz: 49cda1fbae2fe6731646e00d795406d03bcf5cdc0f3973e700c12a3b048098db
3
+ metadata.gz: cec3b48108a6e34b1ebda0be0cfb3ed6eb9aa124d71577b99fdb4b6b2407e0ad
4
+ data.tar.gz: 11d1823bf601fd83aa44cd8262af329eb0ce1a52885c982f6a58466837a1d89a
5
5
  SHA512:
6
- metadata.gz: d80cdfbfeb61f3012e1e94483adb2221a7921e12b1a3461681c592cebf95937898fd438458d1feaa351824820f4711a42ddd7d3ebc20ed02a59d9896085e0fe5
7
- data.tar.gz: a8d56ab530687777b348080757e53f20dc83a0121ce5e3578e4ff7fee31ea024be48b68fef318a9d7433d1d246a84e6a97d461942986dee5d684eeb04558db2a
6
+ metadata.gz: 5b3931f9c3637f350e0590ad6fce034cb8449e20e5c37da258971b9e6577ea9be65cab45196798b6ae88ac04d4cf1ad99c85caa18c315c1be17ea3808133c57c
7
+ data.tar.gz: 94d11382678b989b6cd8dc9e81219e9a07338bc83ae704b8bcf7c1a410e7fa6e13d0aa4e22eb4256975218b20ed469ce1f28de7b1b910aa44f078b37240b9172
data/CHANGELOG.md CHANGED
@@ -1,4 +1,198 @@
1
1
  # Changelog
2
+ ## 12.6.0 - 2024-09-12
3
+ * [#1442](https://github.com/stripe/stripe-ruby/pull/1442) Update generated code
4
+ * Add support for new resource `InvoiceRenderingTemplate`
5
+ * Add support for `archive`, `list`, `retrieve`, and `unarchive` methods on resource `InvoiceRenderingTemplate`
6
+ * [#1443](https://github.com/stripe/stripe-ruby/pull/1443) Removed v1/files override
7
+
8
+ ## 12.5.0 - 2024-08-08
9
+ * [#1440](https://github.com/stripe/stripe-ruby/pull/1440) Update generated code
10
+ * Add support for new resources `Billing.AlertTriggered` and `Billing.Alert`
11
+ * Add support for `activate`, `archive`, `create`, `deactivate`, `list`, and `retrieve` methods on resource `Alert`
12
+ * Add support for `retrieve` method on resource `Tax.Calculation`
13
+
14
+ ## 12.4.0 - 2024-07-25
15
+ * [#1437](https://github.com/stripe/stripe-ruby/pull/1437) Update generated code
16
+ * Add support for `update` method on resource `Checkout.Session`
17
+
18
+ ## 12.3.0 - 2024-07-18
19
+ * [#1436](https://github.com/stripe/stripe-ruby/pull/1436) Fixed changelog for major release 12.0.0
20
+ * [#1435](https://github.com/stripe/stripe-ruby/pull/1435) Add deprecation warning for `APIResource.request`
21
+
22
+ ## 12.2.0 - 2024-07-12
23
+ * [#1430](https://github.com/stripe/stripe-ruby/pull/1430) Update generated code
24
+
25
+ * [#1433](https://github.com/stripe/stripe-ruby/pull/1433) Add usage to raw_request call
26
+ * [#1431](https://github.com/stripe/stripe-ruby/pull/1431) Add `raw_request`
27
+
28
+ - Adds the ability to make raw requests to the Stripe API, by providing an HTTP method and url. This is an alternative to using `Stripe::APIResource.request(...)` to make custom requests, which is discouraged and will be broken in a future major version.
29
+
30
+ ## 12.1.0 - 2024-07-05
31
+ * [#1425](https://github.com/stripe/stripe-ruby/pull/1425) Update generated code
32
+ * Add support for `add_lines`, `remove_lines`, and `update_lines` methods on resource `Invoice`
33
+ * [#1420](https://github.com/stripe/stripe-ruby/pull/1420) Update static methods for delete/list on BankAccount/Card to throw NotImplementedError
34
+ * The below methods have been throwing `InvalidRequestError` because the urls used to make the requests have been buggy. Updating them to throw `NotImplementedError` instead just like their counterparts for update & retrieve because they cannot be implemented without the parent id.
35
+
36
+ Methods affected | Use these instead in the context of payment method | Use these in the context of external accounts
37
+ ------ | ------ | ----
38
+ Stripe:: BankAccount.delete | Stripe::Customer.delete_source | Stripe::Account.delete_external_account
39
+ Stripe:: BankAccount.list | Stripe::Customer.list_sources | Stripe::Customer.list_external_accounts
40
+ Stripe:: Card.delete | Stripe::Customer.delete_source | Stripe::Account.delete_external_account
41
+ Stripe:: Card.list | Stripe::Customer.list_sources | Stripe::Customer.list_external_accounts
42
+ * [#1427](https://github.com/stripe/stripe-ruby/pull/1427) Regenerate rbis
43
+ * [#1426](https://github.com/stripe/stripe-ruby/pull/1426) Remove coveralls and re-added JRuby
44
+
45
+ ## 12.0.0 - 2024-06-24
46
+ * [#1418](https://github.com/stripe/stripe-ruby/pull/1418) Add missing static method for verify on BankAccount
47
+ * [#1419](https://github.com/stripe/stripe-ruby/pull/1419)
48
+
49
+ This release changes the pinned API version to 2024-06-20. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2024-06-20) and carefully review the API changes before upgrading.
50
+
51
+ ### Additions
52
+
53
+ * Add support for `finalize_amount` test helper method on resource `Issuing.Authorization`
54
+
55
+ ## 11.7.0 - 2024-06-13
56
+ * [#1415](https://github.com/stripe/stripe-ruby/pull/1415) Deprecate StripeClient#request
57
+ * Add deprecation warning for `StripeClient#request`. This helper method will be removed in a future major version. To access response objects, use the `last_response` property on the returned resource instead. Refer to [Accessing a response object](https://github.com/stripe/stripe-ruby?tab=readme-ov-file#accessing-a-response-object) in the README for usage details.
58
+
59
+ ## 11.6.0 - 2024-05-30
60
+ * [#1404](https://github.com/stripe/stripe-ruby/pull/1404) Add method to list invoice line items
61
+ * Add methods `list_lines()` on the class `Invoice` to list the invoice line items
62
+
63
+ ## 11.5.0 - 2024-05-23
64
+ * This release has no changes.
65
+
66
+ ## 11.4.0 - 2024-05-09
67
+ * [#1397](https://github.com/stripe/stripe-ruby/pull/1397) Update generated code
68
+ * Add support for `update` test helper method on resources `Treasury.OutboundPayment` and `Treasury.OutboundTransfer`
69
+ * [#1399](https://github.com/stripe/stripe-ruby/pull/1399) Pass params to transfer reversal
70
+ * Allow `Stripe::Transfer.retrieve_reversal()` to accept a params hash as the third argument, followed by opts. No changes to existing calls are necessary, but in a future major version this method will be updated to only accept params as the first argument. Fixes [#1393](https://github.com/stripe/stripe-ruby/issues/1393)
71
+ * [#1389](https://github.com/stripe/stripe-ruby/pull/1389) Removed jaro_winkler as a dependency
72
+ * [#1396](https://github.com/stripe/stripe-ruby/pull/1396) Start tracking `StripeClient#request` usage
73
+
74
+ ## 11.3.0 - 2024-05-02
75
+ * [#1387](https://github.com/stripe/stripe-ruby/pull/1387) Update generated code
76
+
77
+ * [#1392](https://github.com/stripe/stripe-ruby/pull/1392) Deprecate Ruby methods based on OpenAPI spec
78
+ - 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).
79
+ * [#1391](https://github.com/stripe/stripe-ruby/pull/1391) Add Ruby 3.3 to CI test matrix
80
+
81
+ ## 11.2.0 - 2024-04-18
82
+ * [#1385](https://github.com/stripe/stripe-ruby/pull/1385) Update generated code
83
+ * Add support for `create_preview` method on resource `Invoice`
84
+
85
+ ## 11.1.0 - 2024-04-16
86
+ * [#1379](https://github.com/stripe/stripe-ruby/pull/1379) Update generated code
87
+ * Add support for new resource `Entitlements.ActiveEntitlementSummary`
88
+
89
+ ## 11.0.0 - 2024-04-10
90
+ * [#1374](https://github.com/stripe/stripe-ruby/pull/1374)
91
+
92
+ * 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.
93
+
94
+ ### ⚠️ Breaking changes
95
+
96
+ * 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.
97
+
98
+ ## 10.15.0 - 2024-04-09
99
+ * [#1377](https://github.com/stripe/stripe-ruby/pull/1377) Add last_response to StripeObject
100
+ * 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.
101
+ * [#1372](https://github.com/stripe/stripe-ruby/pull/1372) Update generated code
102
+ * Add support for new resources `Entitlements.ActiveEntitlement` and `Entitlements.Feature`
103
+ * Add support for `list` and `retrieve` methods on resource `ActiveEntitlement`
104
+ * Add support for `create`, `list`, `retrieve`, and `update` methods on resource `Feature`
105
+ * [#1366](https://github.com/stripe/stripe-ruby/pull/1366) Move executables to `exe` folder
106
+
107
+ ## 10.14.0 - 2024-03-28
108
+ * [#1369](https://github.com/stripe/stripe-ruby/pull/1369) Update generated code
109
+ * Add support for new resources `Billing.MeterEventAdjustment`, `Billing.MeterEvent`, and `Billing.Meter`
110
+ * Add support for `create`, `deactivate`, `list`, `reactivate`, `retrieve`, and `update` methods on resource `Meter`
111
+ * Add support for `create` method on resources `MeterEventAdjustment` and `MeterEvent`
112
+
113
+ ## 10.13.0 - 2024-03-21
114
+ * [#1367](https://github.com/stripe/stripe-ruby/pull/1367) Update generated code
115
+ * Add support for new resources `ConfirmationToken` and `Forwarding.Request`
116
+ * Add support for `retrieve` method on resource `ConfirmationToken`
117
+ * Add support for `create`, `list`, and `retrieve` methods on resource `Request`
118
+ * [#1362](https://github.com/stripe/stripe-ruby/pull/1362) Exclude sorbet directory and tapioca script when packing gem
119
+
120
+ ## 10.12.0 - 2024-03-14
121
+ * [#1359](https://github.com/stripe/stripe-ruby/pull/1359) Update generated code
122
+ * Add support for new resources `Issuing.PersonalizationDesign` and `Issuing.PhysicalBundle`
123
+ * Add support for `create`, `list`, `retrieve`, and `update` methods on resource `PersonalizationDesign`
124
+ * Add support for `list` and `retrieve` methods on resource `PhysicalBundle`
125
+ * [#1354](https://github.com/stripe/stripe-ruby/pull/1354) Refactor after SDK based generation pattern
126
+ * [#1347](https://github.com/stripe/stripe-ruby/pull/1347) Reorder methods with lexographical sort
127
+ * [#1355](https://github.com/stripe/stripe-ruby/pull/1355) Disable Metrics/ClassLength
128
+ * [#1351](https://github.com/stripe/stripe-ruby/pull/1351) Update CHANGELOG.md
129
+
130
+ ## 10.11.0 - 2024-02-29
131
+ * [#1348](https://github.com/stripe/stripe-ruby/pull/1348) Use sorbet gem instead of sorbet-static
132
+ * [#1342](https://github.com/stripe/stripe-ruby/pull/1342) Update generated code
133
+ * Add `list_refunds` and `retrieve_refund` methods on resource `Charge`.
134
+ * [#1345](https://github.com/stripe/stripe-ruby/pull/1345) Update README to use add_beta_version
135
+
136
+ ## 10.10.0 - 2024-02-22
137
+ * [#1336](https://github.com/stripe/stripe-ruby/pull/1336) Update generated code
138
+ - Add `InvoiceLineItem.update` method.
139
+ * [#1334](https://github.com/stripe/stripe-ruby/pull/1334) Add TaxIds API
140
+ * Add support for `all`, `create`, and `retrieve` methods on resource `TaxId`
141
+ * 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.
142
+ * 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.
143
+
144
+ ## 10.9.0 - 2024-02-15
145
+ * [#1329](https://github.com/stripe/stripe-ruby/pull/1329) Update generated code
146
+ * Fixed bug where `TaxId` resource `delete` method sent request to wrong URL (https://github.com/stripe/stripe-ruby/issues/1333)
147
+ * [#1324](https://github.com/stripe/stripe-ruby/pull/1324) Start running Sorbet in CI
148
+ * [#1327](https://github.com/stripe/stripe-ruby/pull/1327) Add methods for dynamically referenced constants
149
+
150
+ ## 10.8.0 - 2024-02-08
151
+ * [#1322](https://github.com/stripe/stripe-ruby/pull/1322) Update generated code
152
+ * [#1323](https://github.com/stripe/stripe-ruby/pull/1323) Extract other CRUDL api operations from mixins
153
+ * Extract more CRUDL operations, namely `create`, `delete`, `update`, and `list` into the resources. These methods will no longer rely on the APIOperation mixins.
154
+ * [#1314](https://github.com/stripe/stripe-ruby/pull/1314) Update mocha gem to 1.16
155
+
156
+ ## 10.7.1 - 2024-02-05
157
+ * [#1320](https://github.com/stripe/stripe-ruby/pull/1320) Remove spurious _search deprecation messages (https://github.com/stripe/stripe-ruby/issues/1319)
158
+
159
+ ## 10.7.0 - 2024-02-01
160
+ * [#1317](https://github.com/stripe/stripe-ruby/pull/1317) Remove list method in child resources
161
+ * Removes list method mixin from child resources, as these methods always return `InvalidRequestError` and never succeed
162
+ * [#1311](https://github.com/stripe/stripe-ruby/pull/1311) Use the deprecation gem in search and clean up usage of the gem
163
+
164
+ ## 10.6.0 - 2024-01-12
165
+ * [#1310](https://github.com/stripe/stripe-ruby/pull/1310) Update generated code
166
+ * Add support for new resource `CustomerSession`
167
+ * Add support for `create` method on resource `CustomerSession`
168
+
169
+ ## 10.5.0 - 2024-01-04
170
+ * [#1306](https://github.com/stripe/stripe-ruby/pull/1306) Update generated code
171
+ * Add support for `retrieve` method on resource `Tax.Registration`
172
+
173
+ ## 10.4.0 - 2023-12-22
174
+ * [#1303](https://github.com/stripe/stripe-ruby/pull/1303) Update generated code
175
+ * Add support for new resource `FinancialConnections.Transaction`
176
+ * Add support for `list` and `retrieve` methods on resource `Transaction`
177
+ * Add support for `subscribe` and `unsubscribe` methods on resource `FinancialConnections.Account`
178
+ * [#1304](https://github.com/stripe/stripe-ruby/pull/1304) Add support for updatable singleton resources
179
+
180
+ ## 10.3.0 - 2023-12-14
181
+ * [#1294](https://github.com/stripe/stripe-ruby/pull/1294) Support sending parameters inside singleton retrieve
182
+
183
+ ## 10.2.0 - 2023-11-30
184
+ * [#1292](https://github.com/stripe/stripe-ruby/pull/1292) Update generated code
185
+ * Add support for new resources `Climate.Order`, `Climate.Product`, and `Climate.Supplier`
186
+ * Add support for `cancel`, `create`, `list`, `retrieve`, and `update` methods on resource `Order`
187
+ * Add support for `list` and `retrieve` methods on resources `Product` and `Supplier`
188
+ * [#1295](https://github.com/stripe/stripe-ruby/pull/1295) Upgrade rubocop
189
+ * [#1291](https://github.com/stripe/stripe-ruby/pull/1291) Update generated code
190
+
191
+ * [#1290](https://github.com/stripe/stripe-ruby/pull/1290) Update generated code
192
+
193
+ * [#1288](https://github.com/stripe/stripe-ruby/pull/1288) Update generated code
194
+
195
+
2
196
  ## 10.1.0 - 2023-11-02
3
197
  * [#1286](https://github.com/stripe/stripe-ruby/pull/1286) Update generated code
4
198
  * Add support for new resource `Tax.Registration`
@@ -40,32 +234,32 @@
40
234
  **⚠️ ACTION REQUIRED: the breaking change in this release likely affects you ⚠️**
41
235
 
42
236
  * [#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
43
-
237
+
44
238
  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).
45
-
239
+
46
240
  To successfully upgrade to stripe-ruby v9, you must either
47
-
241
+
48
242
  1. **(Recommended) Upgrade your integration to be compatible with API Version `2023-08-16`.**
49
-
243
+
50
244
  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.
51
-
245
+
52
246
  You can read the [v9 migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v9) for more detailed instructions.
53
247
  2. **(Alternative option) Specify a version other than `2023-08-16` when initializing `stripe-ruby`.**
54
-
248
+
55
249
  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:
56
-
250
+
57
251
  ```diff
58
252
  require 'stripe'
59
253
  Stripe.api_key = "sk_test_..."
60
254
  + Stripe.api_version = '2020-08-27'
61
255
  ```
62
-
256
+
63
257
  If you were already initializing stripe-ruby with an explicit API Version, upgrading to v9 will not affect your integration.
64
-
258
+
65
259
  Read the [v9 migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v9) for more details.
66
-
260
+
67
261
  Going forward, each major release of this library will be *pinned* by default to the latest Stripe API Version at the time of release.
68
-
262
+
69
263
  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.
70
264
 
71
265
  ## 8.7.0 - 2023-08-10
@@ -92,7 +286,7 @@
92
286
 
93
287
  * [#1225](https://github.com/stripe/stripe-ruby/pull/1225) Downgrade jaro_winkler
94
288
  * [#1219](https://github.com/stripe/stripe-ruby/pull/1219) Update generated code
95
-
289
+
96
290
  Documentation updates.
97
291
  * [#1215](https://github.com/stripe/stripe-ruby/pull/1215) Update generated code
98
292
 
@@ -140,7 +334,7 @@ Breaking changes that arose during code generation of the library that we postpo
140
334
  refund = Stripe::Refund.retrieve("re_123")
141
335
  refund.description = "Refund description"
142
336
  refund.save
143
-
337
+
144
338
  # after
145
339
  Stripe::Refund.update("re_123", description: "Refund description")
146
340
  ```
@@ -204,7 +398,7 @@ Breaking changes that arose during code generation of the library that we postpo
204
398
  * [#1072](https://github.com/stripe/stripe-ruby/pull/1072) Trigger workflows on beta branches
205
399
  * [#1071](https://github.com/stripe/stripe-ruby/pull/1071) Use request_stripe_object for all requests
206
400
  * [#1070](https://github.com/stripe/stripe-ruby/pull/1070) API Updates
207
-
401
+
208
402
  Switch from using meta-programing to generating explicit methods for custom methods.
209
403
  * [#1069](https://github.com/stripe/stripe-ruby/pull/1069) chore: Stop special implementation of Account.persons method.
210
404
 
@@ -220,15 +414,15 @@ Breaking changes that arose during code generation of the library that we postpo
220
414
  * 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`
221
415
  * Add support for `retrieve_payment_method` method on resource `Customer`
222
416
  * Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account`
223
-
224
-
417
+
418
+
225
419
 
226
420
  ## 6.0.0 - 2022-05-09
227
421
  * [#1056](https://github.com/stripe/stripe-ruby/pull/1056) API Updates
228
422
  Major version release. The [migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-Guide-for-v6) contains more information.
229
-
423
+
230
424
  (⚠️ = breaking changes):
231
- * ⚠️ Replace the legacy `Order` API with the new `Order` API.
425
+ * ⚠️ Replace the legacy `Order` API with the new `Order` API.
232
426
  * New methods: `cancel`, `list_line_items`, `reopen`, and `submit`
233
427
  * Removed methods: `pay` and `return_order`
234
428
  * Removed resources: `OrderItem` and `OrderReturn`
@@ -237,7 +431,7 @@ Breaking changes that arose during code generation of the library that we postpo
237
431
  ## 5.55.0 - 2022-05-05
238
432
  * [#1055](https://github.com/stripe/stripe-ruby/pull/1055) API Updates
239
433
  * Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
240
-
434
+
241
435
 
242
436
  ## 5.54.0 - 2022-05-03
243
437
  * [#1053](https://github.com/stripe/stripe-ruby/pull/1053) API Updates
@@ -248,7 +442,7 @@ Breaking changes that arose during code generation of the library that we postpo
248
442
  * Add support for `expire` test helper method on resource `Refund`
249
443
 
250
444
  ## 5.52.0 - 2022-04-18
251
- * [#1046](https://github.com/stripe/stripe-ruby/pull/1046) [#1047](https://github.com/stripe/stripe-ruby/pull/1047) API Updates
445
+ * [#1046](https://github.com/stripe/stripe-ruby/pull/1046) [#1047](https://github.com/stripe/stripe-ruby/pull/1047) API Updates
252
446
  * Add support for new resources `FundingInstructions` and `Terminal.Configuration`
253
447
 
254
448
  ## 5.51.0 - 2022-04-15
@@ -270,7 +464,7 @@ Breaking changes that arose during code generation of the library that we postpo
270
464
  * [#1040](https://github.com/stripe/stripe-ruby/pull/1040) API Updates
271
465
  * Add support for Search API
272
466
  * Add support for `search` method on resources `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription`
273
-
467
+
274
468
  * [#1034](https://github.com/stripe/stripe-ruby/pull/1034) Add supporting classes for test helper generation
275
469
 
276
470
  ## 5.46.0 - 2022-03-23
data/Gemfile CHANGED
@@ -5,8 +5,7 @@ source "https://rubygems.org"
5
5
  gemspec
6
6
 
7
7
  group :development do
8
- gem "coveralls_reborn", "~> 0.25.0" if RUBY_VERSION >= "3.1"
9
- gem "mocha", "~> 0.13.2"
8
+ gem "mocha", "~> 1.16.0"
10
9
  gem "rack", ">= 2.0.6"
11
10
  gem "rake"
12
11
 
@@ -23,10 +22,12 @@ group :development do
23
22
  # `Gemfile.lock` checked in, so to prevent good builds from suddenly going
24
23
  # bad, pin to a specific version number here. Try to keep this relatively
25
24
  # up-to-date, but it's not the end of the world if it's not.
26
- gem "rubocop", "0.80"
25
+ #
26
+ # The latest version of rubocop is only compatible with Ruby 2.7+
27
+ gem "rubocop", "1.57.2" if RUBY_VERSION >= "2.7"
27
28
 
28
- # jaro_winkler 1.5.5 installation fails for jruby
29
- gem "jaro_winkler", "1.5.4"
29
+ gem "sorbet"
30
+ gem "tapioca"
30
31
 
31
32
  platforms :mri do
32
33
  gem "byebug"
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 --auto-correct
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
- v640
1
+ v1255
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://github.com/stripe/stripe-ruby/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-ruby/actions?query=branch%3Amaster)
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
@@ -23,7 +22,6 @@ See the [Ruby API docs](https://stripe.com/docs/api?lang=ruby).
23
22
 
24
23
  See [video demonstrations][youtube-playlist] covering how to use the library.
25
24
 
26
-
27
25
  ## Installation
28
26
 
29
27
  You don't need this source code unless you want to modify the gem. If you just
@@ -131,17 +129,33 @@ Keep in mind that there are different method signatures depending on the action:
131
129
  `retrieve(id, opts)`. In addition, it will accept a Hash for the `id` param but will extract the
132
130
  `id` key out and use the others as options.
133
131
 
132
+ ### Accessing resource properties
133
+
134
+ Both indexer and accessors can be used to retrieve values of resource properties.
135
+
136
+ ```ruby
137
+ customer = Stripe::Customer.retrieve('cus_123456789')
138
+ puts customer['id']
139
+ puts customer.id
140
+ ```
141
+
142
+ NOTE: If the resource property is not defined, the accessors will raise an exception, while the indexer will return `nil`.
143
+
144
+ ```ruby
145
+ customer = Stripe::Customer.retrieve('cus_123456789')
146
+ puts customer['unknown'] # nil
147
+ puts customer.unknown # raises NoMethodError
148
+ ```
149
+
134
150
  ### Accessing a response object
135
151
 
136
- Get access to response objects by initializing a client and using its `request`
137
- method:
152
+ Get access to response objects by using the `last_response` property of the returned resource:
138
153
 
139
154
  ```ruby
140
- client = Stripe::StripeClient.new
141
- customer, resp = client.request do
142
- Stripe::Customer.retrieve('cus_123456789',)
143
- end
144
- puts resp.request_id
155
+ customer = Stripe::Customer.retrieve('cus_123456789')
156
+
157
+ print(customer.last_response.http_status) # to retrieve status code
158
+ print(customer.last_response.http_headers) # to retrieve headers
145
159
  ```
146
160
 
147
161
  ### Configuring a proxy
@@ -291,10 +305,11 @@ Stripe.set_app_info('MyAwesomePlugin', version: '1.2.34', url: 'https://myawesom
291
305
  This information is passed along when the library makes calls to the Stripe
292
306
  API.
293
307
 
294
- ### Request latency telemetry
308
+ ### Telemetry
295
309
 
296
- By default, the library sends request latency telemetry to Stripe. These
297
- numbers help Stripe improve the overall latency of its API for all users.
310
+ By default, the library sends telemetry to Stripe regarding request latency and feature usage. These
311
+ numbers help Stripe improve the overall latency of its API for all users, and
312
+ improve popular features.
298
313
 
299
314
  You can disable this behavior if you prefer:
300
315
 
@@ -317,10 +332,27 @@ gem install stripe -v 7.1.0.pre.beta.2
317
332
 
318
333
  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
334
 
320
- If your beta feature requires a `Stripe-Version` header to be sent, use the `Stripe.api_version` field to set it:
335
+ If your beta feature requires a `Stripe-Version` header to be sent, set the `Stripe.api_version` field using `Stripe.add_beta_version`:
321
336
 
322
337
  ```python
323
- Stripe.api_version += "; feature_beta=v3"
338
+ Stripe.add_beta_version("feature_beta", "v3")
339
+ ```
340
+
341
+ ### Custom requests
342
+
343
+ If you:
344
+
345
+ - would like to send a request to an undocumented API (for example you are in a private beta)
346
+ - prefer to bypass the method definitions in the library and specify your request details directly,
347
+ - used the method `Stripe::APIResource.request(...)` to specify your own requests, which will soon be broken
348
+
349
+ you can now use the `raw_request` method on `Stripe`.
350
+
351
+ ```ruby
352
+ resp = Stripe.raw_request(:post, "/v1/beta_endpoint", {param: 123}, {stripe_version: "2022-11-15; feature_beta=v3"})
353
+
354
+ # (Optional) resp is a StripeResponse. You can use `Stripe.deserialize` to get a StripeObject.
355
+ deserialized_resp = Stripe.deserialize(resp.http_body)
324
356
  ```
325
357
 
326
358
  ## Support
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "rake/testtask"
4
- require "rubocop/rake_task"
5
4
 
6
5
  task default: %i[test rubocop]
7
6
 
@@ -9,7 +8,10 @@ Rake::TestTask.new do |t|
9
8
  t.pattern = "./test/**/*_test.rb"
10
9
  end
11
10
 
12
- RuboCop::RakeTask.new
11
+ if RUBY_VERSION >= "2.7.0"
12
+ require "rubocop/rake_task"
13
+ RuboCop::RakeTask.new
14
+ end
13
15
 
14
16
  desc "Update bundled certs"
15
17
  task :update_certs do
@@ -17,7 +19,7 @@ task :update_certs do
17
19
  require "uri"
18
20
 
19
21
  fetch_file "https://curl.haxx.se/ca/cacert.pem",
20
- ::File.expand_path("../lib/data/ca-certificates.crt", __FILE__)
22
+ File.expand_path("lib/data/ca-certificates.crt", __dir__)
21
23
  end
22
24
 
23
25
  #
@@ -25,11 +27,11 @@ end
25
27
  #
26
28
 
27
29
  def fetch_file(uri, dest)
28
- ::File.open(dest, "w") do |file|
30
+ File.open(dest, "w") do |file|
29
31
  resp = Net::HTTP.get_response(URI.parse(uri))
30
32
  unless resp.code.to_i == 200
31
33
  abort("bad response when fetching: #{uri}\n" \
32
- "Status #{resp.code}: #{resp.body}")
34
+ "Status #{resp.code}: #{resp.body}")
33
35
  end
34
36
  file.write(resp.body)
35
37
  puts "Successfully fetched: #{uri}"
data/VERSION CHANGED
@@ -1 +1 @@
1
- 10.1.0
1
+ 12.6.0
@@ -5,7 +5,7 @@
5
5
  require "irb"
6
6
  require "irb/completion"
7
7
 
8
- require "#{::File.dirname(__FILE__)}/../lib/stripe"
8
+ require "#{File.dirname(__FILE__)}/../lib/stripe"
9
9
 
10
10
  # Config IRB to enable --simple-prompt and auto indent
11
11
  IRB.conf[:PROMPT_MODE] = :SIMPLE
@@ -35,6 +35,7 @@ module Stripe
35
35
  end
36
36
  end
37
37
 
38
+ # rubocop:disable Metrics/MethodLength
38
39
  private def define_operation(
39
40
  resource,
40
41
  operation,
@@ -53,12 +54,30 @@ module Stripe
53
54
  )
54
55
  end
55
56
  when :retrieve
57
+ # TODO: (Major) Split params_or_opts to params and opts and get rid of the complicated way to add params
56
58
  define_singleton_method(:"retrieve_#{resource}") \
57
- do |id, nested_id, opts = {}|
59
+ do |id, nested_id, params_or_opts = {}, definitely_opts = nil|
60
+ opts = nil
61
+ params = nil
62
+ if definitely_opts.nil?
63
+ unrecognized_key = params_or_opts.keys.find { |k| !Util::OPTS_USER_SPECIFIED.include?(k) }
64
+ if unrecognized_key
65
+ raise ArgumentError,
66
+ "Unrecognized request option: #{unrecognized_key}. Did you mean to specify this as " \
67
+ "retrieve params? " \
68
+ "If so, you must explicitly pass an opts hash as a fourth argument. " \
69
+ "For example: .retrieve(#{id}, #{nested_id}, {#{unrecognized_key}: 'foo'}, {})"
70
+ end
71
+
72
+ opts = params_or_opts
73
+ else
74
+ opts = definitely_opts
75
+ params = params_or_opts
76
+ end
58
77
  request_stripe_object(
59
78
  method: :get,
60
79
  path: send(resource_url_method, id, nested_id),
61
- params: {},
80
+ params: params,
62
81
  opts: opts
63
82
  )
64
83
  end
@@ -96,6 +115,7 @@ module Stripe
96
115
  raise ArgumentError, "Unknown operation: #{operation.inspect}"
97
116
  end
98
117
  end
118
+ # rubocop:enable Metrics/MethodLength
99
119
  end
100
120
  end
101
121
  end