Sha256: 2be86fe3cb773e4eb0cf3f8a81f53b206625c15da42dad8240a08f9b7b7a5411

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

module TurkishBanks
  class Bank
    attr_reader :name, :code, :city, :address

    def initialize(bank_name)
      bank_params = TurkishBanks.get_bank_params(bank_name)
      @name    = bank_params['bAd']
      @code    = bank_params['bKd']
      @city    = bank_params['bIlAd']
      @address = bank_params['adr']
    end

    def branches
      nodes = TurkishBanks::DOC.xpath("//sube[bKd= '#{@code}']")
      nodes.map do |node|
        branch_params = Hash.from_xml(node.to_s)['sube']
        TurkishBanks::Branch.new(branch_params)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
turkish_banks-1.0.0 lib/turkish_banks/bank.rb