Class: CamtParser::AccountBalance
- Inherits:
-
Object
- Object
- CamtParser::AccountBalance
- Defined in:
- lib/camt_parser/general/account_balance.rb
Instance Method Summary collapse
- #amount ⇒ Object
- #amount_in_cents ⇒ Object
- #credit? ⇒ Boolean
- #currency ⇒ Object
- #date ⇒ Object
-
#initialize(amount, currency, date, credit = false) ⇒ AccountBalance
constructor
A new instance of AccountBalance.
- #sign ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(amount, currency, date, credit = false) ⇒ AccountBalance
Returns a new instance of AccountBalance.
4 5 6 7 8 9 |
# File 'lib/camt_parser/general/account_balance.rb', line 4 def initialize(amount, currency, date, credit = false) @amount = amount @currency = currency @date = date @credit = credit end |
Instance Method Details
#amount ⇒ Object
27 28 29 |
# File 'lib/camt_parser/general/account_balance.rb', line 27 def amount CamtParser::Misc.to_amount(@amount) end |
#amount_in_cents ⇒ Object
31 32 33 |
# File 'lib/camt_parser/general/account_balance.rb', line 31 def amount_in_cents CamtParser::Misc.to_amount_in_cents(@amount) end |
#credit? ⇒ Boolean
23 24 25 |
# File 'lib/camt_parser/general/account_balance.rb', line 23 def credit? @credit end |
#currency ⇒ Object
11 12 13 |
# File 'lib/camt_parser/general/account_balance.rb', line 11 def currency @currency end |
#date ⇒ Object
15 16 17 |
# File 'lib/camt_parser/general/account_balance.rb', line 15 def date Date.parse @date end |
#sign ⇒ Object
19 20 21 |
# File 'lib/camt_parser/general/account_balance.rb', line 19 def sign credit? ? 1 : -1 end |
#to_h ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/camt_parser/general/account_balance.rb', line 35 def to_h { 'amount' => amount, 'amount_in_cents' => amount_in_cents, 'sign' => sign } end |