gocardless/gocardless-ruby — pull request #46 by hmarr (2013-07-01 23:13:56+00:00)
Title: Pagination

Examples of usage:

```ruby
subscriptions = merchant.subscriptions(status: :active)

# The total number of subscriptions matched
subscriptions.count

# The number of pages for the set of matched subscriptions
subscriptions.page_count

# Iterate over every subscription, automatically fetching each page's items
subscriptions.each do |subscription|
puts subscription.id
end

# Iterate subscriptions, in batches of 70, fetching each page's items
subscriptions.per_page(70).each do |subscription|
puts subscription.id
end

# Iterate over each subscription in the third page
subscriptions.page(3).each do |subscription|
puts subscription.id
end

# Iterate subscriptions in the third page, where each page has 70 items
subscriptions.per_page(60).page(3).each do |subscription|
puts subscription.id
end

# Iterate over every page, and for each page find every subscription
subscriptions.per_page(10).each_page do |page|
page.each do |subscription|
puts subscription.id
end
end
```