banking_data 0.1.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.
- data/.document +4 -0
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/.rubocop.yml +1 -0
- data/.travis.yml +11 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +20 -0
- data/README.md +32 -0
- data/banking_data.gemspec +28 -0
- data/data/BLZ_20130909.txt +19300 -0
- data/data/bcbankenstamm.txt +3555 -0
- data/data/kiverzeichnis_gesamt_de_1381499802577.csv +5193 -0
- data/lib/banking_data/austrian_bank.rb +30 -0
- data/lib/banking_data/bank.rb +23 -0
- data/lib/banking_data/german_bank.rb +21 -0
- data/lib/banking_data/swiss_bank.rb +23 -0
- data/lib/banking_data/version.rb +4 -0
- data/lib/banking_data.rb +11 -0
- data/rubocop-todo.yml +24 -0
- data/spec/banking_data/austrian_bank_spec.rb +15 -0
- data/spec/banking_data/bank_spec.rb +8 -0
- data/spec/banking_data/german_bank_spec.rb +13 -0
- data/spec/banking_data/swiss_bank_spec.rb +15 -0
- data/spec/banking_data_spec.rb +5 -0
- data/spec/spec_helper.rb +29 -0
- metadata +206 -0
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'active_support/core_ext/object/blank'
|
2
|
+
require 'active_support/core_ext/object/try'
|
3
|
+
|
4
|
+
class BankingData::AustrianBank < BankingData::Bank
|
5
|
+
include ActiveModel::Model
|
6
|
+
|
7
|
+
attr_accessor :bic
|
8
|
+
|
9
|
+
def self.all
|
10
|
+
banks = []
|
11
|
+
SmarterCSV.process(file, opts).each do |line|
|
12
|
+
bic = line[:'swift-code'].try(:gsub, /"/, '')
|
13
|
+
banks << new(bic: bic)
|
14
|
+
end
|
15
|
+
banks
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.file
|
19
|
+
File.dirname(__FILE__) +
|
20
|
+
'/../../data/kiverzeichnis_gesamt_de_1381499802577.csv'
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.opts
|
24
|
+
{
|
25
|
+
col_sep: ';',
|
26
|
+
file_encoding: 'iso-8859-1',
|
27
|
+
force_simple_split: true
|
28
|
+
}
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module BankingData
|
2
|
+
class Bank
|
3
|
+
|
4
|
+
# goal: do something like:
|
5
|
+
# BankingData::Bank.where(locale: :de).only(:bic)
|
6
|
+
def self.where(options = {})
|
7
|
+
locale = options.delete(:locale)
|
8
|
+
if locale == 'DE' || locale == :de
|
9
|
+
GermanBank.where(options)
|
10
|
+
elsif locale == 'AT' || locale == :at
|
11
|
+
AustrianBank.where(options)
|
12
|
+
elsif locale == 'CH' || locale == :ch
|
13
|
+
SwissBank.where(options)
|
14
|
+
else
|
15
|
+
self
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.only(*attributes)
|
20
|
+
all.map { |bank| attributes.map { |attr| bank.send(attr) } }
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'active_support/core_ext/object/blank'
|
2
|
+
|
3
|
+
class BankingData::GermanBank < BankingData::Bank
|
4
|
+
include ActiveModel::Model
|
5
|
+
|
6
|
+
attr_accessor :bic, :blz
|
7
|
+
|
8
|
+
def self.all
|
9
|
+
banks = []
|
10
|
+
File.open(file).each_line do |line|
|
11
|
+
blz = line[0..7]
|
12
|
+
bic = line[139..149]
|
13
|
+
banks << new(bic: bic, blz: blz)
|
14
|
+
end
|
15
|
+
banks
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.file
|
19
|
+
File.dirname(__FILE__) + '/../../data/BLZ_20130909.txt'
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'active_support/core_ext/object/blank'
|
2
|
+
|
3
|
+
class BankingData::SwissBank < BankingData::Bank
|
4
|
+
include ActiveModel::Model
|
5
|
+
|
6
|
+
attr_accessor :bic
|
7
|
+
|
8
|
+
def self.all
|
9
|
+
banks = []
|
10
|
+
File.read(file, encoding: 'iso-8859-1').lines.each do |line|
|
11
|
+
kennzeichen = line[7..10]
|
12
|
+
if kennzeichen == '0000'
|
13
|
+
bic = line[284..294]
|
14
|
+
banks << new(bic: bic)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
banks
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.file
|
21
|
+
File.dirname(__FILE__) + '/../../data/bcbankenstamm.txt'
|
22
|
+
end
|
23
|
+
end
|
data/lib/banking_data.rb
ADDED
data/rubocop-todo.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# This configuration was generated by `rubocop --auto-gen-config`.
|
2
|
+
# The point is for the user to remove these configuration records
|
3
|
+
# one by one as the offences are removed from the code base.
|
4
|
+
|
5
|
+
Documentation:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Encoding:
|
9
|
+
Enabled: false
|
10
|
+
|
11
|
+
RedundantSelf:
|
12
|
+
Enabled: true
|
13
|
+
|
14
|
+
StringLiterals:
|
15
|
+
Enabled: true
|
16
|
+
|
17
|
+
SymbolName:
|
18
|
+
Enabled: false
|
19
|
+
|
20
|
+
TrailingBlankLines:
|
21
|
+
Enabled: true
|
22
|
+
|
23
|
+
WordArray:
|
24
|
+
Enabled: false
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module BankingData
|
4
|
+
describe AustrianBank do
|
5
|
+
describe 'end-to-end test' do
|
6
|
+
['ABAGATWW', 'ABVRATW1'].each do |bic|
|
7
|
+
it "includes #{bic}" do
|
8
|
+
expect(AustrianBank.only(:bic).map(&:first)).to include(bic)
|
9
|
+
expect(Bank.where(locale: :at).only(:bic).map(&:first))
|
10
|
+
.to include(bic)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module BankingData
|
4
|
+
describe GermanBank do
|
5
|
+
describe 'end-to-end test' do
|
6
|
+
['MARKDEF1100', 'PBNKDEFF100'].each do |bic|
|
7
|
+
it "includes #{bic}" do
|
8
|
+
expect(GermanBank.only(:bic).map(&:first)).to include(bic)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module BankingData
|
4
|
+
describe SwissBank do
|
5
|
+
describe 'end-to-end test' do
|
6
|
+
['SNBZCHZZXXX', 'UBSWCHZH31A'].each do |bic|
|
7
|
+
it "includes #{bic}" do
|
8
|
+
expect(SwissBank.only(:bic).map(&:first)).to include(bic)
|
9
|
+
expect(Bank.where(locale: :ch).only(:bic).map(&:first))
|
10
|
+
.to include(bic)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
require 'coveralls'
|
3
|
+
require 'pry'
|
4
|
+
|
5
|
+
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
|
6
|
+
SimpleCov::Formatter::HTMLFormatter,
|
7
|
+
Coveralls::SimpleCov::Formatter
|
8
|
+
]
|
9
|
+
SimpleCov.start do
|
10
|
+
add_filter '/spec/'
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'banking_data'
|
14
|
+
|
15
|
+
RSpec.configure do |config|
|
16
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
17
|
+
config.run_all_when_everything_filtered = true
|
18
|
+
config.filter_run :focus
|
19
|
+
|
20
|
+
# Run specs in random order to surface order dependencies. If you find an
|
21
|
+
# order dependency and want to debug it, you can fix the order by providing
|
22
|
+
# the seed, which is printed after each run.
|
23
|
+
# --seed 1234
|
24
|
+
config.order = 'random'
|
25
|
+
|
26
|
+
config.expect_with :rspec do |c|
|
27
|
+
c.syntax = :expect
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,206 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: banking_data
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Frank C. Eckert
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-10-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: activemodel
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: smarter_csv
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: rspec
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: coveralls
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: pry
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: rubocop
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
none: false
|
130
|
+
requirements:
|
131
|
+
- - ! '>='
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
version: '0'
|
134
|
+
type: :development
|
135
|
+
prerelease: false
|
136
|
+
version_requirements: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
description: This gem exposes the official banking data of the respective national
|
143
|
+
banks of Germany, Austria and Switzerland, including bank codes and SWIFT-codes/BICs.
|
144
|
+
email: frank.eckert@boost-project.com
|
145
|
+
executables: []
|
146
|
+
extensions: []
|
147
|
+
extra_rdoc_files: []
|
148
|
+
files:
|
149
|
+
- .document
|
150
|
+
- .gitignore
|
151
|
+
- .rspec
|
152
|
+
- .rubocop.yml
|
153
|
+
- .travis.yml
|
154
|
+
- Gemfile
|
155
|
+
- LICENSE.txt
|
156
|
+
- README.md
|
157
|
+
- banking_data.gemspec
|
158
|
+
- data/BLZ_20130909.txt
|
159
|
+
- data/bcbankenstamm.txt
|
160
|
+
- data/kiverzeichnis_gesamt_de_1381499802577.csv
|
161
|
+
- lib/banking_data.rb
|
162
|
+
- lib/banking_data/austrian_bank.rb
|
163
|
+
- lib/banking_data/bank.rb
|
164
|
+
- lib/banking_data/german_bank.rb
|
165
|
+
- lib/banking_data/swiss_bank.rb
|
166
|
+
- lib/banking_data/version.rb
|
167
|
+
- rubocop-todo.yml
|
168
|
+
- spec/banking_data/austrian_bank_spec.rb
|
169
|
+
- spec/banking_data/bank_spec.rb
|
170
|
+
- spec/banking_data/german_bank_spec.rb
|
171
|
+
- spec/banking_data/swiss_bank_spec.rb
|
172
|
+
- spec/banking_data_spec.rb
|
173
|
+
- spec/spec_helper.rb
|
174
|
+
homepage: https://github.com/opahk/banking_data
|
175
|
+
licenses:
|
176
|
+
- MIT
|
177
|
+
post_install_message:
|
178
|
+
rdoc_options: []
|
179
|
+
require_paths:
|
180
|
+
- lib
|
181
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
|
+
none: false
|
189
|
+
requirements:
|
190
|
+
- - ! '>='
|
191
|
+
- !ruby/object:Gem::Version
|
192
|
+
version: '0'
|
193
|
+
requirements: []
|
194
|
+
rubyforge_project:
|
195
|
+
rubygems_version: 1.8.25
|
196
|
+
signing_key:
|
197
|
+
specification_version: 3
|
198
|
+
summary: Banking data for German, Austrian and Swiss banks
|
199
|
+
test_files:
|
200
|
+
- spec/banking_data/austrian_bank_spec.rb
|
201
|
+
- spec/banking_data/bank_spec.rb
|
202
|
+
- spec/banking_data/german_bank_spec.rb
|
203
|
+
- spec/banking_data/swiss_bank_spec.rb
|
204
|
+
- spec/banking_data_spec.rb
|
205
|
+
- spec/spec_helper.rb
|
206
|
+
has_rdoc:
|