bin/magento_scrape in magento_remote-0.2.1 vs bin/magento_scrape in magento_remote-0.2.2

- old
+ new

@@ -16,10 +16,13 @@ opts.separator "Magento shop options" opts.on('-b', '--base-uri URI', 'base URI of shop.') do |b| options[:base_uri] = b end + opts.on('-w', '--wait SECONDS', Float, 'SECONDS to wait after each request (default: 0)') do |b| + options[:sleep_time] = b + end opts.separator "" opts.separator "Product options" opts.on('-s', '--start PRODUCT_ID', 'Product ID from which to start scraping') do |s| @@ -69,11 +72,12 @@ end return_code = 0 options[:start_pid] ||= 0 +options[:sleep_time] ||= 0 -matches = mech.scrape_products options[:start_pid].to_i, options[:limit].to_i +matches = mech.scrape_products(options[:start_pid].to_i, options[:limit].to_i, options[:sleep_time]) if matches.nil? puts "Nothing found" else puts Terminal::Table.new :headings => ['Name', 'Product ID', 'In stock?'], :rows => matches end