banktools-de 0.0.4 → 0.0.5

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
2
  SHA1:
3
- metadata.gz: 5453ad9542d81acd4a0653df094a95d8b2b3aeb0
4
- data.tar.gz: 05623115c4c2e589c48878a538dcdbc81171dc0c
3
+ metadata.gz: 980f50e63ec1df638d17eb3a714882f5bc8b726b
4
+ data.tar.gz: 50d8371a2e358e81803b62a69e8e4489c06b22e8
5
5
  SHA512:
6
- metadata.gz: 36a975456c36e233e0a3d5e42ccdab38ba9c88e0b17bd915e97b982fe0e5bd477f6795ca3c4af8c8b1ca4d7209410ad3e16ab38fac483a1ab7e1666017ec2f5c
7
- data.tar.gz: c86193338004fc5df9262877e71608356064704ccbc0b0ca49d79d49bb5440768dbe2cf27a01f7f1fa500bdfeff8d83412d66739febea51e25d7816d643d2093
6
+ metadata.gz: 9e24fbda49c753f995a5f1e31223e1661d7cd1818d53fdb1ce40b74cb4fef7b43cff13a9f2055dafb94e8853b4fdaabe0a73b2bc8f8d59c3970b2e4531ad3a4c
7
+ data.tar.gz: bdd45c2c83ca819a129fc4ea7817e14454196fa4b66da52e0dd0de4f2319aeb49283edbb0ddc1eacddd671628b0d78d732e41d43f5cf853631e3c8ba045c8cc6
data/README.md CHANGED
@@ -9,8 +9,6 @@ If we got anything wrong, please file an issue or contribute a fix yourself.
9
9
 
10
10
  ## Usage
11
11
 
12
- (Very much in progress. Expect this list to change rapidly.)
13
-
14
12
  # BLZ
15
13
 
16
14
  blz = BankTools::DE::BLZ.new("10070024")
@@ -40,6 +38,7 @@ If we got anything wrong, please file an issue or contribute a fix yourself.
40
38
 
41
39
  ## Tests
42
40
 
41
+ bundle
43
42
  rspec
44
43
  # or: rake
45
44
 
@@ -52,6 +51,7 @@ Bundesbank provide a mapping from BLZ to bank name that appears to be updated re
52
51
 
53
52
  As a gem maintainer, run
54
53
 
54
+ bundle
55
55
  rake download URL="http://www.bundesbank.de/…/blz_2013_12_09_xls.xlsx?__blob=publicationFile"
56
56
 
57
57
  providing a URL for the latest unpacked XLSX version of the data.
data/data/blz_to_name.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
- :generated_at: 2014-01-15 15:05:01.491807000 +01:00
3
- :generated_from_url: http://www.bundesbank.de/Redaktion/DE/Downloads/Kerngeschaeftsfelder/Unbarer_Zahlungsverkehr/Bankleitzahlen/2014_03_02/blz_2013_12_09_xls.xlsx?__blob=publicationFile#.xlsx
2
+ :generated_at: 2014-01-15 15:21:26.199891000 +01:00
3
+ :generated_from_url: http://www.bundesbank.de/Redaktion/DE/Downloads/Kerngeschaeftsfelder/Unbarer_Zahlungsverkehr/Bankleitzahlen/2014_03_02/blz_2013_12_09_xls.xlsx?__blob=publicationFile
4
4
  :data:
5
5
  '10000000': BBk Berlin
6
6
  '10010010': Postbank Berlin
@@ -10,7 +10,7 @@ require "yaml"
10
10
  module BankTools
11
11
  module DE
12
12
  class BLZ
13
- LENGTH = 8
13
+ MIN_LENGTH = MAX_LENGTH = 8
14
14
  BLZ_TO_NAME_PATH = File.join(BankTools::DE.data_dir, "blz_to_name.yml")
15
15
 
16
16
  pattr_initialize :original_value
@@ -29,8 +29,8 @@ module BankTools
29
29
 
30
30
  def errors
31
31
  errors = []
32
- errors << Errors::TOO_SHORT if compacted_value.length < LENGTH
33
- errors << Errors::TOO_LONG if compacted_value.length > LENGTH
32
+ errors << Errors::TOO_SHORT if compacted_value.length < MIN_LENGTH
33
+ errors << Errors::TOO_LONG if compacted_value.length > MAX_LENGTH
34
34
  errors << Errors::INVALID_CHARACTERS if compacted_value.match(/\D/)
35
35
  errors
36
36
  end
@@ -46,7 +46,7 @@ module BankTools
46
46
  end
47
47
 
48
48
  def compacted_value
49
- original_value.to_s.gsub(/\s/, "")
49
+ original_value.to_s.gsub(/[\s-]/, "")
50
50
  end
51
51
  end
52
52
  end
@@ -1,5 +1,5 @@
1
1
  module BankTools
2
2
  module DE
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
data/spec/blz_spec.rb CHANGED
@@ -30,8 +30,8 @@ end
30
30
  describe BankTools::DE::BLZ, "#errors" do
31
31
  Errors ||= BankTools::DE::Errors
32
32
 
33
- it "is empty if there's 8 digits and possibly whitespace" do
34
- expect(BankTools::DE::BLZ.new(" 123 456 78 ").errors).to be_empty
33
+ it "is empty when valid" do
34
+ expect(BankTools::DE::BLZ.new(" 123 456-78 ").errors).to be_empty
35
35
  end
36
36
 
37
37
  it "includes TOO_SHORT if below 8 characters" do
@@ -52,7 +52,7 @@ describe BankTools::DE::BLZ, "#bank_name" do
52
52
  expect(BankTools::DE::BLZ.new("10000000").bank_name).to eq "BBk Berlin"
53
53
  end
54
54
 
55
- it "is provided if known" do
55
+ it "is nil if unknown" do
56
56
  expect(BankTools::DE::BLZ.new("X").bank_name).to be_nil
57
57
  end
58
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: banktools-de
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrik Nyh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: attr_extras