class SpecsWatcher::CLI
Public Instance Methods
availability(zip, upc)
click to toggle source
# File lib/specs_watcher/cli.rb, line 49 def availability(zip, upc) results = Availability.search({ zip: zip, upc: upc }) puts results[:title] print_table(SpecsWatcher::Formatter.array_hash_to_table(results[:locations])) rescue SpecsWatcher::SpecsWatcherError => e say(e, :red) end
search(keyword=nil)
click to toggle source
# File lib/specs_watcher/cli.rb, line 25 def search(keyword=nil) searcher_options = options.dup searcher_options.merge!({keyword: keyword}) if keyword results = Searcher.search(searcher_options) if results.any? if options[:format] == 'json' puts results.to_json else print_table(SpecsWatcher::Formatter.array_hash_to_table(results)) end else puts "No Results." end rescue SpecsWatcher::InvalidCategoryError => e say(e, :red) end