Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v13 regression: stripe_version no longer supported as option in ApiResource.retrieve. #1482

Closed
AnotherJoSmith opened this issue Nov 6, 2024 · 2 comments
Assignees
Labels

Comments

@AnotherJoSmith
Copy link
Contributor

AnotherJoSmith commented Nov 6, 2024

Describe the bug

Before v13, we were able to pass stripe_version as option when calling something like Stripe::PaymentMethod.retrieve(id, stripe_version: '2022-11-15'). This is being ignored as of v13.

I'm pretty confident that this was introduced by changing how opts are handled between v12 and v13.

In v12, the gem would call RequestOptions.extract_opts_from_hash(opts) on whatever was passed in as options in the call to .retrieve.

req_opts = RequestOptions.extract_opts_from_hash(opts)

This would allow any of these keys to be passed into the method call

OPTS_USER_SPECIFIED = Set[
:api_key,
:idempotency_key,
:stripe_account,
:stripe_context,
:stripe_version
].freeze

In v13 however, a different method is used: RequestOptions.combine_opts(object.instance_variable_get(:@opts), opts)

opts = RequestOptions.combine_opts(object.instance_variable_get(:@opts), opts)

In this case the opts passed to retrieve only make their way to ApiRequestor as instance variables. And in combine_opts we only allow the key api_version to be used from the object opts.

stripe_version: req_opts[:stripe_version] || object_opts[:api_version],

To Reproduce

  1. Call a method like `Stripe::PaymentMethod.retrieve(id, stripe_version: '2022-11-15').
  2. See that the API version is being set to whatever the default is for the gem Stripe. api_version

Expected behavior

I would expect the API version to work the same way as before v13 since this was not mentioned as a breaking change.

Code snippets

No response

OS

macOS

Language version

Ruby 3.4

Library version

stripe-ruby v.13.1.0

API version

Any

Additional context

No response

@AnotherJoSmith
Copy link
Contributor Author

cc @helenye-stripe

@helenye-stripe
Copy link
Contributor

Sorry for the troubles with this upgrade. This should be fixed in the newest release v13.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants