Class: OFXReader::Parser::OFX102
- Inherits:
-
Struct
- Object
- Struct
- OFXReader::Parser::OFX102
- Defined in:
- lib/ofx_reader/parser/ofx_102.rb
Instance Attribute Summary collapse
-
#ofx_body ⇒ Object
Returns the value of attribute ofx_body.
-
#strict ⇒ Object
Returns the value of attribute strict.
Instance Method Summary collapse
Instance Attribute Details
#ofx_body ⇒ Object
Returns the value of attribute ofx_body
3 4 5 |
# File 'lib/ofx_reader/parser/ofx_102.rb', line 3 def ofx_body @ofx_body end |
#strict ⇒ Object
Returns the value of attribute strict
3 4 5 |
# File 'lib/ofx_reader/parser/ofx_102.rb', line 3 def strict @strict end |
Instance Method Details
#account ⇒ Object
9 10 11 12 13 |
# File 'lib/ofx_reader/parser/ofx_102.rb', line 9 def account build_account( build(ofx_body.search('BANKACCTFROM')) ) end |
#build_account(hash) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/ofx_reader/parser/ofx_102.rb', line 15 def build_account(hash) full_account = [ hash.dig(:branchid), hash.dig(:acctid) ].compact.join(' - ') hash[:bankid] = hash[:bankid]. reverse[0..2]. reverse. rjust(3, '0') if hash[:bankid].present? hash.merge!({ full_account: full_account }) if hash.dig(:acctid).present? hash end |
#parse ⇒ Object
4 5 6 7 |
# File 'lib/ofx_reader/parser/ofx_102.rb', line 4 def parse raise OFXReader::OFXWithoutBankAccountError if empty_account? [account, transactions] end |
#transactions ⇒ Object
33 34 35 36 37 |
# File 'lib/ofx_reader/parser/ofx_102.rb', line 33 def transactions ofx_body.search('BANKTRANLIST STMTTRN').map do |node| build(node) end end |