sprintly/sprintly-data — pull request #1 by justinabrahms (2014-10-21 22:46:19+00:00)
Title: Paginated item consumer

#### What's this PR do?
Adds the ability to fully populate a collection from the paginated API.
#### Where should the reviewer start?
page_consumer.js
#### How should this be manually tested?
I was using this script for testing. It also required a local modification to up the item limit to 500, which I'll be submitting a PR in the main repo for.

```js
var sprintly = require('sprintly-data')
var client = sprintly.createClient(email, apikey);
var product = client.products.add({id: 1});
product.fetch();
var backlog = product.getItemsByStatus('backlog');
var someday = product.getItemsByStatus('someday');
var all = product.getItemsByStatus('someday,backlog,in-progress,completed,accepted');
var consume = require('sprintly-data/lib/page_consumer');

function timeit(coll, options) {
var start = Number(new Date());
consume(coll, options).then(function () {
var end = Number(new Date());
console.log(end-start, 'ms');
});
}
```
#### Any background context you want to provide?
#### What are the relevant tickets?
Fixes #8218
#### Screenshots (if appropriate)
#### What gif best describes this PR or how it makes you feel?
![](http://cdn.mlkshk.com/r/114D1)
#### Definition of Done:
- [ ] Is there appropriate test coverage? (e.g. ChefSpec, Mocha/Chai, Python, etc.)
- [ ] Does this PR require a Selenium test? (e.g. Browser-specific bugs or complicated UI bugs)
- [ ] Does this PR require a regression test? All fixes require a regression test.
- [ ] Does this PR require a blog post? If so, ensure marketing has signed off on content.
- [ ] Does the [knowledge base](https://sprint.ly/docs) need to be updated?
- [ ] Does this add new dependencies? If so, does Chef, M4, or PIP requirements need to be updated?
- [ ] Will this feature require a new piece of infrastructure be implemented?
- [ ] Are any new services fully automated in Chef?
- [ ] Are there ChefSpec tests for the new Chef recipes/cookbooks?
- [ ] Does this PR require new Mixpanel or GA events?
- [ ] Is there appropriate logging included?