Class: BankingData::SwissBank

Inherits:
Bank
  • Object
show all
Extended by:
ActiveModel::Naming
Includes:
ActiveModel::AttributeMethods, ActiveModel::Conversion
Defined in:
lib/banking_data/swiss_bank.rb

Constant Summary collapse

LOCALE =
:ch

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from Bank

#initialize, query, where

Constructor Details

This class inherits a constructor from BankingData::Bank

Instance Attribute Details

#bic ⇒ Object

Returns the value of attribute bic.



10
11
12
# File 'lib/banking_data/swiss_bank.rb', line 10

def bic
  @bic
end

#blz ⇒ Object

Returns the value of attribute blz.



10
11
12
# File 'lib/banking_data/swiss_bank.rb', line 10

def blz
  @blz
end

Class Method Details

.all ⇒ Object



16
17
18
# File 'lib/banking_data/swiss_bank.rb', line 16

def all
  @@all ||= get_all
end

.file ⇒ Object



33
34
35
# File 'lib/banking_data/swiss_bank.rb', line 33

def file
  File.dirname(__FILE__) + '/../../data/bcbankenstamm.txt'
end

.get_all ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/banking_data/swiss_bank.rb', line 20

def get_all
  banks = []
  File.read(file, encoding: 'iso-8859-1').lines.each do |line|
    kennzeichen = line[7..10]
    if kennzeichen == '0000'
      blz = line[2..6].strip
      bic = line[284..294]
      banks << new(bic: bic, blz: blz)
    end
  end
  banks
end