lib/fletcher/cli/utility.rb in fletcher-0.6.5 vs lib/fletcher/cli/utility.rb in fletcher-0.6.6
- old
+ new
@@ -10,20 +10,10 @@
desc 'fetch [URL]', "Fetch Product information\n\n" +
"Example:\n\s\sfletcher fetch 'http://www.amazon.com/gp/product/B004HZYA6E/'"
def fetch(url)
product = Fletcher.fetch url
- if options[:debug]
- puts "=======================================\n"
- puts "START RESPONSE"
- puts "=======================================\n"
- puts product.doc.to_s
- puts "=======================================\n"
- puts "END RESPONSE"
- puts "=======================================\n"
- end
-
# Prep output
output_hash = Hash.new
output_hash["name"] = product.name
output_hash["description"] = product.description if product.description
output_hash["price"] = product.price.format if product.price
@@ -43,9 +33,15 @@
end
value ? say(value.to_s) : say("Unknown attribute: #{options[:only]}")
else
say output_hash.to_yaml
end
+
+ if options[:debug]
+ say "user_agent: #{Fletcher::USER_AGENT}"
+ say "response:\n\n"
+ say product.doc.to_s
+ end
end
desc "websites", "Get a list of supported websites"
def websites
say "Supported Websites:"