Class: BSB::BankListGenerator

Inherits:
BaseGenerator show all
Defined in:
lib/bsb/bank_list_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



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

def self.load_file(filename)
  client = ::Auspaynet::Client.new('bsb.hostedftp.com')
  content = client.get('~auspaynetftp/BSB', filename)
  hash = {}
  CSV.parse(content) do |row|
    row[2].split(', ').each do |prefix|
      prefix = prefix.chomp.rjust(2, '0')
      hash[prefix] = row[1]
    end
  end
  new(hash)
end