afterbanks-api-ruby 0.4.0 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/lib/afterbanks/base.rb +8 -2
- data/lib/afterbanks/error.rb +3 -2
- data/lib/afterbanks/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97e68524e95b920db99af549d1bc1d92a998eab0542cc14bbc6f05665ab3f7d6
|
4
|
+
data.tar.gz: e251c7982023ddab6732ee3b55590c027af3016aa91e3508affd1ae1f2a06a53
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10e9039b45293ec28ce409e430c502d93ea943bbbd9395e8201c17d9c94dc6be0eafdb477168eda0b68a1df2bd11e56b7cbd8ceb55e0dbc66f0b3903a9d6b864
|
7
|
+
data.tar.gz: 0d26f45dba3d796355d09e55e988c88e006c2827b3d1e09bfc91689450144de192c62b89b649740374fe113860b03fc2f5b96b4f31c488d343a72296487830a2
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -33,6 +33,8 @@ You can set a `logger` as well.
|
|
33
33
|
Changelog
|
34
34
|
---------
|
35
35
|
|
36
|
+
* v.0.4.2 Include longCode attribute to the Afterbanks::Error class
|
37
|
+
* v.0.4.1 Increased timeout from 5min to 15min
|
36
38
|
* v.0.4.0 Add new, opt-in error for missing product, and several internal improvements
|
37
39
|
* v.0.3.4 Security: upgrade addressable from 2.7.0 to 2.8.0
|
38
40
|
* v.0.3.3 Transaction and Account are compatible with account ID
|
data/lib/afterbanks/base.rb
CHANGED
@@ -14,8 +14,9 @@ module Afterbanks
|
|
14
14
|
def api_call(method:, path:, params: {})
|
15
15
|
url = 'https://api.afterbanks.com' + path
|
16
16
|
|
17
|
-
# Timeout is set to
|
18
|
-
|
17
|
+
# Timeout is set to 15min: some banks take a lot to respond
|
18
|
+
# (e.g. ING Direct or CaixaBank in some cases)
|
19
|
+
request_params = { method: method, url: url, timeout: 60 * 15 }
|
19
20
|
|
20
21
|
if method == :post
|
21
22
|
request_params.merge!(payload: params)
|
@@ -84,11 +85,16 @@ module Afterbanks
|
|
84
85
|
return unless response_body.is_a?(Hash)
|
85
86
|
|
86
87
|
code = response_body['code']
|
88
|
+
long_code = response_body['longCode']
|
87
89
|
message = response_body['message']
|
88
90
|
additional_info = response_body['additional_info']
|
89
91
|
|
90
92
|
error_info = { message: message, debug_id: debug_id }
|
91
93
|
|
94
|
+
if !long_code.nil?
|
95
|
+
error_info[:long_code] = long_code
|
96
|
+
end
|
97
|
+
|
92
98
|
case code
|
93
99
|
when 1
|
94
100
|
raise GenericError.new(**error_info)
|
data/lib/afterbanks/error.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
module Afterbanks
|
2
2
|
class Error < ::StandardError
|
3
|
-
attr_reader :message, :debug_id, :additional_info
|
3
|
+
attr_reader :message, :debug_id, :long_code, :additional_info
|
4
4
|
|
5
|
-
def initialize(message:, debug_id:, additional_info: nil)
|
5
|
+
def initialize(message:, debug_id:, long_code: nil, additional_info: nil)
|
6
6
|
@message = message
|
7
7
|
@debug_id = debug_id
|
8
|
+
@long_code = long_code
|
8
9
|
@additional_info = additional_info
|
9
10
|
end
|
10
11
|
|
data/lib/afterbanks/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: afterbanks-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Albert Bellonch
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|