glimr-api-client 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/glimr_api_client/api.rb +13 -11
- data/lib/glimr_api_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c8e8313e4f1eab5051b6876e244f8145e75183b
|
4
|
+
data.tar.gz: 69ee872e8f307a6c1d27adddb97cafff20eacc37
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4c11c643f75b201093b3a3de81050daf104f4367b0719a8675b87066aa42a3fff27edb84140017c36c63905876e23251605dd61517b06fb13cf6320c93739ce
|
7
|
+
data.tar.gz: dbba00821847a3d71bf7c4e68b20b1d0208537bd58dd259f12824ef18d684ad5b0ace73cbf309dbd9f2dbf239c6da4d4c6ab0ce7cd09b8adca06d95ba27b1e5b
|
data/lib/glimr_api_client/api.rb
CHANGED
@@ -4,14 +4,8 @@ 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
|
-
|
13
7
|
def post
|
14
|
-
client("#{
|
8
|
+
client("#{api_url}#{endpoint}").post(body: request_body.to_query).tap { |resp|
|
15
9
|
# Only timeouts and network issues raise errors.
|
16
10
|
handle_response_errors(resp)
|
17
11
|
@body = resp.body
|
@@ -26,6 +20,14 @@ module GlimrApiClient
|
|
26
20
|
|
27
21
|
private
|
28
22
|
|
23
|
+
# If this is set using a constant, and the gem is included in a project
|
24
|
+
# that uses the dotenv gem, then it will always fall through to the default
|
25
|
+
# unless dotenv is included and required before this gem is loaded.
|
26
|
+
def api_url
|
27
|
+
ENV.fetch('GLIMR_API_URL',
|
28
|
+
'https://glimr-api.taxtribunals.dsd.io/Live_API/api/tdsapi')
|
29
|
+
end
|
30
|
+
|
29
31
|
def handle_response_errors(resp)
|
30
32
|
if (!endpoint.eql?('/paymenttaken') && resp.status.equal?(404))
|
31
33
|
raise CaseNotFound, resp.status
|
@@ -49,10 +51,10 @@ module GlimrApiClient
|
|
49
51
|
Excon.new(
|
50
52
|
uri,
|
51
53
|
headers: {
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
54
|
+
'Content-Type' => 'application/json',
|
55
|
+
'Accept' => 'application/json'
|
56
|
+
},
|
57
|
+
persistent: true
|
56
58
|
)
|
57
59
|
end
|
58
60
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimr-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Tyree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|