class CamtParser::AccountBalance
Public Class Methods
Source
# File lib/camt_parser/general/account_balance.rb, line 8 def initialize(amount, currency, date, credit = false) @amount = amount @currency = currency @date = date @credit = credit end
@param amount [String] @param currency [String] @param date [String] @param credit [Boolean]
Public Instance Methods
Source
# File lib/camt_parser/general/account_balance.rb, line 36 def amount CamtParser::Misc.to_amount(@amount) end
@return [BigDecimal]
Source
# File lib/camt_parser/general/account_balance.rb, line 41 def amount_in_cents CamtParser::Misc.to_amount_in_cents(@amount) end
@return [Integer]
Source
# File lib/camt_parser/general/account_balance.rb, line 31 def credit? @credit end
@return [Boolean]
Source
# File lib/camt_parser/general/account_balance.rb, line 16 def currency @currency end
@return [String]
Source
# File lib/camt_parser/general/account_balance.rb, line 21 def date Date.parse @date end
@return [Date]
Source
# File lib/camt_parser/general/account_balance.rb, line 26 def sign credit? ? 1 : -1 end
@return [Integer] either 1 or -1
Source
# File lib/camt_parser/general/account_balance.rb, line 46 def signed_amount amount * sign end
@return [BigDecimal]
Source
# File lib/camt_parser/general/account_balance.rb, line 51 def to_h { 'amount' => amount, 'amount_in_cents' => amount_in_cents, 'sign' => sign } end
@return [Hash{String => BigDecimal, Integer}]