glimr-api-client 0.1.5 → 0.1.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.lock +1 -1
- data/lib/glimr_api_client.rb +1 -0
- data/lib/glimr_api_client/api.rb +18 -13
- data/lib/glimr_api_client/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: a6227c85a28a324ce1b0250fe3000ad2fce7080d
|
4
|
+
data.tar.gz: e4fe570d9a80974f73798ceb39152cde80235e3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9f9cdb0f5b8877cec32b95e87308795af9383ee6c664fe9f1172191952b68e7b204947412b43dab7b9ac2c4776a3c3217275ca89c08f0fd3a1eee0ef22b1fa0a
|
7
|
+
data.tar.gz: 827cf52ac0204fabdbec791ff500ae617a0170c8069346c87e6066c63c910465b97de01864a13181866421975f9e982eadb57a295c0b4cec69acfcb64738684c
|
data/Gemfile.lock
CHANGED
data/lib/glimr_api_client.rb
CHANGED
data/lib/glimr_api_client/api.rb
CHANGED
@@ -4,13 +4,18 @@ require 'active_support/core_ext/object/to_query'
|
|
4
4
|
|
5
5
|
module GlimrApiClient
|
6
6
|
module Api
|
7
|
+
DEFAULT_ENDPOINT =
|
8
|
+
ENV.fetch(
|
9
|
+
'GLIMR_API_URL',
|
10
|
+
'https://glimr-api.taxtribunals.dsd.io/Live_API/api/tdsapi'
|
11
|
+
)
|
12
|
+
|
7
13
|
def post
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
}
|
14
|
+
client("#{DEFAULT_ENDPOINT}#{endpoint}").post(body: request_body.to_query).tap { |resp|
|
15
|
+
# Only timeouts and network issues raise errors.
|
16
|
+
handle_response_errors(resp)
|
17
|
+
@body = resp.body
|
18
|
+
}
|
14
19
|
rescue Excon::Error => e
|
15
20
|
if endpoint.eql?('/paymenttaken')
|
16
21
|
raise PaymentNotificationFailure, e
|
@@ -37,14 +42,14 @@ module GlimrApiClient
|
|
37
42
|
end
|
38
43
|
end
|
39
44
|
|
40
|
-
def client
|
41
|
-
|
42
|
-
|
45
|
+
def client(uri)
|
46
|
+
Excon.new(
|
47
|
+
uri,
|
43
48
|
headers: {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
49
|
+
'Content-Type' => 'application/json',
|
50
|
+
'Accept' => 'application/json'
|
51
|
+
},
|
52
|
+
persistent: true
|
48
53
|
)
|
49
54
|
end
|
50
55
|
end
|