turkish_banks 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2896a1196dece64643b787b27775840a4052b85
4
- data.tar.gz: 6f52d3e2280485f50e8173513331996a321bc477
3
+ metadata.gz: 5029ddc0ebe347cd8ad48c7c875fbdbb8a060cf5
4
+ data.tar.gz: 2ebfbeeb4f1f4aa5eaba5f693023f639b8274b09
5
5
  SHA512:
6
- metadata.gz: ef4b2416a568a376d7eee9d7978229bc03d858676e687ac805abd3f75e564e9ce209634889d25d40930ade6e78541c42db03c409646cf56a78747af23b2554c6
7
- data.tar.gz: b22cccd4d51cf1e6fb6de4693681f1697bf518df13ed9c4f8bd9161cd0eb1e4df5e5176be51f4d16b3213d77566ecaf11ecf663b13b634e797ba2e394eadf052
6
+ metadata.gz: d20970cd9349b14f3ef7101116e859499ab1d9a855047c3f55b5df3120d76b93cf08ced2606b63863f9169aa9591c2c44f8d20efee148d11e46b3997686de330
7
+ data.tar.gz: c352d024b79c74fa5ac2ebc9df2a38a0433e9533c14b7d56911d7018800247c482ee7116d57353988d7e9ff073b49a62a96db4d8c685152fb701a1218a26ca3a
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
- # TurkishBanks
1
+ # TurkishBanks
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/turkish_banks.svg)](http://badge.fury.io/rb/turkish_banks)
4
+ [![Code Climate](https://codeclimate.com/github/enderahmetyurt/turkish_support/badges/gpa.svg)](https://codeclimate.com/github/enderahmetyurt/turkish_support)
2
5
 
3
6
  Fetch all banks and their information from http://www.tcmb.gov.tr/.
4
7
 
@@ -21,15 +24,22 @@ Or install it yourself as:
21
24
  ## Usage
22
25
 
23
26
  ```ruby
27
+ # Creates a TurkishBank object
24
28
  turkish_bank = TurkishBanks::TurkishBank.new
25
- # Get last update date
29
+
30
+ # Gets last update date
26
31
  turkish_bank.last_update_date
27
- # Get all banks
32
+
33
+ # Gets all banks
28
34
  turkish_bank.banks
29
- # Get information of a bank with the name
30
- turkish_bank.get_information_of "turkiye cumhuriyeti ziraat bankası a.ş."
31
- # Get branch of the the bank
32
- turkish_bank.get_branches_of "turkiye cumhuriyeti ziraat bankası a.ş."
35
+
36
+ # Returns a bank object
37
+ bank = turkish_bank.get_information_of "türkiye cumhuriyeti ziraat bankası a.ş."
38
+ bank.name # => TÜRKİYE CUMHURİYETİ ZIRAAT BANKASI A.Ş.
39
+
40
+ # Returns a collection of branch objectes
41
+ branches = turkish_bank.get_branches_of "türkiye cumhuriyeti ziraat bankası a.ş."
42
+ branches.first.name # => "ANKARA ŞUBESİ"
33
43
  ```
34
44
 
35
45
  ## TODO
@@ -0,0 +1,12 @@
1
+ module TurkishBanks
2
+ class Bank < TurkishBank
3
+ attr_accessor :name, :code, :city, :address
4
+
5
+ def initialize bank
6
+ @name = bank["bAd"]
7
+ @code = bank["bKd"]
8
+ @city = bank["bIlAd"]
9
+ @address = bank["adr"]
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ module TurkishBanks
2
+ class Branch < TurkishBank
3
+ attr_accessor :name, :code, :bank_code, :city
4
+
5
+ def initialize branch
6
+ @name = branch["sAd"]
7
+ @code = branch["sKd"]
8
+ @bank_code = branch["bKd"]
9
+ @city = branch["bIlAd"]
10
+ end
11
+ end
12
+ end
@@ -1,4 +1,5 @@
1
1
  require "turkish_support"
2
+
2
3
  module TurkishBanks
3
4
  class TurkishBank
4
5
  using TurkishSupport
@@ -15,16 +16,20 @@ module TurkishBanks
15
16
  end
16
17
 
17
18
  def get_information_of bank_name
18
- bank(bank_name).first["banka"]
19
+ bank = get_bank(bank_name).first["banka"]
20
+ TurkishBanks::Bank.new bank
19
21
  end
20
22
 
21
23
  def get_branches_of bank_name
22
- bank(bank_name).first["sube"]
23
- end
24
+ branches = get_bank(bank_name).first["sube"]
25
+ branches.each do |branch|
26
+ TurkishBanks::Branch.new branch
27
+ end
28
+ end
24
29
 
25
30
  private
26
31
 
27
- def bank bank_name
32
+ def get_bank bank_name
28
33
  @banks.select {|b| b["banka"]["bAd"] == bank_name.upcase}
29
34
  end
30
35
  end
@@ -1,3 +1,3 @@
1
1
  module TurkishBanks
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/turkish_banks.rb CHANGED
@@ -6,6 +6,8 @@ require "nokogiri"
6
6
  require "turkish_banks/version"
7
7
 
8
8
  require "turkish_banks/turkish_bank"
9
+ require "turkish_banks/bank"
10
+ require "turkish_banks/branch"
9
11
 
10
12
  module TurkishBanks
11
13
  end
Binary file
@@ -14,7 +14,7 @@ Gem::Specification.new do |spec|
14
14
  # end
15
15
 
16
16
  spec.summary = "Fetch Turkish Banks and their branches."
17
- spec.description = "Fetch the all data about Turkish Banks and theri branches."
17
+ spec.description = "Fetch the all data about Turkish Banks and their branches."
18
18
  spec.homepage = "https://github.com/enderahmetyurt/turkish_banks"
19
19
  spec.license = "MIT"
20
20
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turkish_banks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ender Ahmet Yurt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-03-04 00:00:00.000000000 Z
11
+ date: 2015-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -80,7 +80,7 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
- description: Fetch the all data about Turkish Banks and theri branches.
83
+ description: Fetch the all data about Turkish Banks and their branches.
84
84
  email:
85
85
  - enderyurt@gmail.com
86
86
  executables: []
@@ -98,8 +98,11 @@ files:
98
98
  - bin/console
99
99
  - bin/setup
100
100
  - lib/turkish_banks.rb
101
+ - lib/turkish_banks/bank.rb
102
+ - lib/turkish_banks/branch.rb
101
103
  - lib/turkish_banks/turkish_bank.rb
102
104
  - lib/turkish_banks/version.rb
105
+ - turkish_banks-0.1.0.gem
103
106
  - turkish_banks.gemspec
104
107
  homepage: https://github.com/enderahmetyurt/turkish_banks
105
108
  licenses:
@@ -121,8 +124,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
124
  version: '0'
122
125
  requirements: []
123
126
  rubyforge_project:
124
- rubygems_version: 2.4.5
127
+ rubygems_version: 2.2.1
125
128
  signing_key:
126
129
  specification_version: 4
127
130
  summary: Fetch Turkish Banks and their branches.
128
131
  test_files: []
132
+ has_rdoc: