banking_data 0.7.2 → 0.9.3

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.
@@ -6,6 +6,7 @@ require 'banking_data/bank'
6
6
  require 'banking_data/german_bank'
7
7
  require 'banking_data/austrian_bank'
8
8
  require 'banking_data/swiss_bank'
9
+ require 'banking_data/dutch_bank'
9
10
 
10
11
  module BankingData
11
12
 
@@ -35,7 +35,7 @@ class BankingData::AustrianBank < BankingData::Bank
35
35
 
36
36
  def file
37
37
  File.dirname(__FILE__) +
38
- '/../../data/SEPA-ZV-VZ_gesamt_de_1502983225066.csv'
38
+ '/../../data/SEPA-ZV-VZ_gesamt_de_1592217062909.csv'
39
39
  end
40
40
 
41
41
  def opts
@@ -0,0 +1,50 @@
1
+ require 'active_support/core_ext/object/blank'
2
+
3
+ class BankingData::DutchBank < BankingData::Bank
4
+ extend ActiveModel::Naming
5
+ include ActiveModel::Conversion
6
+ include ActiveModel::AttributeMethods
7
+
8
+ LOCALE = :nl
9
+
10
+ attr_accessor :bank_id, :bic, :name
11
+
12
+ class << self
13
+
14
+ delegate :where, :only, to: :query
15
+ delegate :map, :each, to: :all
16
+
17
+ def all
18
+ @@all ||= get_all
19
+ end
20
+
21
+ private
22
+
23
+ def get_all
24
+ banks = []
25
+ SmarterCSV.process(file, opts).each do |line|
26
+ bank_id = line[:bank_identifier].to_s
27
+ bic = line[:bic]
28
+ name = line[:naam_bank].to_s
29
+ if bank_id && bic && name
30
+ banks << new(name: name, bank_id: bank_id, bic: bic)
31
+ end
32
+ end
33
+ banks.uniq
34
+ end
35
+
36
+ private
37
+
38
+ def file
39
+ File.dirname(__FILE__) +
40
+ '/../../data/BIC-lijst-NL.csv'
41
+ end
42
+
43
+ def opts
44
+ {
45
+ col_sep: ',',
46
+ skip_lines: 1
47
+ }
48
+ end
49
+ end
50
+ end
@@ -31,7 +31,7 @@ class BankingData::GermanBank < BankingData::Bank
31
31
  end
32
32
 
33
33
  def file
34
- File.dirname(__FILE__) + '/../../data/blz_2017_09_04_txt'
34
+ File.dirname(__FILE__) + '/../../data/blz_2020_08_06_txt'
35
35
  end
36
36
  end
37
37
  end
@@ -27,6 +27,8 @@ module BankingData
27
27
  end
28
28
 
29
29
  def to_a
30
+ return [] if bank.nil?
31
+
30
32
  data = bank.all
31
33
  .select { |bank| @options.map { |k, v| bank.send(k) == v }.all? }
32
34
  if @attributes
@@ -1,4 +1,4 @@
1
1
  module BankingData
2
2
  # banking_data version
3
- VERSION = '0.7.2'
3
+ VERSION = '0.9.3'
4
4
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ module BankingData
4
+ describe DutchBank do
5
+ describe 'end-to-end test' do
6
+ ['ABNANL2A', 'INGBNL2A', 'RABONL2U'].each do |bic|
7
+ it "includes #{bic}" do
8
+ expect(DutchBank.only(:bic).map(&:first)).to include(bic)
9
+ expect(Bank.where(locale: :nl).only(:bic).map(&:first))
10
+ .to include(bic)
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+ require 'banking_data'
3
+
4
+ describe BankingData::Query do
5
+ describe '#to_a' do
6
+ it 'returns [] for unknown banks' do
7
+ locale = :li
8
+
9
+ bank = BankingData::Bank.subclasses.find do |bank_class|
10
+ bank_class::LOCALE == locale
11
+ end
12
+
13
+ expect(bank).to be_nil
14
+
15
+ query = BankingData::Query.new(
16
+ locale: :li,
17
+ blz: '8800'
18
+ )
19
+
20
+ expect(query.to_a).to be_empty
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: banking_data
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Frank C. Eckert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-21 00:00:00.000000000 Z
11
+ date: 2020-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -154,10 +154,11 @@ files:
154
154
  - README.md
155
155
  - Rakefile
156
156
  - banking_data.gemspec
157
+ - data/BIC-lijst-NL.csv
157
158
  - data/README.md
158
- - data/SEPA-ZV-VZ_gesamt_de_1502983225066.csv
159
+ - data/SEPA-ZV-VZ_gesamt_de_1592217062909.csv
159
160
  - data/bcbankenstamm.txt
160
- - data/blz_2017_09_04_txt
161
+ - data/blz_2020_08_06_txt
161
162
  - gemfiles/rails_3.0.gemfile
162
163
  - gemfiles/rails_4.0.gemfile
163
164
  - gemfiles/rails_4.2.gemfile
@@ -165,6 +166,7 @@ files:
165
166
  - lib/banking_data.rb
166
167
  - lib/banking_data/austrian_bank.rb
167
168
  - lib/banking_data/bank.rb
169
+ - lib/banking_data/dutch_bank.rb
168
170
  - lib/banking_data/german_bank.rb
169
171
  - lib/banking_data/query.rb
170
172
  - lib/banking_data/swiss_bank.rb
@@ -172,9 +174,11 @@ files:
172
174
  - rubocop-todo.yml
173
175
  - spec/banking_data/austrian_bank_spec.rb
174
176
  - spec/banking_data/bank_spec.rb
177
+ - spec/banking_data/dutch_bank_spec.rb
175
178
  - spec/banking_data/german_bank_spec.rb
176
179
  - spec/banking_data/swiss_bank_spec.rb
177
180
  - spec/banking_data_spec.rb
181
+ - spec/query_spec.rb
178
182
  - spec/spec_helper.rb
179
183
  homepage: https://github.com/opahk/banking_data
180
184
  licenses:
@@ -195,15 +199,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
199
  - !ruby/object:Gem::Version
196
200
  version: '0'
197
201
  requirements: []
198
- rubyforge_project:
199
- rubygems_version: 2.6.12
202
+ rubygems_version: 3.1.2
200
203
  signing_key:
201
204
  specification_version: 4
202
205
  summary: Banking data for German, Austrian and Swiss banks
203
206
  test_files:
204
207
  - spec/banking_data/austrian_bank_spec.rb
205
208
  - spec/banking_data/bank_spec.rb
209
+ - spec/banking_data/dutch_bank_spec.rb
206
210
  - spec/banking_data/german_bank_spec.rb
207
211
  - spec/banking_data/swiss_bank_spec.rb
208
212
  - spec/banking_data_spec.rb
213
+ - spec/query_spec.rb
209
214
  - spec/spec_helper.rb