Last active
March 23, 2016 20:11
-
-
Save duckinator/ef08acbe04aef940a2b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fetch_items(options={}) | |
| limit = options.fetch(:limit) | |
| timestamp = options.fetch(:timestamp) | |
| paged_helper = PagedHelper | |
| client = OurHttpClient | |
| responses = paged_helper. | |
| new(limit, timestamp). | |
| fetch_pages { |params| client.get(params) } | |
| responses. | |
| map { |r| JSON.parse(r) }. | |
| map { |h| ItemCollection.new(h) }. | |
| map { |ic| ic.items }. | |
| flatten | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def fetch_items(options={}) | |
| limit = options.fetch(:limit) | |
| timestamp = options.fetch(:timestamp) | |
| paged_helper = PagedHelper | |
| client = OurHttpClient | |
| responses = paged_helper. | |
| new(limit, timestamp). | |
| fetch_pages { |params| client.get(params) } | |
| responses. | |
| map { |r| | |
| h = JSON.parse(r) | |
| ic = ItemCollection.new(h) | |
| ic.items | |
| }. | |
| flatten | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment