class CamtParser::Record

Attributes

xml_data[R]

Public Class Methods

new(xml_data) click to toggle source
# File lib/camt_parser/general/record.rb, line 6
def initialize(xml_data)
  @xml_data = xml_data
  @amount = xml_data.xpath('Amt/text()').text
end

Public Instance Methods

amount() click to toggle source
# File lib/camt_parser/general/record.rb, line 11
def amount
  CamtParser::Misc.to_amount(@amount)
end
amount_in_cents() click to toggle source
# File lib/camt_parser/general/record.rb, line 15
def amount_in_cents
  CamtParser::Misc.to_amount_in_cents(@amount)
end
charges_included?() click to toggle source
# File lib/camt_parser/general/record.rb, line 27
def charges_included?
  @charges_included ||= xml_data.xpath('ChrgInclInd/text()').text.downcase == 'true'
end
credit?() click to toggle source
# File lib/camt_parser/general/record.rb, line 35
def credit?
  !debit
end
currency() click to toggle source
# File lib/camt_parser/general/record.rb, line 19
def currency
  @currency ||= xml_data.xpath('Amt/@Ccy').text
end
debit() click to toggle source
# File lib/camt_parser/general/record.rb, line 31
def debit
  @debit ||= xml_data.xpath('CdtDbtInd/text()').text.upcase == 'DBIT'
end
debit?() click to toggle source
# File lib/camt_parser/general/record.rb, line 39
def debit?
  debit
end
sign() click to toggle source
# File lib/camt_parser/general/record.rb, line 43
def sign
  credit? ? 1 : -1
end
type() click to toggle source
# File lib/camt_parser/general/record.rb, line 23
def type
  @type ||= CamtParser::Type::Builder.build_type(xml_data.xpath('Tp'))
end