Class: AnswersEngine::CLI::JobOutput

Inherits:
Thor
  • Object
show all
Defined in:
lib/answersengine/cli/job_output.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



6
7
8
# File 'lib/answersengine/cli/job_output.rb', line 6

def self.banner(command, namespace = nil, subcommand = false)
  "#{basename} #{@package_name} #{command.usage}"
end

Instance Method Details

#collections(scraper_name) ⇒ Object



55
56
57
58
59
60
61
62
63
64
# File 'lib/answersengine/cli/job_output.rb', line 55

def collections(scraper_name)

  if options[:job]
    client = Client::JobOutput.new(options)
    puts "#{client.collections(options[:job])}"
  else
    client = Client::ScraperJobOutput.new(options)
    puts "#{client.collections(scraper_name)}"
  end
end

#list(scraper_name) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/answersengine/cli/job_output.rb', line 19

def list(scraper_name)
  collection = options.fetch(:collection) { 'default' }
  if options[:job]
    client = Client::JobOutput.new(options)
    puts "#{client.all(options[:job], collection)}"
  else
    client = Client::ScraperJobOutput.new(options)
    puts "#{client.all(scraper_name, collection)}"
  end
end

#show(scraper_name, id) ⇒ Object



37
38
39
40
41
42
43
44
45
46
# File 'lib/answersengine/cli/job_output.rb', line 37

def show(scraper_name, id)
  collection = options.fetch(:collection) { 'default' }
  if options[:job]
    client = Client::JobOutput.new(options)
    puts "#{client.find(options[:job], collection, id)}"
  else
    client = Client::ScraperJobOutput.new(options)
    puts "#{client.find(scraper_name, collection, id)}"
  end
end