confrater 0.0.4 → 0.0.5
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/confrater/api_request.rb +1 -1
- data/lib/confrater/version.rb +1 -1
- data/spec/confrater/api_request_spec.rb +5 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7cac00ddfea7d657c95c11366fc3f43fea2314ca6a41d494725ec6e4214ec40c
|
4
|
+
data.tar.gz: a006d3d1b2483b6ace29884cb51a123ef32c738a53f940d17760607035a40f0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ef3823a6a4b10c993ac9562904464e051286169b6f7525526735ab92af0345678713a259b33e7ea5848e38ef9ca53548714084dfebe1b87880e2cadc9920c45
|
7
|
+
data.tar.gz: 6b38fa520ac629d6e0b82637ffd007305585c3551e1d857a6ff522548754fbf76b7692fc172e47b114296503a7648d826bf5068f7936e1ae08ae3425d7f2208c
|
@@ -116,7 +116,7 @@ module Confrater
|
|
116
116
|
error_params = {}
|
117
117
|
|
118
118
|
begin
|
119
|
-
if error.is_a?(Faraday::
|
119
|
+
if error.is_a?(Faraday::ClientError) && error.response
|
120
120
|
error_params[:status_code] = error.response[:status]
|
121
121
|
error_params[:raw_body] = error.response[:body]
|
122
122
|
|
data/lib/confrater/version.rb
CHANGED
@@ -11,13 +11,13 @@ describe Confrater::APIRequest do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "surfaces client request exceptions as a Confrater::APIError" do
|
14
|
-
exception = Faraday::
|
14
|
+
exception = Faraday::ClientError.new("the server responded with status 503")
|
15
15
|
stub_request(:get, "#{@api_root}/users").with(basic_auth: [username, password]).to_raise(exception)
|
16
16
|
expect { @confrere.users.retrieve }.to raise_error(Confrater::APIError)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "surfaces an unparseable client request exception as a Confrater::APIError" do
|
20
|
-
exception = Faraday::
|
20
|
+
exception = Faraday::ClientError.new(
|
21
21
|
"the server responded with status 503")
|
22
22
|
stub_request(:get, "#{@api_root}/users").with(basic_auth: [username, password]).to_raise(exception)
|
23
23
|
expect { @confrere.users.retrieve }.to raise_error(Confrater::APIError)
|
@@ -25,7 +25,7 @@ describe Confrater::APIRequest do
|
|
25
25
|
|
26
26
|
it "surfaces an unparseable response body as a Confrater::APIError" do
|
27
27
|
response_values = {:status => 503, :headers => {}, :body => '[foo]'}
|
28
|
-
exception = Faraday::
|
28
|
+
exception = Faraday::ClientError.new("the server responded with status 503", response_values)
|
29
29
|
stub_request(:get, "#{@api_root}/users").with(basic_auth: [username, password]).to_raise(exception)
|
30
30
|
expect { @confrere.users.retrieve }.to raise_error(Confrater::APIError)
|
31
31
|
end
|
@@ -33,7 +33,7 @@ describe Confrater::APIRequest do
|
|
33
33
|
context "handle_error" do
|
34
34
|
it "includes status and raw body even when json can't be parsed" do
|
35
35
|
response_values = {:status => 503, :headers => {}, :body => 'A non JSON response'}
|
36
|
-
exception = Faraday::
|
36
|
+
exception = Faraday::ClientError.new("the server responded with status 503", response_values)
|
37
37
|
api_request = Confrater::APIRequest.new(builder: Confrater::Request)
|
38
38
|
begin
|
39
39
|
api_request.send :handle_error, exception
|
@@ -46,7 +46,7 @@ describe Confrater::APIRequest do
|
|
46
46
|
context "when symbolize_keys is true" do
|
47
47
|
it "sets title and detail on the error params" do
|
48
48
|
response_values = {:status => 422, :headers => {}, :body => '{"title": "foo", "detail": "bar"}'}
|
49
|
-
exception = Faraday::
|
49
|
+
exception = Faraday::ClientError.new("the server responded with status 422", response_values)
|
50
50
|
api_request = Confrater::APIRequest.new(builder: Confrater::Request.new(symbolize_keys: true))
|
51
51
|
begin
|
52
52
|
api_request.send :handle_error, exception
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: confrater
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Espen Antonsen
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2020-05-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
|
-
rubygems_version: 3.
|
127
|
+
rubygems_version: 3.1.2
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: A wrapper for Confrere API
|