Class: ADPDownloader::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/adp-downloader/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(arguments) ⇒ Runner

Returns a new instance of Runner.



6
7
8
# File 'lib/adp-downloader/runner.rb', line 6

def initialize(arguments)
  @arguments = arguments
end

Instance Method Details

#runObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/adp-downloader/runner.rb', line 10

def run
  parse_options
  begin
    downloader = Downloader.new(HttpClient.new)
    downloader.get_statements('pay', downloader.pay_statements)
    # FIXME: downloading tax statements requires extra steps :(
    # downloader.get_statements('tax', downloader.tax_statements)
  rescue Exception => e
    path = log_exception_to_file(e)
    puts "An error ocurred: #{e}"
    puts "Details were logged to #{path}"
    exit 1
  end
end