Class: Datahen::CLI::ScraperExport
- Inherits:
-
Thor
- Object
- Thor
- Datahen::CLI::ScraperExport
- Defined in:
- lib/datahen/cli/scraper_export.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.banner(command, namespace = nil, subcommand = false) ⇒ Object
5 6 7 |
# File 'lib/datahen/cli/scraper_export.rb', line 5 def self.(command, namespace = nil, subcommand = false) "#{basename} #{@package_name} #{command.usage}" end |
Instance Method Details
#download(export_id) ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/datahen/cli/scraper_export.rb', line 33 def download(export_id) client = Client::ScraperExport.new() result = JSON.parse(client.download(export_id).to_s) if result['signed_url'] puts "Download url: \"#{result['signed_url']}\"" begin `open "#{result['signed_url']}"` rescue end else puts "Exported file does not exist" end end |
#list ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'lib/datahen/cli/scraper_export.rb', line 22 def list() if [:scraper_name] client = Client::ScraperExport.new() puts "#{client.all([:scraper_name])}" else client = Client::Export.new() puts "#{client.all}" end end |
#show(export_id) ⇒ Object
10 11 12 13 |
# File 'lib/datahen/cli/scraper_export.rb', line 10 def show(export_id) client = Client::ScraperExport.new() puts "#{client.find(export_id)}" end |