Sdk release/next major (#1374)

This commit is contained in:
Ramya Rao 2024-04-10 16:00:43 -07:00 committed by GitHub
parent 2a45f50bd6
commit 93267e38ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 48 additions and 57 deletions

View File

@ -138,32 +138,32 @@
**⚠️ ACTION REQUIRED: the breaking change in this release likely affects you ⚠️**
* [#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
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).
To successfully upgrade to stripe-ruby v9, you must either
1. **(Recommended) Upgrade your integration to be compatible with API Version `2023-08-16`.**
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.
You can read the [v9 migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v9) for more detailed instructions.
2. **(Alternative option) Specify a version other than `2023-08-16` when initializing `stripe-ruby`.**
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:
```diff
require 'stripe'
Stripe.api_key = "sk_test_..."
+ Stripe.api_version = '2020-08-27'
```
If you were already initializing stripe-ruby with an explicit API Version, upgrading to v9 will not affect your integration.
Read the [v9 migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-guide-for-v9) for more details.
Going forward, each major release of this library will be *pinned* by default to the latest Stripe API Version at the time of release.
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.
## 8.7.0 - 2023-08-10
@ -190,7 +190,7 @@
* [#1225](https://github.com/stripe/stripe-ruby/pull/1225) Downgrade jaro_winkler
* [#1219](https://github.com/stripe/stripe-ruby/pull/1219) Update generated code
Documentation updates.
* [#1215](https://github.com/stripe/stripe-ruby/pull/1215) Update generated code
@ -238,7 +238,7 @@ Breaking changes that arose during code generation of the library that we postpo
refund = Stripe::Refund.retrieve("re_123")
refund.description = "Refund description"
refund.save
# after
Stripe::Refund.update("re_123", description: "Refund description")
```
@ -302,7 +302,7 @@ Breaking changes that arose during code generation of the library that we postpo
* [#1072](https://github.com/stripe/stripe-ruby/pull/1072) Trigger workflows on beta branches
* [#1071](https://github.com/stripe/stripe-ruby/pull/1071) Use request_stripe_object for all requests
* [#1070](https://github.com/stripe/stripe-ruby/pull/1070) API Updates
Switch from using meta-programing to generating explicit methods for custom methods.
* [#1069](https://github.com/stripe/stripe-ruby/pull/1069) chore: Stop special implementation of Account.persons method.
@ -318,15 +318,15 @@ Breaking changes that arose during code generation of the library that we postpo
* 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`
* Add support for `retrieve_payment_method` method on resource `Customer`
* Add support for `list_owners` and `list` methods on resource `FinancialConnections.Account`
## 6.0.0 - 2022-05-09
* [#1056](https://github.com/stripe/stripe-ruby/pull/1056) API Updates
Major version release. The [migration guide](https://github.com/stripe/stripe-ruby/wiki/Migration-Guide-for-v6) contains more information.
(⚠️ = breaking changes):
* ⚠️ Replace the legacy `Order` API with the new `Order` API.
* ⚠️ Replace the legacy `Order` API with the new `Order` API.
* New methods: `cancel`, `list_line_items`, `reopen`, and `submit`
* Removed methods: `pay` and `return_order`
* Removed resources: `OrderItem` and `OrderReturn`
@ -335,7 +335,7 @@ Breaking changes that arose during code generation of the library that we postpo
## 5.55.0 - 2022-05-05
* [#1055](https://github.com/stripe/stripe-ruby/pull/1055) API Updates
* Add support for new resources `FinancialConnections.AccountOwner`, `FinancialConnections.AccountOwnership`, `FinancialConnections.Account`, and `FinancialConnections.Session`
## 5.54.0 - 2022-05-03
* [#1053](https://github.com/stripe/stripe-ruby/pull/1053) API Updates
@ -346,7 +346,7 @@ Breaking changes that arose during code generation of the library that we postpo
* Add support for `expire` test helper method on resource `Refund`
## 5.52.0 - 2022-04-18
* [#1046](https://github.com/stripe/stripe-ruby/pull/1046) [#1047](https://github.com/stripe/stripe-ruby/pull/1047) API Updates
* [#1046](https://github.com/stripe/stripe-ruby/pull/1046) [#1047](https://github.com/stripe/stripe-ruby/pull/1047) API Updates
* Add support for new resources `FundingInstructions` and `Terminal.Configuration`
## 5.51.0 - 2022-04-15
@ -368,7 +368,7 @@ Breaking changes that arose during code generation of the library that we postpo
* [#1040](https://github.com/stripe/stripe-ruby/pull/1040) API Updates
* Add support for Search API
* Add support for `search` method on resources `Charge`, `Customer`, `Invoice`, `PaymentIntent`, `Price`, `Product`, and `Subscription`
* [#1034](https://github.com/stripe/stripe-ruby/pull/1034) Add supporting classes for test helper generation
## 5.46.0 - 2022-03-23

View File

@ -3,6 +3,6 @@
module Stripe
module ApiVersion
CURRENT = "2023-10-16"
CURRENT = "2024-04-10"
end
end

View File

@ -110,7 +110,7 @@ module Stripe
# both socket errors that may represent an intermittent problem and some
# special HTTP statuses.
def self.should_retry?(error,
method:, num_retries:, config: Stripe.config)
num_retries:, config: Stripe.config)
return false if num_retries >= config.max_network_retries
case error
@ -143,15 +143,12 @@ module Stripe
# These 429s are safe to retry.
return true if error.http_status == 429 && error.code == "lock_timeout"
# 500 Internal Server Error
# Retry on 500, 503, and other internal errors.
#
# We only bother retrying these for non-POST requests. POSTs end up
# being cached by the idempotency layer so there's no purpose in
# retrying them.
return true if error.http_status == 500 && method != :post
# 503 Service Unavailable
error.http_status == 503
# Note that we expect the stripe-should-retry header to be false
# in most cases when a 500 is returned, since our idempotency framework
# would typically replay it anyway.
true if error.http_status >= 500
else
false
end
@ -490,7 +487,7 @@ module Stripe
end
http_resp =
execute_request_with_rescues(method, api_base, headers, usage, context) do
execute_request_with_rescues(api_base, headers, usage, context) do
self.class
.default_connection_manager(config)
.execute_request(method, url,
@ -560,7 +557,7 @@ module Stripe
http_status >= 400
end
private def execute_request_with_rescues(method, api_base, headers, usage, context)
private def execute_request_with_rescues(api_base, headers, usage, context)
num_retries = 0
begin
@ -611,7 +608,6 @@ module Stripe
user_data, resp, headers)
if self.class.should_retry?(e,
method: method,
num_retries: num_retries,
config: config)
num_retries += 1

View File

@ -289,42 +289,42 @@ module Stripe
should "retry on Errno::ECONNREFUSED" do
assert StripeClient.should_retry?(Errno::ECONNREFUSED.new,
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry on EOFError" do
assert StripeClient.should_retry?(EOFError.new,
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry on Errno::ECONNRESET" do
assert StripeClient.should_retry?(Errno::ECONNRESET.new,
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry on Errno::ETIMEDOUT" do
assert StripeClient.should_retry?(Errno::ETIMEDOUT.new,
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry on Errno::EHOSTUNREACH" do
assert StripeClient.should_retry?(Errno::EHOSTUNREACH.new,
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry on Net::OpenTimeout" do
assert StripeClient.should_retry?(Net::OpenTimeout.new,
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry on Net::ReadTimeout" do
assert StripeClient.should_retry?(Net::ReadTimeout.new,
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry on SocketError" do
assert StripeClient.should_retry?(SocketError.new,
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry when the `Stripe-Should-Retry` header is `true`" do
@ -335,7 +335,7 @@ module Stripe
# Note we send status 400 here, which would normally not be retried.
assert StripeClient.should_retry?(Stripe::StripeError.new(http_headers: headers,
http_status: 400),
method: :post, num_retries: 0)
num_retries: 0)
end
should "not retry when the `Stripe-Should-Retry` header is `false`" do
@ -346,49 +346,44 @@ module Stripe
# Note we send status 409 here, which would normally be retried.
refute StripeClient.should_retry?(Stripe::StripeError.new(http_headers: headers,
http_status: 409),
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry on a 409 Conflict" do
assert StripeClient.should_retry?(Stripe::StripeError.new(http_status: 409),
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry on a 429 Too Many Requests when lock timeout" do
assert StripeClient.should_retry?(Stripe::StripeError.new(http_status: 429,
code: "lock_timeout"),
method: :post, num_retries: 0)
num_retries: 0)
end
should "retry on a 500 Internal Server Error when non-POST" do
should "retry on a 500 Internal Server Error" do
assert StripeClient.should_retry?(Stripe::StripeError.new(http_status: 500),
method: :get, num_retries: 0)
num_retries: 0)
end
should "retry on a 503 Service Unavailable" do
assert StripeClient.should_retry?(Stripe::StripeError.new(http_status: 503),
method: :post, num_retries: 0)
num_retries: 0)
end
should "not retry at maximum count" do
refute StripeClient.should_retry?(RuntimeError.new,
method: :post, num_retries: Stripe.max_network_retries)
num_retries: Stripe.max_network_retries)
end
should "not retry on a certificate validation error" do
refute StripeClient.should_retry?(OpenSSL::SSL::SSLError.new,
method: :post, num_retries: 0)
num_retries: 0)
end
should "not retry on a 429 Too Many Requests when not lock timeout" do
refute StripeClient.should_retry?(Stripe::StripeError.new(http_status: 429,
code: "rate_limited"),
method: :post, num_retries: 0)
end
should "not retry on a 500 Internal Server Error when POST" do
refute StripeClient.should_retry?(Stripe::StripeError.new(http_status: 500),
method: :post, num_retries: 0)
num_retries: 0)
end
end