Get just 20 records for :all #33

Closed
abhijitsinha opened this Issue Jan 25, 2012 · 2 comments

Comments

Projects
None yet
2 participants

Chargify::Subscription.find(:all) gives me just 20 records its a bug or functionality?

Member

speric commented Nov 9, 2013

@abhijitsinha The Chargify Subscription API returns 20 records per page by default for this call. From the API docs at http://docs.chargify.com/api-subscriptions, you'll see we accept the following parameters:

page: an integer value which specifies which page of results to fetch, starting at 1. Fetching successively higher page numbers will return additional results, until there are no more results to return (in which case an empty result set will be returned). Defaults to 1.

per_page: how many records to fetch in each request, defaults to 20. The maximum allowed is 200 – any per_page value over 200 will be changed to 200.

You can set these values in the gem like so:

Chargify::Subscription.find(:all, params: { per_page: 50, page: 10 })

speric closed this Nov 9, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment