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

Stripe::SearchResultObject#_search deprecation warning is shown incorrectly #1319

Closed
valscion opened this issue Feb 2, 2024 · 1 comment
Closed
Labels

Comments

@valscion
Copy link

valscion commented Feb 2, 2024

Describe the bug

The warning

NOTE: Stripe::SearchResultObject#_search is deprecated; use request_stripe_object instead. It will be removed on or after 2024-01.

is shown every time a search is made and auto_paging_each creates a request to Stripe.

To Reproduce

  1. Have some invoices in Stripe account
  2. Run this: Stripe::Invoice.search({ query: 'created>0', limit: 1 }).auto_paging_each.find { false }
  3. The deprecation warning is shown once for every request that stripe-ruby does internally

Expected behavior

No deprecation warning visible

Code snippets

Stripe::Invoice.search({ query: 'created>0', limit: 1 }).auto_paging_each.find { false }
NOTE: Stripe::SearchResultObject#_search is deprecated; use request_stripe_object instead. It will be removed on or after 2024-01.
Stripe::SearchResultObject#_search called from /Users/vesa/.rbenv/versions/3.1.4/lib/ruby/gems/3.1.0/gems/stripe-10.7.0/lib/stripe/search_result_object.rb:83.

OS

Linux and macOS both

Language version

Ruby 3.1.4

Library version

10.7.0

API version

2023-10-16

Additional context

The deprecation was added in this PR:

The code that triggers the deprecation warning is this one:

# Fetches the next page in the resource list (if there is one).
#
# This method will try to respect the limit of the current page. If none
# was given, the default limit will be fetched again.
def next_search_result_page(params = {}, opts = {})
return self.class.empty_search_result(opts) unless has_more
params = filters.merge(page: next_page).merge(params)
_search(url, params, opts)
end

@anniel-stripe
Copy link
Contributor

Thanks for the bug report! Fixed in patch v10.7.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