Sha256: 6fa06f00cb7395ff52d80a645088564217b59636856421a43a4fea40b8dfd4fd
Contents?: true
Size: 958 Bytes
Versions: 2
Compression:
Stored size: 958 Bytes
Contents
require "turkish_support" module TurkishBanks class TurkishBank using TurkishSupport attr_accessor :last_update_date, :banks BANKS_URL = "http://eftemkt.tcmb.gov.tr/bankasubelistesi/bankaSubeTumListe.xml".freeze def initialize doc = Nokogiri.XML(open(BANKS_URL), nil, 'UTF-8') doc.remove_namespaces! response = Hash.from_xml(doc.to_s) @last_update_date = response["bankaSubeTumListe"]["tarih"] @banks = response["bankaSubeTumListe"]["bankaSubeleri"] end def get_information_of(bank_name) bank = get_bank(bank_name).first["banka"] TurkishBanks::Bank.new bank end def get_branches_of(bank_name) branches = get_bank(bank_name).first["sube"] branches.each do |branch| TurkishBanks::Branch.new branch end end private def get_bank(bank_name) @banks.select {|b| b["banka"]["bAd"] == bank_name.upcase} end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
turkish_banks-0.5.0 | lib/turkish_banks/turkish_bank.rb |
turkish_banks-0.4.0 | lib/turkish_banks/turkish_bank.rb |