chargify / chargify_api_ares

A Chargify API wrapper for Ruby using ActiveResource
http://chargify.com
MIT License
161 stars 95 forks source link

Get just 20 records for :all #33

Closed abhijitsinha closed 10 years ago

abhijitsinha commented 12 years ago

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

speric commented 10 years ago

@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 })
abhijitsinha commented 10 years ago

Thanks @speric