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

Pagination in model.rb #60

Open
vinhboy opened this issue Jun 6, 2013 · 1 comment
Open

Pagination in model.rb #60

vinhboy opened this issue Jun 6, 2013 · 1 comment

Comments

@vinhboy
Copy link
Collaborator

vinhboy commented Jun 6, 2013

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".

@kytrinyx
Copy link
Collaborator

kytrinyx commented Jun 8, 2013

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!

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

No branches or pull requests

2 participants