Class: TotalRecall::ParseStrategy::Ing

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.optionsObject



26
27
28
# File 'lib/total_recall.rb', line 26

def self.options
  {:col_sep => ",", :headers => true}
end

Instance Method Details

#optionsObject



30
31
32
# File 'lib/total_recall.rb', line 30

def options
  self.class.options
end

#parse_row(row) ⇒ Object

Expected: Hash with: :amount => Float, :currency => String, :description => String, :date => Date



15
16
17
18
19
20
21
22
23
# File 'lib/total_recall.rb', line 15

def parse_row(row)
  amount = row[6].sub(/,/,'.').to_f
  {
    :amount => (row[5] == 'Bij' ? amount : -amount),
    :date => Date.parse(row[0]),
    :description => [row[1], row[8]].map{|i| i.strip.gsub(/\s+/, ' ')}.join(' '),
    :currency => 'EUR'
  }
end