Module: ZenginCode

Defined in:
lib/zengin_code.rb,
lib/zengin_code/version.rb

Defined Under Namespace

Classes: Bank, Branch

Constant Summary collapse

ROOT_DIR =
Pathname.new(File.expand_path(__FILE__)).join('../../..')
DATA_DIR =
ROOT_DIR.join('source-data', 'data')
GEM_VERSION =
'1.0.1'
VERSION =
version

Class Method Summary collapse

Class Method Details

.preload!Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/zengin_code.rb', line 8

def preload!
  banks = JSON.load(File.read(DATA_DIR.join('banks.json')))

  banks.values.each do |bank|
    ZenginCode::Bank.new(bank)
  end

  ZenginCode::Bank.all.each_pair do |code, bank|
    branches = JSON.load(File.read(DATA_DIR.join("branches/#{code}.json")))

    branches.values.each do |branch|
      branch = ZenginCode::Branch.new(bank, branch)
      bank.branches[branch.code] = branch
    end
  end
end

.versionObject



8
9
10
# File 'lib/zengin_code/version.rb', line 8

def self.version
  "#{GEM_VERSION}-p#{File.read(DATA_DIR.join('updated_at')).strip}"
end