https://github.com/enderahmetyurt/turkish_banks
All Turkish Banks and Their Branches
https://github.com/enderahmetyurt/turkish_banks
bank hacktoberfest ruby rubygem turkish
Last synced: 4 months ago
JSON representation
All Turkish Banks and Their Branches
- Host: GitHub
- URL: https://github.com/enderahmetyurt/turkish_banks
- Owner: enderahmetyurt
- License: mit
- Created: 2015-03-04T16:44:56.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2022-10-01T14:28:45.000Z (about 3 years ago)
- Last Synced: 2024-10-31T14:47:14.216Z (about 1 year ago)
- Topics: bank, hacktoberfest, ruby, rubygem, turkish
- Language: Ruby
- Homepage:
- Size: 29.3 KB
- Stars: 28
- Watchers: 5
- Forks: 7
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- stars - enderahmetyurt/turkish_banks - All Turkish Banks and Their Branches (Ruby)
README
# TurkishBanks
[](http://badge.fury.io/rb/turkish_banks)
[](https://codeclimate.com/github/enderahmetyurt/turkish_support)
Fetch all banks and their information from http://www.tcmb.gov.tr/.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'turkish_banks'
```
And then execute:
$ bundle
Or install it yourself as:
$ gem install turkish_banks
## Usage
```ruby
# 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.
```ruby
begin
TurkishBanks::Bank.new('fake bank')
rescue TurkishBanks::BankNotFoundError
# do something here
end
```
## TODO
* Improve search part.
* New features. Please send some pull-request.