Class: BookmeterExporter::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/bookmeter_exporter/cli.rb', line 11

def exit_on_failure?
  true
end

Instance Method Details

#export(email) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/bookmeter_exporter/cli.rb', line 18

def export(email)
  password = ask("Password for #{email}:", echo: false)
  puts ""

  crawler = BookmeterExporter::Crawler.new(email, password)
  books = crawler.crawl

  destination = options[:destination] || "./books.csv"
  IO.write(destination, books.to_csv)
  puts "Books are successfully exported as '#{destination}'."
end

#versionObject



31
32
33
# File 'lib/bookmeter_exporter/cli.rb', line 31

def version
  puts VERSION
end