visma_eaccounting 0.0.4 → 0.0.6
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/Gemfile +0 -5
- data/lib/visma_eaccounting/api_request.rb +3 -4
- data/lib/visma_eaccounting/version.rb +1 -1
- data/lib/visma_eaccounting.rb +1 -0
- data/spec/visma_eaccounting/api_request_spec.rb +5 -5
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cddf0d722fea1c913468ad14eeb3269b2391b1a4f4a5c3ef21726c301b249627
|
4
|
+
data.tar.gz: cddd485073e76261b98f20e2ef67d8730b6208ff19f8dce81538edf2347b36d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fab8e77ad40b4e704112c289cfd607b7e1819ed58679b3ad176029a8c13069722b4bab68626aa1e0f1a1f0fb54420052a12fc39c6fcd544b21793beb6c51163c
|
7
|
+
data.tar.gz: 65a4863fa2cd059587cf94c0488f0cdf79849b2e190beec284e330f52bdc8008c0a88f495c7ce48de29343f1914421959763a6be82841edc5e4b4c6da70d8940
|
data/Gemfile
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
|
|
@@ -149,15 +149,14 @@ module VismaEaccounting
|
|
149
149
|
end
|
150
150
|
|
151
151
|
def rest_client
|
152
|
-
|
152
|
+
Faraday.new(self.api_url, proxy: self.proxy, ssl: { version: "TLSv1_2" }) do |faraday|
|
153
153
|
faraday.response :raise_error
|
154
154
|
faraday.adapter adapter
|
155
155
|
if @request_builder.debug
|
156
156
|
faraday.response :logger, @request_builder.logger, bodies: true
|
157
157
|
end
|
158
|
+
conn.request :authorization, 'Bearer', self.token
|
158
159
|
end
|
159
|
-
client.authorization :Bearer, self.token
|
160
|
-
client
|
161
160
|
end
|
162
161
|
|
163
162
|
def parse_response(response)
|
data/lib/visma_eaccounting.rb
CHANGED
@@ -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,15 +1,15 @@
|
|
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.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Espen Antonsen
|
8
8
|
- Amro Mousa
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-02-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
- !ruby/object:Gem::Version
|
83
83
|
version: '0'
|
84
84
|
description: A wrapper for Visma eAccounting API 2.0
|
85
|
-
email:
|
85
|
+
email:
|
86
86
|
executables: []
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
@@ -111,7 +111,7 @@ homepage: http://github.com/espen/visma_eaccounting
|
|
111
111
|
licenses:
|
112
112
|
- MIT
|
113
113
|
metadata: {}
|
114
|
-
post_install_message:
|
114
|
+
post_install_message:
|
115
115
|
rdoc_options: []
|
116
116
|
require_paths:
|
117
117
|
- lib
|
@@ -126,8 +126,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
- !ruby/object:Gem::Version
|
127
127
|
version: '0'
|
128
128
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
130
|
-
signing_key:
|
129
|
+
rubygems_version: 3.5.5
|
130
|
+
signing_key:
|
131
131
|
specification_version: 4
|
132
132
|
summary: A wrapper for Visma eAccounting API 2.0
|
133
133
|
test_files:
|