Class: YnabTw::Cathay::CreditConverter

Inherits:
Object
  • Object
show all
Includes:
YnabTw::Converter
Defined in:
lib/ynab_tw/cathay/credit_converter.rb

Instance Method Summary collapse

Methods included from YnabTw::Converter

#convert, #parse

Instance Method Details

#convert_format(csv) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ynab_tw/cathay/credit_converter.rb', line 14

def convert_format(csv)
  valid_rows = csv.each.reject do |row|
    row["date"].nil?
  end
  valid_rows.each.map do |row|
    [
      row["date"] + DateTime.now.strftime("/%Y"),
      row["info"],
      nil,
      "card_no:#{row["card_no"]}",
      row["withdraw"],
      0,
    ]
  end
end

#input_headersObject



10
11
12
# File 'lib/ynab_tw/cathay/credit_converter.rb', line 10

def input_headers
    %w{date charge_date info withdraw card_no mobi_card_no country currency foreign_amount exchange_date}
end

#useless_header_countObject



6
7
8
# File 'lib/ynab_tw/cathay/credit_converter.rb', line 6

def useless_header_count
  3
end