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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5d5f5539aeb52d8954f5a7bf849135b6e8efabd3
4
- data.tar.gz: fe5eda3263d7deb50866c7aa6a3b84d2a4cfd3a2
3
+ metadata.gz: 5b032e9ad85ad6f1acdcfa1f33042ac2661c1417
4
+ data.tar.gz: 61fede1582a55ef1b15abfbae35947b8dec47f0c
5
5
  SHA512:
6
- metadata.gz: f0659e18f79ff93a423ee5a30fee1e1e993fc07be823d0713bb6fed987429f9b7b53fdfbc23f7ce1c58ce748f43f405b2b0dbc72adf236c9c3c1cbf031e62fb9
7
- data.tar.gz: 643870f425bb610d38f05f8b629910387d8e9208e08a1918a4db17f816110300224e063c175992f33374fb6fdc796e5e5d21bbde86144353ff0d0f4c078359ff
6
+ metadata.gz: 442a85ac1b64e5b0bc870dc61b70cc18134129066789a500948b82736aa3c331f78b9cd8f53af86c0e33df4bcda0cd61592a67c28cad5d817982ed4db176453c
7
+ data.tar.gz: 35eb377e5d5e5e5a9cc3d1c88738bbf3b116efdc166963c6d63cd82de9e02f45fee0c6d732b7b9a6dca9e265c453662f516712844f6719ffdb13b6aad1efc9cd
data/.travis.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  rvm:
2
- - 1.9.3
3
2
  - 2.0.0
4
- - 2.1.7
5
- - 2.2.3
3
+ - 2.1.8
4
+ - 2.2.4
5
+ - 2.3.0
6
6
  before_install: gem update bundler
7
7
  sudo: false
data/README.md CHANGED
@@ -12,7 +12,7 @@ The gem is a Ruby wrapper for a [web service of the german "Sparkasse"](https://
12
12
 
13
13
  ## Requirements
14
14
 
15
- Ruby 1.9.3 or newer.
15
+ Ruby 2.0.0 or newer.
16
16
 
17
17
 
18
18
  ## Installation
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.add_dependency 'rest-client'
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'
@@ -1,7 +1,9 @@
1
- require 'rest-client'
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
- response = RestClient.get URL, {
13
- :params => {
14
- 'b' => options[:bank_code],
15
- 'a' => options[:bank_account_number]
16
- },
17
- :accept => :json
18
- }
19
- if response.code == 200
20
- hash = JSON.parse(response)
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
- { :bank_name => hash['Institutsname'],
23
- :bic => hash['BIC'],
24
- :iban => hash['IBAN'],
25
- :bank_code => hash['BLZ'],
26
- :bank_account_number => hash['KtoNr'],
27
- :return_code => hash['RetCode']
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
@@ -1,3 +1,3 @@
1
1
  module Ibanomat
2
- VERSION = '1.2.0'
2
+ VERSION = '1.3.0'
3
3
  end
@@ -74,7 +74,7 @@ describe Ibanomat do
74
74
  it 'should raise exception' do
75
75
  expect {
76
76
  subject
77
- }.to raise_error(RestClient::ResourceNotFound)
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(RestClient::RequestTimeout)
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.2.0
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: 2015-12-07 00:00:00.000000000 Z
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: '0'
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.0
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