turkish_banks 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 7a80baf063a00e72b52432962210edf7e968edd0
4
- data.tar.gz: 4f766321ddd487b92384e01420dfdea4f491d685
2
+ SHA256:
3
+ metadata.gz: 507f9a4bb17809fdf68a95947bb937759701a2f4f0267df1efb769187bdcfee8
4
+ data.tar.gz: 5a6d1c8c8fe43d984b7028f0c41526a898a730bac0dee0b8c1814d02b33b255f
5
5
  SHA512:
6
- metadata.gz: 217556656643e20256dad4a31eae79666669ab21ca597381d96dce5f97eb9f57cd5f2f7305ea402f7060000c6a91e907a40030bc748274fe8324fe8206b76938
7
- data.tar.gz: 8353e29491ea41fd1c0c6de1b7f47d3260107ef2ec4ff7655e9f6f80b83f436b0e19894812871bea9f8ea74b6ddff7e5676ac14ecf64584e36728473625889b5
6
+ metadata.gz: '08c7a3f09d95afef0e09da7c5980e392e0b8768e9e3ed2e179ea0af90380fa7ae3f986c8b60f5aefea59f5d288121618e7280bb83d3023e67a620ffb606ba893'
7
+ data.tar.gz: 0163fc54c49b07bb180b940ad2d3219fde863ce77beba7e54c4b2a2677441d24faff68e2ccc24df897ae5dd76dda92bd0ee662a273ec062afc0ffebe13af8313
@@ -1,3 +1,9 @@
1
1
  language: ruby
2
+ dist: trusty
2
3
  rvm:
3
- - 2.2.0
4
+ - 2.5.5
5
+ - 2.6.3
6
+ - 2.7.0
7
+ before_install:
8
+ - gem install bundler
9
+ script: bundle exec rspec spec
data/Gemfile CHANGED
@@ -4,6 +4,6 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  group :development, :test do
7
- gem 'pry', '~> 0.10.0'
8
- gem 'rspec', '>= 2.14'
7
+ gem 'pry', '~> 0.13.1'
8
+ gem 'rspec', '>= 3.9.0'
9
9
  end
data/README.md CHANGED
@@ -46,11 +46,3 @@ branches.first.name # => "ANKARA ŞUBESİ"
46
46
 
47
47
  * Improve search part.
48
48
  * New features. Please send some pull-request.
