Class: BankAccountStatement::Inputs::HTML::CPBKGB22::Personal::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/bank-account-statement/inputs/HTML/CPBKGB22/Personal/base.rb

Direct Known Subclasses

CreditCard::Base, Current::Base

Constant Summary

Constants inherited from Base

Base::FILE_EXT

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods inherited from Base

formats, inherited, #parse

Constructor Details

This class inherits a constructor from BankAccountStatement::Inputs::HTML::Base

Instance Method Details

#accountObject



12
13
14
15
16
17
# File 'lib/bank-account-statement/inputs/HTML/CPBKGB22/Personal/base.rb', line 12

def 
  {
    :id   => [:account_id],
    :type => self.class::ACCOUNT_TYPE,
  }
end

#currencyObject



19
20
21
# File 'lib/bank-account-statement/inputs/HTML/CPBKGB22/Personal/base.rb', line 19

def currency
  :GBP
end

#transactionsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/bank-account-statement/inputs/HTML/CPBKGB22/Personal/base.rb', line 23

def transactions
  _transaction_rows.map { |r|
    begin
      posted_at = Date.parse(r[self.class::TH[:date]])
    rescue ArgumentError
      next # annotation line
    end
    
    a = if self.class::TH.has_key?(:amount)
      _clean_amount(r[self.class::TH[:amount]])
    else
      _transaction_amount(
        r[self.class::TH[:deposit]],
        r[self.class::TH[:withdrawal]]
      )
    end
    
    {
      :posted_at => posted_at,
      :type      => _transaction_type(r[self.class::TH[:desc]], a),
      :name      => r[self.class::TH[:desc]].strip,
      :amount    => a,
    }
  }.compact
end