Class: BSB::DatabaseGenerator

Inherits:
BaseGenerator show all
Defined in:
lib/bsb/database_generator.rb

Class Method Summary collapse

Methods inherited from BaseGenerator

#initialize, #json, latest_file

Constructor Details

This class inherits a constructor from BSB::BaseGenerator

Class Method Details

.load_file(filename) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bsb/database_generator.rb', line 7

def self.load_file(filename)
  client = ::Auspaynet::Client.new('bsb.hostedftp.com')
  content = client.get('~auspaynetftp/BSB', filename)
  hash = {}
  content.each_line do |line|
    next if line[3] != '-'

    bsb = line[0, 3] + line[4, 3]
    hash[bsb] =
      [line[7, 3], line[10, 35].strip, line[45, 35].strip, line[80, 20].strip, line[100, 3].strip, line[103, 4],
       line[107, 3]]
  end
  new(hash)
end