Module: ITunesCrawler::StorefrontFetcher::Fetcher
- Includes:
- Retryable
- Included in:
- ITunesCrawler::StorefrontFetcher
- Defined in:
- lib/itunes_crawler/storefront_fetcher/fetcher.rb
Instance Method Summary collapse
-
#fetch(itunes_ids, country_code) ⇒ Object
Download iTunes item data.
Methods included from Retryable
Instance Method Details
#fetch(itunes_ids, country_code) ⇒ Object
Download iTunes item data
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/itunes_crawler/storefront_fetcher/fetcher.rb', line 12 def fetch(itunes_ids, country_code) # Save iTunes IDs to an array ( ( queue ||= [] ) << itunes_ids ).flatten! # Slice the array to multiple arrays with size of 200 chunks = queue.each_slice( 200 ).to_a chunks.each do |chunk| add_url_to_queue "https://itunes.apple.com/lookup?id=#{chunk.join(",")}&country=#{country_code}", false end @hydra.run end |