etsy
etsy copied to clipboard
Pagination in model.rb
What I am trying to do: Get all of the items in a resource (listings, orders, receipts, etc...) But It's always returning 100.
Here is what I noticed:
In https://github.com/kytrinyx/etsy/blob/master/lib/etsy/model.rb, line 46:
limit = [response.count - batch_size - initial_offset, 0].max
In this file:
https://github.com/kytrinyx/etsy/blob/master/lib/etsy/response.rb
Line 35-41:
def count
if paginated?
to_hash['results'].nil? ? 0 : to_hash['results'].size
else
to_hash['count']
end
end
So ---- if there is pagination, it returns COUNT as the size of the results set. Doesn't that means in model.rb, LIMIT will always be <= 0, which means that when you do {:limit => :all}, you are not getting all, which defeats the whole purpose?
Am I missing something here?
In my app, I had to monkeypatch Etsy::Response.paginated? to return "false".
Wow, no I don't think you're imagining things. I am in the middle of some travel, and can't dig into it right now, but I will investigate properly as soon as I can.
Thank you so much for reporting this!