Class: Datahen::CLI::ScraperJobVar
- Inherits:
-
Thor
- Object
- Thor
- Datahen::CLI::ScraperJobVar
- Defined in:
- lib/datahen/cli/scraper_job_var.rb
Class Method Summary collapse
Instance Method Summary collapse
- #list(scraper_name) ⇒ Object
- #set(scraper_name, var_name, value) ⇒ Object
- #show(scraper_name, var_name) ⇒ Object
- #unset(scraper_name, var_name) ⇒ Object
Class Method Details
.banner(command, namespace = nil, subcommand = false) ⇒ Object
6 7 8 |
# File 'lib/datahen/cli/scraper_job_var.rb', line 6 def self.(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 [:job] client = Client::JobVar.new() puts "#{client.all([:job])}" else client = Client::ScraperJobVar.new() 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 [:job] client = Client::JobVar.new() puts "#{client.set([:job], var_name, value, )}" else client = Client::ScraperJobVar.new() puts "#{client.set(scraper_name, var_name, value, )}" 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 [:job] client = Client::JobVar.new() puts "#{client.find([:job], var_name)}" else client = Client::ScraperJobVar.new() 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 [:job] client = Client::JobVar.new() puts "#{client.unset([:job], var_name)}" else client = Client::ScraperJobVar.new() puts "#{client.unset(scraper_name, var_name)}" end end |