visma_eaccounting 0.0.4 → 0.0.5
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 705adf9df4f3bb1b7ae01506f64e2b1012e98281268039f5dd51ee7ba021bdda
|
4
|
+
data.tar.gz: 32798ebd37bce73b8536ac812092d50c6d4d1432e4728b74f240f34a8b0b1b42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63fc82b57b5e9f76fdc09b2314d459a8ee4873012db5b07e53d3dba867f43149e177935a598e2e946078ac9a7df21d84914256f089fc89ffed05fc945fc67e32
|
7
|
+
data.tar.gz: 88d934be8d45be3d5542d02fbf4882d80adb68624025a4a817cb4b364cd73e554c54cb8a23f3b2ee05c4ac4e809c16479b81f03a01bde9b2428f439c0591f321
|
data/lib/visma_eaccounting.rb
CHANGED
@@ -112,7 +112,7 @@ module VismaEaccounting
|
|
112
112
|
error_params = {}
|
113
113
|
|
114
114
|
begin
|
115
|
-
if error.is_a?(Faraday::
|
115
|
+
if error.is_a?(Faraday::ClientError) && error.response
|
116
116
|
error_params[:status_code] = error.response[:status]
|
117
117
|
error_params[:raw_body] = error.response[:body]
|
118
118
|
|
@@ -10,13 +10,13 @@ describe VismaEaccounting::APIRequest do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "surfaces client request exceptions as a VismaEaccounting::APIError" do
|
13
|
-
exception = Faraday::
|
13
|
+
exception = Faraday::ClientError.new("the server responded with status 503")
|
14
14
|
stub_request(:get, "#{@api_root}/customers").to_raise(exception)
|
15
15
|
expect { @visma_eaccounting.customers.retrieve }.to raise_error(VismaEaccounting::APIError)
|
16
16
|
end
|
17
17
|
|
18
18
|
it "surfaces an unparseable client request exception as a VismaEaccounting::APIError" do
|
19
|
-
exception = Faraday::
|
19
|
+
exception = Faraday::ClientError.new(
|
20
20
|
"the server responded with status 503")
|
21
21
|
stub_request(:get, "#{@api_root}/customers").to_raise(exception)
|
22
22
|
expect { @visma_eaccounting.customers.retrieve }.to raise_error(VismaEaccounting::APIError)
|
@@ -24,7 +24,7 @@ describe VismaEaccounting::APIRequest do
|
|
24
24
|
|
25
25
|
it "surfaces an unparseable response body as a VismaEaccounting::APIError" do
|
26
26
|
response_values = {:status => 503, :headers => {}, :body => '[foo]'}
|
27
|
-
exception = Faraday::
|
27
|
+
exception = Faraday::ClientError.new("the server responded with status 503", response_values)
|
28
28
|
|
29
29
|
stub_request(:get, "#{@api_root}/customers").to_raise(exception)
|
30
30
|
expect { @visma_eaccounting.customers.retrieve }.to raise_error(VismaEaccounting::APIError)
|
@@ -33,7 +33,7 @@ describe VismaEaccounting::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 = VismaEaccounting::APIRequest.new(builder: VismaEaccounting::Request)
|
38
38
|
begin
|
39
39
|
api_request.send :handle_error, exception
|
@@ -46,7 +46,7 @@ describe VismaEaccounting::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 = VismaEaccounting::APIRequest.new(builder: VismaEaccounting::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: visma_eaccounting
|
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
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
129
|
+
rubygems_version: 3.1.2
|
130
130
|
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: A wrapper for Visma eAccounting API 2.0
|