aws/aws-sdk-ruby — pull request #314 by trevorrowe (2013-07-19 16:57:02+00:00)
Title: Added support for paging Amazon EC2 reserved instances offerings.

The DescribeInstancesOfferings Amazon EC2 API changed a while back to be paginated. This pull request updates the related collection class to be page through the multiple responses. Calling #each will now make multiple requests. You can also pass `:limit` and `:batch_size` options.

```ruby
AWS.ec2.reserved_instances_offerings.each do |offering|
# makes multiple requests to yield all offerings now
end
```

You can additionally page the results in batches. If you need the next token, this is returned by the enumerable methods `#each`, `#each_batch`, etc.

```ruby
offerings = AWS.ec2.reserved_instances_offerings
options = { :limit => 100, :batch_size => 10 }

do
next_token = offerings.each_batch(options.merge(:next_token => next_token) do |batch|
# batch will be an array of up to 10 items
end
while next_token
```