iban-lookup 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/iban-lookup.rb +5 -6
- data/lib/iban-lookup/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd38ea7ca08426d913991b0d6fbea26ba138e261
|
4
|
+
data.tar.gz: 0f91455b6cd0991ec8c865ab529fd35f0daaf219
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 69931a317fc42510e03b321917c14bec3fbcf757f75d2c0c925649daffcacbc9b53745e9d00c6c6ea0c4123d31575f8b12e648aa2002b7623da6a7ff96a858b4
|
7
|
+
data.tar.gz: b9783f39585bab9017840f566ad8842e7c9d5ed7063ed84c0ff1bce4dee439b792e3346ed46d68944b508a89543963ffbd8f1f2d441a9a67849cc87b7ca7e98d
|
data/lib/iban-lookup.rb
CHANGED
@@ -34,7 +34,6 @@ module IbanLookup
|
|
34
34
|
attr_reader :params
|
35
35
|
|
36
36
|
def initialize(iban)
|
37
|
-
logger.info "Looking up #{iban}"
|
38
37
|
@params = {
|
39
38
|
api_key: IbanLookup.configuration.api_key,
|
40
39
|
format: :json,
|
@@ -53,16 +52,16 @@ module IbanLookup
|
|
53
52
|
|
54
53
|
def json
|
55
54
|
@json ||= begin
|
55
|
+
logger.info "Looking up #{params[:iban]}"
|
56
56
|
body = if cache
|
57
57
|
cache.get(params[:iban]).presence ||
|
58
|
-
response.body.presence.tap
|
59
|
-
logger.debug "IBAN response body: #{j}"
|
60
|
-
cache.set(params[:iban], j)
|
61
|
-
end
|
58
|
+
response.body.presence.tap { |j| cache.set(params[:iban], j) }
|
62
59
|
else
|
63
60
|
response.body.presence
|
64
61
|
end
|
65
|
-
|
62
|
+
|
63
|
+
logger.debug "IBAN response: #{body}"
|
64
|
+
JSON.parse(body.presence || '{}')
|
66
65
|
end
|
67
66
|
rescue => e
|
68
67
|
logger.error "Unable to extract JSON from IBAN response (#{e.class}): #{e.message}"
|
data/lib/iban-lookup/version.rb
CHANGED