Class: Datahen::CLI::ScraperJobVar

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



6
7
8
# File 'lib/datahen/cli/scraper_job_var.rb', line 6

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

Instance Method Details

#list(scraper_name) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/datahen/cli/scraper_job_var.rb', line 17

def list(scraper_name)
  if options[:job]
    client = Client::JobVar.new(options)
    puts "#{client.all(options[:job])}"
  else
    client = Client::ScraperJobVar.new(options)
    puts "#{client.all(scraper_name)}"
  end
end

#set(scraper_name, var_name, value) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/datahen/cli/scraper_job_var.rb', line 35

def set(scraper_name, var_name, value)
  if options[:job]
    client = Client::JobVar.new(options)
    puts "#{client.set(options[:job], var_name, value, options)}"
  else
    client = Client::ScraperJobVar.new(options)
    puts "#{client.set(scraper_name, var_name, value, options)}"
  end
end

#show(scraper_name, var_name) ⇒ Object



47
48
49
50
51
52
53
54
55
# File 'lib/datahen/cli/scraper_job_var.rb', line 47

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

#unset(scraper_name, var_name) ⇒ Object



59
60
61
62
63
64
65
66
67
# File 'lib/datahen/cli/scraper_job_var.rb', line 59

def unset(scraper_name, var_name)
  if options[:job]
    client = Client::JobVar.new(options)
    puts "#{client.unset(options[:job], var_name)}"
  else
    client = Client::ScraperJobVar.new(options)
    puts "#{client.unset(scraper_name, var_name)}"
  end
end