class CamtParser::Entry
Public Class Methods
new(xml_data)
click to toggle source
# File lib/camt_parser/general/entry.rb, line 3 def initialize(xml_data) @xml_data = xml_data @amount = @xml_data.xpath('Amt/text()').text end
Public Instance Methods
additional_information()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 60 def additional_information @additional_information ||= @xml_data.xpath('AddtlNtryInf/text()').text end
Also aliased as: description
amount()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 8 def amount CamtParser::Misc.to_amount(@amount) end
amount_in_cents()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 12 def amount_in_cents CamtParser::Misc.to_amount_in_cents(@amount) end
bank_reference()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 32 def bank_reference # May be missing @bank_reference ||= @xml_data.xpath('AcctSvcrRef/text()').text end
batch_detail()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 69 def batch_detail @batch_detail ||= @xml_data.xpath('NtryDtls/Btch').empty? ? nil : CamtParser::BatchDetail.new(@xml_data.xpath('NtryDtls/Btch')) end
booked?()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 56 def booked? @booked ||= @xml_data.xpath('Sts/text()').text.upcase == 'BOOK' end
booking_date()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 28 def booking_date @booking_date ||= Date.parse(@xml_data.xpath('BookgDt/Dt/text()').text) end
charges()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 65 def charges @charges ||= CamtParser::Charges.new(@xml_data.xpath('Chrgs')) end
credit?()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 40 def credit? !debit end
currency()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 16 def currency @currency ||= @xml_data.xpath('Amt/@Ccy').text end
debit()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 20 def debit @debit ||= @xml_data.xpath('CdtDbtInd/text()').text.upcase == 'DBIT' end
debit?()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 44 def debit? debit end
reversal?()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 52 def reversal? @reversal ||= @xml_data.xpath('RvslInd/text()').text.downcase == 'true' end
sign()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 48 def sign credit? ? 1 : -1 end
transactions()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 36 def transactions @transactions ||= parse_transactions end
value_date()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 24 def value_date @value_date ||= Date.parse(@xml_data.xpath('ValDt/Dt/text()').text) end
Private Instance Methods
parse_transactions()
click to toggle source
# File lib/camt_parser/general/entry.rb, line 75 def parse_transactions transaction_details = @xml_data.xpath('NtryDtls/TxDtls') amt = nil ccy = nil if transaction_details.length == 1 amt = @xml_data.xpath('Amt/text()').text ccy = @xml_data.xpath('Amt/@Ccy').text end @xml_data.xpath('NtryDtls/TxDtls').map { |x| Transaction.new(x, debit?, amt, ccy) } end