banktools-de 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/banktools-de.gemspec +1 -1
- data/lib/banktools-de/account.rb +3 -1
- data/lib/banktools-de/blz.rb +3 -1
- data/lib/banktools-de/blz_downloader.rb +3 -1
- data/lib/banktools-de/iban_bic.rb +6 -4
- data/lib/banktools-de/version.rb +1 -1
- data/spec/iban_bic_spec.rb +5 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4f644a79480002d1cd803cd2eae18a277cd12ea8
|
4
|
+
data.tar.gz: 7bb872deab831e3669c911c4540910a1a02ecf70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e5fa5cec11896056bb53e7046f636bd978e75c443e4fe9b1a39937f27fd7a870f041d0413b2179b70ec404527b530241267628edb3855328c9c7abc171cbdc5
|
7
|
+
data.tar.gz: 8f93fb72571d481d5aee6eeb4b50e0cabd08cbb1b7c1486be9d8d15e18f845df2115131d69c1fe69cd928c1d31b5e551e533e62ad6212671969d9618030543b9
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ If we got anything wrong, please file an issue or contribute a fix yourself.
|
|
38
38
|
|
39
39
|
# Convert BLZ and account number to IBAN/BIC
|
40
40
|
|
41
|
-
result = BankTools::DE::IbanBicConverter.
|
41
|
+
result = BankTools::DE::IbanBicConverter.call(blz: "37040044", account: "532013000")
|
42
42
|
result.iban # => "DE89370400440532013000"
|
43
43
|
result.bic # => "COBADEFFXXX"
|
44
44
|
# Or raises an exception.
|
data/banktools-de.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
|
-
spec.add_dependency "attr_extras", ">=
|
20
|
+
spec.add_dependency "attr_extras", ">= 4"
|
21
21
|
spec.add_dependency "ibanomat" # Convert BLZ to IBAN/BIC
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.5"
|
23
23
|
spec.add_development_dependency "rake"
|
data/lib/banktools-de/account.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# http://de.wikipedia.org/wiki/Bankleitzahl
|
2
2
|
# http://translate.google.com/translate?hl=en&sl=de&tl=en&u=http%3A%2F%2Fde.wikipedia.org%2Fwiki%2FBankleitzahl
|
3
3
|
|
4
|
-
require "attr_extras"
|
4
|
+
require "attr_extras/explicit"
|
5
5
|
require "banktools-de/errors"
|
6
6
|
|
7
7
|
module BankTools
|
8
8
|
module DE
|
9
9
|
class Account
|
10
|
+
extend AttrExtras.mixin
|
11
|
+
|
10
12
|
# Picked some reasonable values, erring on the side of allowing too much.
|
11
13
|
# Seems to claim max 10: http://docs.oracle.com/cd/E18727_01/doc.121/e13483/T359831T498954.htm
|
12
14
|
# Seems to claim 2 - 13: http://www.credit-card.be/BankAccount/ValidationRules.htm#DE_Validation
|
data/lib/banktools-de/blz.rb
CHANGED
@@ -4,12 +4,14 @@
|
|
4
4
|
require "banktools-de"
|
5
5
|
require "banktools-de/errors"
|
6
6
|
|
7
|
-
require "attr_extras"
|
7
|
+
require "attr_extras/explicit"
|
8
8
|
require "yaml"
|
9
9
|
|
10
10
|
module BankTools
|
11
11
|
module DE
|
12
12
|
class BLZ
|
13
|
+
extend AttrExtras.mixin
|
14
|
+
|
13
15
|
LENGTH = 8
|
14
16
|
BLZ_TO_BANK_NAME_PATH = File.join(BankTools::DE.data_dir, "blz_to_name.yml")
|
15
17
|
|
@@ -1,19 +1,21 @@
|
|
1
1
|
require "ibanomat"
|
2
|
-
require "attr_extras"
|
2
|
+
require "attr_extras/explicit"
|
3
3
|
|
4
4
|
class BankTools::DE::IbanBicConverter
|
5
|
+
extend AttrExtras.mixin
|
6
|
+
|
5
7
|
class CouldNotConvertError < StandardError; end
|
6
8
|
class ServiceUnavailable < StandardError; end
|
7
9
|
class UnknownError < StandardError; end
|
8
10
|
|
9
11
|
class IbanBic
|
12
|
+
extend AttrExtras.mixin
|
10
13
|
vattr_initialize :iban, :bic
|
11
14
|
end
|
12
15
|
|
13
|
-
method_object :
|
14
|
-
[ :blz!, :account! ]
|
16
|
+
method_object [ :blz!, :account! ]
|
15
17
|
|
16
|
-
def
|
18
|
+
def call
|
17
19
|
account_data = get_account_data
|
18
20
|
build_result(account_data)
|
19
21
|
end
|
data/lib/banktools-de/version.rb
CHANGED
data/spec/iban_bic_spec.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "banktools-de/iban_bic"
|
3
3
|
|
4
|
-
describe BankTools::DE::IbanBicConverter, ".
|
4
|
+
describe BankTools::DE::IbanBicConverter, ".call" do
|
5
5
|
let(:blz) { "abc" }
|
6
6
|
let(:account) { "def" }
|
7
7
|
|
8
8
|
it "returns the BIC and IBAN" do
|
9
9
|
allow(Ibanomat).to receive(:find).and_return(iban: "some iban", bic: "some bic", return_code: "00")
|
10
10
|
|
11
|
-
actual = BankTools::DE::IbanBicConverter.
|
11
|
+
actual = BankTools::DE::IbanBicConverter.call(blz: blz, account: account)
|
12
12
|
|
13
13
|
expect(actual.iban).to eq("some iban")
|
14
14
|
expect(actual.bic).to eq("some bic")
|
@@ -18,7 +18,7 @@ describe BankTools::DE::IbanBicConverter, ".run" do
|
|
18
18
|
allow(Ibanomat).to receive(:find).and_return(return_code: "1")
|
19
19
|
|
20
20
|
expect {
|
21
|
-
BankTools::DE::IbanBicConverter.
|
21
|
+
BankTools::DE::IbanBicConverter.call(blz: blz, account: account)
|
22
22
|
}.to raise_error(BankTools::DE::IbanBicConverter::CouldNotConvertError)
|
23
23
|
end
|
24
24
|
|
@@ -26,7 +26,7 @@ describe BankTools::DE::IbanBicConverter, ".run" do
|
|
26
26
|
allow(Ibanomat).to receive(:find).and_raise(RestClient::RequestTimeout)
|
27
27
|
|
28
28
|
expect {
|
29
|
-
BankTools::DE::IbanBicConverter.
|
29
|
+
BankTools::DE::IbanBicConverter.call(blz: blz, account: account)
|
30
30
|
}.to raise_error(BankTools::DE::IbanBicConverter::ServiceUnavailable)
|
31
31
|
end
|
32
32
|
|
@@ -34,7 +34,7 @@ describe BankTools::DE::IbanBicConverter, ".run" do
|
|
34
34
|
allow(Ibanomat).to receive(:find).and_raise("unknown error")
|
35
35
|
|
36
36
|
expect {
|
37
|
-
BankTools::DE::IbanBicConverter.
|
37
|
+
BankTools::DE::IbanBicConverter.call(blz: blz, account: account)
|
38
38
|
}.to raise_error(BankTools::DE::IbanBicConverter::UnknownError)
|
39
39
|
end
|
40
40
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Nyh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: attr_extras
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '4'
|
20
20
|
type: :runtime
|
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:
|
26
|
+
version: '4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ibanomat
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|