Awesome
TurkishBanks
Fetch all banks and their information from http://www.tcmb.gov.tr/.
Installation
Add this line to your application's Gemfile:
gem 'turkish_banks'
And then execute:
$ bundle
Or install it yourself as:
$ gem install turkish_banks
Usage
# Gets last update date
TurkishBanks::LAST_UPDATE
# Gets all banks
TurkishBanks.banks
# Create a bank from its name
bank = TurkishBanks::Bank.new("türkiye cumhuriyeti ziraat bankası a.ş.")
bank.name # => "TÜRKİYE CUMHURİYETİ ZIRAAT BANKASI A.Ş."
# Get a collection of branch objects
branches = bank.branches
branches.first.name # => "MERKEZ/ANKARA ŞUBESİ"
branches.size # => 1791
Exception Handling
If you pass the wrong bank name to Bank#new
, it raises TurkishBanks::BankNotFoundError
exception. You can rescue this error, then do something else.
begin
TurkishBanks::Bank.new('fake bank')
rescue TurkishBanks::BankNotFoundError
# do something here
end
TODO
- Improve search part.
- New features. Please send some pull-request.