Module: MxnBanks

Defined in:
lib/mxn_banks.rb,
lib/mxn_banks/bank.rb,
lib/mxn_banks/version.rb

Defined Under Namespace

Classes: Bank

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.from_iban(num) ⇒ Object



5
6
7
8
# File 'lib/mxn_banks.rb', line 5

def self.from_iban(num)
  a = to_hash.select { |b| b[:number] == num.slice(0, 3) }
  Bank.new(a.first)
end

.to_hashObject



10
11
12
13
# File 'lib/mxn_banks.rb', line 10

def self.to_hash
  json_file = File.read(File.join(File.dirname(__FILE__), 'banks.json'))
  @banks ||= JSON.parse(json_file, symbolize_names: true)
end