Class: ZipRecruiter::JobAlerts::CLI
- Inherits:
-
Thor
- Object
- Thor
- ZipRecruiter::JobAlerts::CLI
- Defined in:
- lib/zip_recruiter/job_alerts/cli.rb
Class Method Summary collapse
-
.banner(command, namespace = nil, subcommand = nil) ⇒ Object
Hack to override the help message produced by Thor.
Instance Method Summary collapse
Class Method Details
.banner(command, namespace = nil, subcommand = nil) ⇒ Object
Hack to override the help message produced by Thor. github.com/wycats/thor/issues/261#issuecomment-16880836
12 13 14 |
# File 'lib/zip_recruiter/job_alerts/cli.rb', line 12 def self.(command, namespace = nil, subcommand = nil) "#{basename} jobalerts #{command.usage}" end |
Instance Method Details
#status(task_id) ⇒ Object
41 42 43 44 45 |
# File 'lib/zip_recruiter/job_alerts/cli.rb', line 41 def status(task_id) ZipRecruiter::API.api_key = [:api_key] unless [:api_key].nil? response = ZipRecruiter::JobAlerts::API.status(task_id) puts JSON.pretty_generate(JSON.parse(response)) unless response.nil? end |
#subscribe(path) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/zip_recruiter/job_alerts/cli.rb', line 19 def subscribe(path) ZipRecruiter::API.api_key = [:api_key] unless [:api_key].nil? if File.exists?(path) response = ZipRecruiter::JobAlerts::API.subscribe(path) puts JSON.pretty_generate(JSON.parse(response)) unless response.nil? else puts "File \"#{path}\" does not exist." end end |
#unsubscribe(path) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/zip_recruiter/job_alerts/cli.rb', line 30 def unsubscribe(path) ZipRecruiter::API.api_key = [:api_key] unless [:api_key].nil? if File.exists?(path) response = ZipRecruiter::JobAlerts::API.unsubscribe(path) puts JSON.pretty_generate(JSON.parse(response)) unless response.nil? else puts "File \"#{path}\" does not exist." end end |