NoMethodError: undefined method `auto_paging_each' when listing
mkllnk opened this issue · comments
Describe the bug
The API docs mention auto_paging_each
which works well in v5. After upgrading to v6 or v7, that method is missing from list results. I was first wondering if that was a deliberate decision but the code base still contains the method in ListObject
. That class is just never used to decorate search results. It is also referenced in util.rb which is another hint that it's supposed to be used.
To Reproduce
- Fetch a customer list.
- Iterate over the list with
auto_paging_each
.
Expected behavior
The method should be present in list results and work as described in the docs (fetching more pages if needed).
Code snippets
Stripe::Customer.list({ email: "test@example.net" }, stripe_account: @stripe_account).auto_paging_each do
# ...
end
OS
Debian
Language version
3.0.3
Library version
7.0.0
API version
2022-08-01
Additional context
Please let us know if you intend to remove this feature completely, in which case we will re-implement it in our code, or if you will re-add usage of the ListObject.
Hi @mkllnk, I'm not able to reproduce this error. Could you post the stack trace with the full error message? Thanks!
You could see the error is this comment: openfoodfoundation/openfoodnetwork#9436 (comment)
*** NoMethodError Exception: undefined method `auto_paging_each' for #<Stripe::StripeObject:0x1e58c> JSON: {
"has_more": false,
"data": [
{"id":"cus_A456"}
]
}
@jibees Is this a mocked call? If so, you need to make sure to include "type": "list"
in your mocked response, or we won't parse it as a ListObject
Is this a mocked call? If so, you need to make sure to include "type": "list" in your mocked response, or we won't parse it as a ListObject
Yes! That was the problem. Thank you for looking into this. I updated our mocks and the specs pass. 🙏
Do you have a recommendation for a better test setup? VCR? Puffing Billy?