Sha256: d3c986643bf91734afe4b89a7b05c1e6adb0ebeb6888b83dc77ac315b3d983fb

Contents?: true

Size: 1.3 KB

Versions: 1

Compression:

Stored size: 1.3 KB

Contents

# TurkishBanks 

[![Gem Version](https://badge.fury.io/rb/turkish_banks.svg)](http://badge.fury.io/rb/turkish_banks)
[![Code Climate](https://codeclimate.com/github/enderahmetyurt/turkish_support/badges/gpa.svg)](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.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
turkish_banks-1.0.0 README.md