49
-
50
- ## Contributing
51
-
52
- 1. Fork it ( https://github.com/[my-github-username]/turkish_banks/fork )
53
- 2. Create your feature branch (`git checkout -b my-new-feature`)
54
- 3. Commit your changes (`git commit -am 'Add some feature'`)
55
- 4. Push to the branch (`git push origin my-new-feature`)
56
- 5. Create a new Pull Request
@@ -9,4 +9,4 @@ module TurkishBanks
9
9
  @address = bank["adr"]
10
10
  end
11
11
  end
12
- end
12
+ end
@@ -1,12 +1,16 @@
1
1
  module TurkishBanks
2
2
  class Branch < TurkishBank
3
- attr_accessor :name, :code, :bank_code, :city
3
+ attr_accessor :name, :code, :bank_code, :city_code, :city, :district_code, :district, :phone
4
4
 
5
5
  def initialize(branch)
6
- @name = branch["sAd"]
7
- @code = branch["sKd"]
8
- @bank_code = branch["bKd"]
9
- @city = branch["bIlAd"]
6
+ @name = branch["sAd"]
7
+ @code = branch["sKd"]
8
+ @bank_code = branch["bKd"]
9
+ @city_code = branch["sIlKd"]
10
+ @city = branch["sIlAd"]
11
+ @district_code = branch["sIlcKd"]
12
+ @district = branch["sIlcAd"]
13
+ @phone = branch["tlf"]
10
14
  end
11
15
  end
12
- end
16
+ end
@@ -1,14 +1,11 @@
1
- require "turkish_support"
2
-
3
1
  module TurkishBanks
4
2
  class TurkishBank
5
- using TurkishSupport
6
3
  attr_accessor :last_update_date, :banks
7
4
 
8
5
  BANKS_URL = "http://eftemkt.tcmb.gov.tr/bankasubelistesi/bankaSubeTumListe.xml".freeze
9
6
 
10
7
  def initialize
11
- doc = Nokogiri.XML(open(BANKS_URL), nil, 'UTF-8')
8
+ doc = Nokogiri.XML(::OpenURI.open_uri(BANKS_URL), nil, 'UTF-8')
12
9
  doc.remove_namespaces!
13
10
  response = Hash.from_xml(doc.to_s)
14
11
  @last_update_date = response["bankaSubeTumListe"]["tarih"]
@@ -16,20 +13,27 @@ module TurkishBanks
16
13
  end
17
14
 
18
15
  def get_information_of(bank_name)
16
+ return "#{bank_name} isminde bir banka bulunamadı." if get_bank(bank_name).empty?
17
+
19
18
  bank = get_bank(bank_name).first["banka"]
20
19
  TurkishBanks::Bank.new bank
21
20
  end
22
21
 
23
22
  def get_branches_of(bank_name)
23
+ return "#{bank_name} isminde bir bankaya ait şube bilgisi bulunamadı." if get_bank(bank_name).empty?
24
+
25
+ bank_branches = []
24
26
  branches = get_bank(bank_name).first["sube"]
25
27
  branches.each do |branch|
26
- TurkishBanks::Branch.new branch
28
+ bank_branches << TurkishBanks::Branch.new(branch)
27
29
  end
30
+ bank_branches
28
31
  end
29
32
 
30
33
  private
34
+
31
35
  def get_bank(bank_name)
32
- @banks.select {|b| b["banka"]["bAd"] == bank_name.upcase}
36
+ @banks.select {|b| b["banka"]["bAd"] == bank_name.upcase(:turkic)}
33
37
  end
34
38
  end
35
39
  end
@@ -1,3 +1,3 @@
1
1
  module TurkishBanks
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -4,10 +4,11 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'turkish_banks/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "turkish_banks"
8
- spec.version = TurkishBanks::VERSION
9
- spec.authors = ["Ender Ahmet Yurt"]
10
- spec.email = ["enderyurt@gmail.com"]
7
+ spec.name = "turkish_banks"
8
+ spec.version = TurkishBanks::VERSION
9
+ spec.required_ruby_version = '>= 2.5.1'
10
+ spec.authors = ["Ender Ahmet Yurt"]
11
+ spec.email = ["enderyurt@gmail.com"]
11
12
 
12
13
  # if spec.respond_to?(:metadata)
13
14
  # spec.metadata['allowed_push_host'] = ""
@@ -23,9 +24,8 @@ Gem::Specification.new do |spec|
23
24
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
25
  spec.require_paths = ["lib"]
25
26
 
26
- spec.add_development_dependency "bundler", "~> 1.8"
27
- spec.add_development_dependency "rake", "~> 12.0"
28
- spec.add_development_dependency "nokogiri", "~> 1.8.1"
29
- spec.add_development_dependency "activesupport"
30
- spec.add_development_dependency "turkish_support"
27
+ spec.add_development_dependency "activesupport", "~> 6.0.2.2"
28
+ spec.add_development_dependency "bundler", "~> 2.1.4"
29
+ spec.add_development_dependency "nokogiri", "~> 1.10.9"
30
+ spec.add_development_dependency "rake", "~> 13.0.0"
31
31
  end
metadata CHANGED
@@ -1,85 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: turkish_banks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.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: 2018-01-08 00:00:00.000000000 Z
11
+ date: 2020-04-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.8'
19
+ version: 6.0.2.2
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.8'
26
+ version: 6.0.2.2
27
27
  - !ruby/object:Gem::Dependency
28
- name: rake
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '12.0'
33
+ version: 2.1.4
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '12.0'
40
+ version: 2.1.4
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: nokogiri
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.8.1
47
+ version: 1.10.9
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.8.1
55
- - !ruby/object:Gem::Dependency
56
- name: activesupport
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
54
+ version: 1.10.9
69
55
  - !ruby/object:Gem::Dependency
70
- name: turkish_support
56
+ name: rake
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
- - - ">="
59
+ - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: '0'
61
+ version: 13.0.0
76
62
  type: :development
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
- - - ">="
66
+ - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: '0'
68
+ version: 13.0.0
83
69
  description: Fetch the all data about Turkish Banks and their branches.
84
70
  email:
85
71
  - enderyurt@gmail.com
@@ -115,15 +101,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
115
101
  requirements:
116
102
  - - ">="
117
103
  - !ruby/object:Gem::Version
118
- version: '0'
104
+ version: 2.5.1
119
105
  required_rubygems_version: !ruby/object:Gem::Requirement
120
106
  requirements:
121
107
  - - ">="
122
108
  - !ruby/object:Gem::Version
123
109
  version: '0'
124
110
  requirements: []
125
- rubyforge_project:
126
- rubygems_version: 2.6.13
111
+ rubygems_version: 3.1.2
127
112
  signing_key:
128
113
  specification_version: 4
129
114
  summary: Fetch Turkish Banks and their branches.