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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a141aea85f1604c7d49a05601082143cc12b203e
4
- data.tar.gz: 8095cc0fd6b401f93cfb0d87940537e7ca1f45a6
3
+ metadata.gz: 5c8e8313e4f1eab5051b6876e244f8145e75183b
4
+ data.tar.gz: 69ee872e8f307a6c1d27adddb97cafff20eacc37
5
5
  SHA512:
6
- metadata.gz: b8420baefe7e12dc34e53addb4d582c946a1ad9d9dc20da1bcebfb220dda6364df2da20caa7fd95edf310c5c6c302ef7fb760c76e9d72fe6bf181390f346ecf7
7
- data.tar.gz: b4c42aec4b786ffdd1d7145489322a51879854de0c7f89edcafbae601ec56de7c1b9910bb7ae8723afa4dd48cad010d1394bf268b438fd77bc76c8be72bc2ccb
6
+ metadata.gz: d4c11c643f75b201093b3a3de81050daf104f4367b0719a8675b87066aa42a3fff27edb84140017c36c63905876e23251605dd61517b06fb13cf6320c93739ce
7
+ data.tar.gz: dbba00821847a3d71bf7c4e68b20b1d0208537bd58dd259f12824ef18d684ad5b0ace73cbf309dbd9f2dbf239c6da4d4c6ab0ce7cd09b8adca06d95ba27b1e5b
@@ -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("#{DEFAULT_ENDPOINT}#{endpoint}").post(body: request_body.to_query).tap { |resp|
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
- 'Content-Type' => 'application/json',
53
- 'Accept' => 'application/json'
54
- },
55
- persistent: true
54
+ 'Content-Type' => 'application/json',
55
+ 'Accept' => 'application/json'
56
+ },
57
+ persistent: true
56
58
  )
57
59
  end
58
60
  end
@@ -1,3 +1,3 @@
1
1
  module GlimrApiClient
2
- VERSION = '0.1.8'
2
+ VERSION = '0.1.9'
3
3
  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.8
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-26 00:00:00.000000000 Z
11
+ date: 2016-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler