ibanomat 1.2.0 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -3
- data/README.md +1 -1
- data/ibanomat.gemspec +1 -2
- data/lib/ibanomat/client.rb +23 -17
- data/lib/ibanomat/version.rb +1 -1
- data/spec/{client_spec.rb → ibanomat/client_spec.rb} +2 -2
- metadata +6 -34
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b032e9ad85ad6f1acdcfa1f33042ac2661c1417
|
4
|
+
data.tar.gz: 61fede1582a55ef1b15abfbae35947b8dec47f0c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 442a85ac1b64e5b0bc870dc61b70cc18134129066789a500948b82736aa3c331f78b9cd8f53af86c0e33df4bcda0cd61592a67c28cad5d817982ed4db176453c
|
7
|
+
data.tar.gz: 35eb377e5d5e5e5a9cc3d1c88738bbf3b116efdc166963c6d63cd82de9e02f45fee0c6d732b7b9a6dca9e265c453662f516712844f6719ffdb13b6aad1efc9cd
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
data/ibanomat.gemspec
CHANGED
@@ -18,8 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.add_dependency 'json'
|
21
|
+
spec.required_ruby_version = '>= 2.0.0'
|
23
22
|
|
24
23
|
spec.add_development_dependency 'bundler'
|
25
24
|
spec.add_development_dependency 'rake'
|
data/lib/ibanomat/client.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
require '
|
1
|
+
require 'net/http'
|
2
2
|
require 'json'
|
3
3
|
|
4
4
|
module Ibanomat
|
5
|
+
class ResourceNotFoundError < RuntimeError; end
|
6
|
+
|
5
7
|
URL = 'https://www.sparkasse.de/bin/servlets/sparkasse/iban'
|
6
8
|
|
7
9
|
def self.find(options)
|
@@ -9,23 +11,27 @@ module Ibanomat
|
|
9
11
|
raise ArgumentError.new('Option :bank_code is missing!') if options[:bank_code].empty?
|
10
12
|
raise ArgumentError.new('Option :bank_account_number is missing!') if options[:bank_account_number].empty?
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
14
|
+
uri = URI(URL)
|
15
|
+
params = { 'b' => options[:bank_code],
|
16
|
+
'a' => options[:bank_account_number]
|
17
|
+
}
|
18
|
+
uri.query = URI.encode_www_form(params)
|
19
|
+
|
20
|
+
case response = Net::HTTP.get_response(uri)
|
21
|
+
when Net::HTTPSuccess
|
22
|
+
hash = JSON.parse(response.body)
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
24
|
+
{ :bank_name => hash['Institutsname'],
|
25
|
+
:bic => hash['BIC'],
|
26
|
+
:iban => hash['IBAN'],
|
27
|
+
:bank_code => hash['BLZ'],
|
28
|
+
:bank_account_number => hash['KtoNr'],
|
29
|
+
:return_code => hash['RetCode']
|
30
|
+
}
|
31
|
+
when Net::HTTPNotFound
|
32
|
+
raise ResourceNotFoundError
|
33
|
+
else
|
34
|
+
raise RuntimeError
|
29
35
|
end
|
30
36
|
end
|
31
37
|
end
|
data/lib/ibanomat/version.rb
CHANGED
@@ -74,7 +74,7 @@ describe Ibanomat do
|
|
74
74
|
it 'should raise exception' do
|
75
75
|
expect {
|
76
76
|
subject
|
77
|
-
}.to raise_error(
|
77
|
+
}.to raise_error(Ibanomat::ResourceNotFoundError)
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -91,7 +91,7 @@ describe Ibanomat do
|
|
91
91
|
it 'should raise exception' do
|
92
92
|
expect {
|
93
93
|
subject
|
94
|
-
}.to raise_error(
|
94
|
+
}.to raise_error(Timeout::Error)
|
95
95
|
end
|
96
96
|
end
|
97
97
|
end
|
metadata
CHANGED
@@ -1,43 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ibanomat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Georg Ledermann
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
-
- !ruby/object:Gem::Dependency
|
14
|
-
name: rest-client
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
16
|
-
requirements:
|
17
|
-
- - ">="
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '0'
|
20
|
-
type: :runtime
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ">="
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: json
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ">="
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ">="
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '0'
|
41
13
|
- !ruby/object:Gem::Dependency
|
42
14
|
name: bundler
|
43
15
|
requirement: !ruby/object:Gem::Requirement
|
@@ -114,7 +86,7 @@ files:
|
|
114
86
|
- lib/ibanomat.rb
|
115
87
|
- lib/ibanomat/client.rb
|
116
88
|
- lib/ibanomat/version.rb
|
117
|
-
- spec/client_spec.rb
|
89
|
+
- spec/ibanomat/client_spec.rb
|
118
90
|
- spec/spec_helper.rb
|
119
91
|
homepage: http://github.com/ledermann/ibanomat
|
120
92
|
licenses:
|
@@ -128,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
100
|
requirements:
|
129
101
|
- - ">="
|
130
102
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
103
|
+
version: 2.0.0
|
132
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
105
|
requirements:
|
134
106
|
- - ">="
|
@@ -136,10 +108,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
108
|
version: '0'
|
137
109
|
requirements: []
|
138
110
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.5.
|
111
|
+
rubygems_version: 2.5.2
|
140
112
|
signing_key:
|
141
113
|
specification_version: 4
|
142
114
|
summary: Wrapper for a web service to calculate the IBAN of german bank account numbers
|
143
115
|
test_files:
|
144
|
-
- spec/client_spec.rb
|
116
|
+
- spec/ibanomat/client_spec.rb
|
145
117
|
- spec/spec_helper.rb
|