Class: Datahen::CLI::ScraperJob

Inherits:
Thor
  • Object
show all
Defined in:
lib/datahen/cli/scraper_job.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



5
6
7
# File 'lib/datahen/cli/scraper_job.rb', line 5

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

Instance Method Details

#cancel(scraper_name) ⇒ Object



41
42
43
44
45
46
47
48
49
# File 'lib/datahen/cli/scraper_job.rb', line 41

def cancel(scraper_name)
  if options[:job]
    client = Client::Job.new(options)
    puts "#{client.cancel(options[:job])}"
  else
    client = Client::ScraperJob.new(options)
    puts "#{client.cancel(scraper_name)}"
  end
end

#delete(scraper_name) ⇒ Object



56
57
58
59
60
61
62
63
64
# File 'lib/datahen/cli/scraper_job.rb', line 56

def delete(scraper_name)
  if options[:job]
    client = Client::Job.new(options)
    puts "#{client.delete(options[:job])}"
  else
    client = Client::ScraperJob.new(options)
    puts "#{client.delete(scraper_name)}"
  end
end

#list(scraper_name) ⇒ Object



30
31
32
33
# File 'lib/datahen/cli/scraper_job.rb', line 30

def list(scraper_name)
  client = Client::ScraperJob.new(options)
  puts "#{client.all(scraper_name)}"
end

#pause(scraper_name) ⇒ Object



87
88
89
90
91
92
93
94
95
# File 'lib/datahen/cli/scraper_job.rb', line 87

def pause(scraper_name)
  if options[:job]
    client = Client::Job.new(options)
    puts "#{client.pause(options[:job], options)}"
  else
    client = Client::ScraperJob.new(options)
    puts "#{client.pause(scraper_name, options)}"
  end
end

#profile(scraper_name) ⇒ Object



131
132
133
134
135
136
137
138
139
# File 'lib/datahen/cli/scraper_job.rb', line 131

def profile(scraper_name)
  if options[:job]
    client = Client::Job.new(options)
    puts "#{client.profile(options[:job])}"
  else
    client = Client::ScraperJob.new(options)
    puts "#{client.profile(scraper_name)}"
  end
end

#resume(scraper_name) ⇒ Object



71
72
73
74
75
76
77
78
79
# File 'lib/datahen/cli/scraper_job.rb', line 71

def resume(scraper_name)
  if options[:job]
    client = Client::Job.new(options)
    puts "#{client.resume(options[:job])}"
  else
    client = Client::ScraperJob.new(options)
    puts "#{client.resume(scraper_name)}"
  end
end

#show(scraper_name) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/datahen/cli/scraper_job.rb', line 12

def show(scraper_name)
  if options[:job]
    client = Client::Job.new(options)
    puts "#{client.find(options[:job], options)}"
  else
    client = Client::ScraperJob.new(options)
    puts "#{client.find(scraper_name, options)}"
  end
end

#sync_schema(scraper_name) ⇒ Object



146
147
148
149
150
151
152
153
154
# File 'lib/datahen/cli/scraper_job.rb', line 146

def sync_schema(scraper_name)
  if options[:job]
    client = Client::Job.new(options)
    puts "#{client.sync_schema(options[:job])}"
  else
    client = Client::ScraperJob.new(options)
    puts "#{client.sync_schema(scraper_name)}"
  end
end

#update(scraper_name) ⇒ Object



116
117
118
119
120
121
122
123
124
# File 'lib/datahen/cli/scraper_job.rb', line 116

def update(scraper_name)
  if options[:job]
    client = Client::Job.new(options)
    puts "#{client.update(options[:job], options)}"
  else
    client = Client::ScraperJob.new(options)
    puts "#{client.update(scraper_name, options)}"
  end
end