class Ginko::Bank

Attributes

code[R]
name[R]
name_e[R]
name_h[R]
name_k[R]
name_kana[R]

Public Class Methods

find(code) click to toggle source
# File lib/ginko/bank.rb, line 41
def self.find(code)
  mapper.find_by('code', code)
end
mapper() click to toggle source
# File lib/ginko/bank.rb, line 45
def self.mapper
  @@mapper ||= BankMap.new
end
new(bank_hash={}) click to toggle source
# File lib/ginko/bank.rb, line 7
def initialize(bank_hash={})
  @name = bank_hash.fetch('name')
  @name_h = bank_hash.fetch('name_h')
  @name_k = bank_hash.fetch('name_k')
  @name_e = bank_hash.fetch('name_e')
  @code = bank_hash.fetch('code').to_s
end

Public Instance Methods

branches() click to toggle source
# File lib/ginko/bank.rb, line 15
def branches
  @branches ||= BranchMap.new(@code)
end
fetch(key) click to toggle source
# File lib/ginko/bank.rb, line 33
def fetch(key)
  self.respond_to?(key) ? self.send(key) : nil
end
to_h() click to toggle source
# File lib/ginko/bank.rb, line 19
def to_h
  {
    code: @code,
    name: @name,
    name_h: @name_h,
    name_k: @name_k,
    name_e: @name_e
  }
end
to_json() click to toggle source
# File lib/ginko/bank.rb, line 29
def to_json
  to_h.to_json
end