Class: TurkishBanks::TurkishBank
- Inherits:
-
Object
- Object
- TurkishBanks::TurkishBank
- Defined in:
- lib/turkish_banks/turkish_bank.rb
Constant Summary collapse
- BANKS_URL =
"http://eftemkt.tcmb.gov.tr/bankasubelistesi/bankaSubeTumListe.xml".freeze
Instance Attribute Summary collapse
-
#banks ⇒ Object
Returns the value of attribute banks.
-
#last_update_date ⇒ Object
Returns the value of attribute last_update_date.
Instance Method Summary collapse
- #get_branches_of(bank_name) ⇒ Object
- #get_information_of(bank_name) ⇒ Object
-
#initialize ⇒ TurkishBank
constructor
A new instance of TurkishBank.
Constructor Details
#initialize ⇒ TurkishBank
Returns a new instance of TurkishBank.
10 11 12 13 14 15 16 |
# File 'lib/turkish_banks/turkish_bank.rb', line 10 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 |
Instance Attribute Details
#banks ⇒ Object
Returns the value of attribute banks.
6 7 8 |
# File 'lib/turkish_banks/turkish_bank.rb', line 6 def banks @banks end |
#last_update_date ⇒ Object
Returns the value of attribute last_update_date.
6 7 8 |
# File 'lib/turkish_banks/turkish_bank.rb', line 6 def last_update_date @last_update_date end |
Instance Method Details
#get_branches_of(bank_name) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/turkish_banks/turkish_bank.rb', line 23 def get_branches_of(bank_name) branches = get_bank(bank_name).first["sube"] branches.each do |branch| TurkishBanks::Branch.new branch end end |
#get_information_of(bank_name) ⇒ Object
18 19 20 21 |
# File 'lib/turkish_banks/turkish_bank.rb', line 18 def get_information_of(bank_name) bank = get_bank(bank_name).first["banka"] TurkishBanks::Bank.new bank end |