passfort 0.2.1 → 0.2.2
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/CHANGELOG.md +5 -0
- data/Gemfile.lock +5 -5
- data/lib/passfort/errors.rb +1 -0
- data/lib/passfort/errors/unparseable_response_error.rb +11 -0
- data/lib/passfort/http.rb +4 -0
- data/lib/passfort/version.rb +1 -1
- data/spec/passfort/http_spec.rb +7 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a294b6d08bf000b4e3c3b76a7509bf5f55da3d0aa6f22e8108dd4f281105f6f4
|
4
|
+
data.tar.gz: '0197567a2dae8961d1cf6bed577d17753148b17f5dee37036740acc4885365f1'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef101eaec36d8f92d3702999aca16f1a20b1bd6286b3dcc5c75247a48f10a1d746fa3454e137dd22a9ecf3673b4150d0f5bb18c790b817b9f2400ffe9c615bf3
|
7
|
+
data.tar.gz: f36f1c38db985538ea6d97c378dca856c2c864d92de9eefbb41892869dab8518ff4422da02f9b3a3260d47073bd8d3357fa593775ffcdf392773d43dbb35131c
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
passfort (0.2.
|
4
|
+
passfort (0.2.2)
|
5
5
|
activesupport (~> 5.0)
|
6
6
|
excon (~> 0.60)
|
7
7
|
|
@@ -22,8 +22,8 @@ GEM
|
|
22
22
|
safe_yaml (~> 1.0.0)
|
23
23
|
diff-lcs (1.3)
|
24
24
|
excon (0.60.0)
|
25
|
-
gc_ruboconfig (2.3.
|
26
|
-
rubocop (~> 0.
|
25
|
+
gc_ruboconfig (2.3.5)
|
26
|
+
rubocop (~> 0.54.0)
|
27
27
|
rubocop-rspec (~> 1.24)
|
28
28
|
hashdiff (0.3.7)
|
29
29
|
i18n (0.9.5)
|
@@ -31,7 +31,7 @@ GEM
|
|
31
31
|
method_source (0.9.0)
|
32
32
|
minitest (5.11.3)
|
33
33
|
parallel (1.12.1)
|
34
|
-
parser (2.5.0.
|
34
|
+
parser (2.5.0.4)
|
35
35
|
ast (~> 2.4.0)
|
36
36
|
powerpack (0.1.1)
|
37
37
|
pry (0.11.3)
|
@@ -54,7 +54,7 @@ GEM
|
|
54
54
|
rspec-support (3.7.1)
|
55
55
|
rspec_junit_formatter (0.3.0)
|
56
56
|
rspec-core (>= 2, < 4, != 2.12.0)
|
57
|
-
rubocop (0.
|
57
|
+
rubocop (0.54.0)
|
58
58
|
parallel (~> 1.10)
|
59
59
|
parser (>= 2.5)
|
60
60
|
powerpack (~> 0.1)
|
data/lib/passfort/errors.rb
CHANGED
@@ -6,6 +6,7 @@ require "passfort/errors/chargeable_limit_reached_error"
|
|
6
6
|
require "passfort/errors/invalid_api_key_error"
|
7
7
|
require "passfort/errors/invalid_input_data_error"
|
8
8
|
require "passfort/errors/request_error"
|
9
|
+
require "passfort/errors/unparseable_response_error"
|
9
10
|
|
10
11
|
module Passfort
|
11
12
|
module Errors
|
data/lib/passfort/http.rb
CHANGED
@@ -18,6 +18,8 @@ module Passfort
|
|
18
18
|
body = JSON.parse(response.body)
|
19
19
|
handle_error(response, body)
|
20
20
|
body
|
21
|
+
rescue JSON::ParserError
|
22
|
+
raise Passfort::Errors::UnparseableResponseError.new([], response)
|
21
23
|
end
|
22
24
|
|
23
25
|
def post(path, body:)
|
@@ -29,6 +31,8 @@ module Passfort
|
|
29
31
|
body = JSON.parse(response.body)
|
30
32
|
handle_error(response, body)
|
31
33
|
body
|
34
|
+
rescue JSON::ParserError
|
35
|
+
raise Passfort::Errors::UnparseableResponseError.new([], response)
|
32
36
|
end
|
33
37
|
|
34
38
|
private
|
data/lib/passfort/version.rb
CHANGED
data/spec/passfort/http_spec.rb
CHANGED
@@ -49,6 +49,13 @@ RSpec.describe Passfort::Http do
|
|
49
49
|
it { is_expected.to raise_error(error_class) }
|
50
50
|
end
|
51
51
|
|
52
|
+
context "when returning a response that can't be parsed as JSON" do
|
53
|
+
let(:body) { "<html><body><h1>something that isn't json</h1></body></html>" }
|
54
|
+
let(:error_class) { Passfort::Errors::UnparseableResponseError }
|
55
|
+
|
56
|
+
it { is_expected.to raise_error(error_class) }
|
57
|
+
end
|
58
|
+
|
52
59
|
context "when returning a successful result" do
|
53
60
|
let(:result) { subject.call }
|
54
61
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: passfort
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-03-
|
11
|
+
date: 2018-03-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -136,6 +136,7 @@ files:
|
|
136
136
|
- lib/passfort/errors/invalid_input_data_error.rb
|
137
137
|
- lib/passfort/errors/request_error.rb
|
138
138
|
- lib/passfort/errors/unknown_api_error.rb
|
139
|
+
- lib/passfort/errors/unparseable_response_error.rb
|
139
140
|
- lib/passfort/http.rb
|
140
141
|
- lib/passfort/resource.rb
|
141
142
|
- lib/passfort/resource/base.rb
|