class BankPayments::SwedbankImport::File
Contains payments that have been made at the bank for a particular date. This maps to multiple export files created ealier. It will contain up to all payments requested earlier. When payouts fail the informaiton must be generated elsewhere.
@author Michael Litton
Attributes
sequences[RW]
Public Class Methods
new(data)
click to toggle source
Given the a string of file data the sequeces and records are created
# File lib/bank_payments/swedbank_import/file.rb, line 14 def initialize(data) @sequences = [] current_sequence = nil data.gsub(/(\r|\n)+/,"\n").each_line do |raw_record| if opening_post?(raw_record) current_sequence = Sequence.new current_sequence << raw_record @sequences << current_sequence else current_sequence << raw_record end end end
Private Instance Methods
opening_post?(raw_record)
click to toggle source
# File lib/bank_payments/swedbank_import/file.rb, line 31 def opening_post?(raw_record) raw_record[0] == '0' end