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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b5d271dd698d5bdf599eb7d41c0383dfc9a6c04
4
- data.tar.gz: 91d990d3764a1a0b81db3330811ec8444b185795
3
+ metadata.gz: 4f644a79480002d1cd803cd2eae18a277cd12ea8
4
+ data.tar.gz: 7bb872deab831e3669c911c4540910a1a02ecf70
5
5
  SHA512:
6
- metadata.gz: 9a558ba6598cf6a8797c8fdde343ca51481d6439de8af24702831bdb2986aee9c4df8c686db4dfa7868b3057f0024ef4e1f6d039925334733025576815eb1730
7
- data.tar.gz: 68f6f60d16288f7d10d950d8e48381a77cc2fc2342a11b45d715614e07a4505aa989b71d70eb3c3dedde4c46155778ae6ecaa9db26f32a2104e502f6264873ea
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.run(blz: "37040044", account: "532013000")
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", ">= 2.2.3"
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"
@@ -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
@@ -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,4 +1,4 @@
1
- require "attr_extras"
1
+ require "attr_extras/explicit"
2
2
  require "yaml"
3
3
  require "open-uri"
4
4
 
@@ -8,6 +8,8 @@ require "creek"
8
8
  module BankTools
9
9
  module DE
10
10
  class BLZDownloader
11
+ extend AttrExtras.mixin
12
+
11
13
  pattr_initialize :url
12
14
 
13
15
  def run
@@ -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 :run,
14
- [ :blz!, :account! ]
16
+ method_object [ :blz!, :account! ]
15
17
 
16
- def run
18
+ def call
17
19
  account_data = get_account_data
18
20
  build_result(account_data)
19
21
  end
@@ -1,5 +1,5 @@
1
1
  module BankTools
2
2
  module DE
3
- VERSION = "1.0.0"
3
+ VERSION = "2.0.0"
4
4
  end
5
5
  end
@@ -1,14 +1,14 @@
1
1
  require "spec_helper"
2
2
  require "banktools-de/iban_bic"
3
3
 
4
- describe BankTools::DE::IbanBicConverter, ".run" do
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.run(blz: blz, account: account)
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.run(blz: blz, account: account)
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.run(blz: blz, account: account)
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.run(blz: blz, account: account)
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: 1.0.0
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: 2014-04-25 00:00:00.000000000 Z
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: 2.2.3
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: 2.2.3
26
+ version: '4'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ibanomat
29
29
  requirement: !ruby/object:Gem::Requirement