Class: BankPayments::SwedbankImport::File

Inherits:
Object
  • Object
show all
Defined in:
lib/bank_payments/swedbank_import/file.rb

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ File

Given the a string of file data the sequeces and records are created



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# 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

Instance Attribute Details

#sequencesObject

Returns the value of attribute sequences.



10
11
12
# File 'lib/bank_payments/swedbank_import/file.rb', line 10

def sequences
  @sequences
end