项目作者: enderahmetyurt

项目描述 :
All Turkish Banks and Their Branches
高级语言: Ruby
项目地址: git://github.com/enderahmetyurt/turkish_banks.git
创建时间: 2015-03-04T16:44:56Z
项目社区:https://github.com/enderahmetyurt/turkish_banks

开源协议:MIT License

下载


TurkishBanks

Gem Version
Code Climate

Fetch all banks and their information from http://www.tcmb.gov.tr/.

Installation

Add this line to your application’s Gemfile:

  1. gem 'turkish_banks'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install turkish_banks

Usage

  1. # Gets last update date
  2. TurkishBanks::LAST_UPDATE
  3. # Gets all banks
  4. TurkishBanks.banks
  5. # Create a bank from its name
  6. bank = TurkishBanks::Bank.new("türkiye cumhuriyeti ziraat bankası a.ş.")
  7. bank.name # => "TÜRKİYE CUMHURİYETİ ZIRAAT BANKASI A.Ş."
  8. # Get a collection of branch objects
  9. branches = bank.branches
  10. branches.first.name # => "MERKEZ/ANKARA ŞUBESİ"
  11. 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.

  1. begin
  2. TurkishBanks::Bank.new('fake bank')
  3. rescue TurkishBanks::BankNotFoundError
  4. # do something here
  5. end

TODO

  • Improve search part.
  • New features. Please send some pull-request.