Class: Volksbanker::Cli

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

Class Method Summary collapse

Class Method Details

.run(volksbank_file) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/volksbanker/cli.rb', line 8

def self.run(volksbank_file)
  statement = VolksbankFileReader.new(volksbank_file).statement
  statement.transactions.each do |transaction|
    ali = AmexLineItem.new transaction.posting_date, transaction.amount, transaction.description_with_counterparty
    CSV { |out| out << [ali.date, ali.amount, ali.description] }
  end
  $stderr.puts "opening balance: #{statement.opening_balance}"
  $stderr.puts "closing balance: #{statement.closing_balance}"
end