3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/wedding_registry_scraper/registry_scraper.rb', line 3
def scrape(registry_urls=[], options={})
all_products = {}
registry_urls.each do |url|
unless registry = WeddingRegistryScraper::Registries.initialize_registry(url)
raise "Could not initialize registry from url #{url.inspect}"
end
puts "* Loading items from #{registry.class.name.demodulize}..." if options[:log_messages]
products = registry.get_items
puts " Loaded %d items\n" % products.count if options[:log_messages]
all_products.merge!(products)
end
all_products
end
|