Class: Datahen::CLI::ScraperExport

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details



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

def self.banner(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(options)
  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

#listObject



22
23
24
25
26
27
28
29
30
# File 'lib/datahen/cli/scraper_export.rb', line 22

def list()
  if options[:scraper_name]
    client = Client::ScraperExport.new(options)
    puts "#{client.all(options[:scraper_name])}"
  else
    client = Client::Export.new(options)
    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(options)
  puts "#{client.find(export_id)}"
end