Class: Statementor::Transaction
- Inherits:
-
Object
- Object
- Statementor::Transaction
- Defined in:
- lib/statementor/transaction.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#account ⇒ Object
readonly
Client account.
-
#amount ⇒ Object
readonly
Amount.
-
#commission_fee ⇒ Object
readonly
Commission fee.
-
#counterparty_account ⇒ Object
readonly
Beneficiary’s/remitter’s account.
-
#counterparty_bank_code ⇒ Object
readonly
Code of beneficiary’s/remitter’s bank.
-
#counterparty_name ⇒ Object
readonly
Beneficiary’s/remitter’s name.
-
#date ⇒ Object
readonly
Date.
-
#description ⇒ Object
readonly
Description.
-
#doc_no ⇒ Object
readonly
Document number.
-
#id ⇒ Object
readonly
Archiving ID.
-
#kind ⇒ Object
readonly
Debit/Credit (D/C).
-
#ref_no ⇒ Object
readonly
Reference number.
-
#remitter_id_code ⇒ Object
readonly
Remitter’s Reg.
Instance Method Summary collapse
- #credit? ⇒ Boolean
- #debit? ⇒ Boolean
-
#initialize(raw_data) ⇒ Transaction
constructor
A new instance of Transaction.
Constructor Details
#initialize(raw_data) ⇒ Transaction
Returns a new instance of Transaction.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/statementor/transaction.rb', line 44 def initialize(raw_data) @id = raw_data[10] @kind = raw_data[7] @date = Date::parse(raw_data[2]) @amount = "#{raw_data[8]} #{raw_data[13]}".to_money.abs @account = raw_data[0] @counterparty_account = raw_data[3] @counterparty_name = raw_data[4] @counterparty_bank_code = raw_data[5] @doc_no = raw_data[1] @ref_no = raw_data[9] @description = raw_data[11] @commission_fee = raw_data[12] @remitter_id_code = raw_data[14] end |
Instance Attribute Details
#account ⇒ Object (readonly)
Client account
18 19 20 |
# File 'lib/statementor/transaction.rb', line 18 def account @account end |
#amount ⇒ Object (readonly)
Amount
15 16 17 |
# File 'lib/statementor/transaction.rb', line 15 def amount @amount end |
#commission_fee ⇒ Object (readonly)
Commission fee
39 40 41 |
# File 'lib/statementor/transaction.rb', line 39 def commission_fee @commission_fee end |
#counterparty_account ⇒ Object (readonly)
Beneficiary’s/remitter’s account
21 22 23 |
# File 'lib/statementor/transaction.rb', line 21 def counterparty_account @counterparty_account end |
#counterparty_bank_code ⇒ Object (readonly)
Code of beneficiary’s/remitter’s bank
27 28 29 |
# File 'lib/statementor/transaction.rb', line 27 def counterparty_bank_code @counterparty_bank_code end |
#counterparty_name ⇒ Object (readonly)
Beneficiary’s/remitter’s name
24 25 26 |
# File 'lib/statementor/transaction.rb', line 24 def counterparty_name @counterparty_name end |
#date ⇒ Object (readonly)
Date
12 13 14 |
# File 'lib/statementor/transaction.rb', line 12 def date @date end |
#description ⇒ Object (readonly)
Description
36 37 38 |
# File 'lib/statementor/transaction.rb', line 36 def description @description end |
#doc_no ⇒ Object (readonly)
Document number
30 31 32 |
# File 'lib/statementor/transaction.rb', line 30 def doc_no @doc_no end |
#id ⇒ Object (readonly)
Archiving ID
6 7 8 |
# File 'lib/statementor/transaction.rb', line 6 def id @id end |
#kind ⇒ Object (readonly)
Debit/Credit (D/C)
9 10 11 |
# File 'lib/statementor/transaction.rb', line 9 def kind @kind end |
#ref_no ⇒ Object (readonly)
Reference number
33 34 35 |
# File 'lib/statementor/transaction.rb', line 33 def ref_no @ref_no end |
#remitter_id_code ⇒ Object (readonly)
Remitter’s Reg. or ID code
42 43 44 |
# File 'lib/statementor/transaction.rb', line 42 def remitter_id_code @remitter_id_code end |
Instance Method Details
#credit? ⇒ Boolean
64 65 66 |
# File 'lib/statementor/transaction.rb', line 64 def credit? kind == 'C' end |
#debit? ⇒ Boolean
60 61 62 |
# File 'lib/statementor/transaction.rb', line 60 def debit? kind == 'D' end |