glimr-api-client 0.1.5 → 0.1.6

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: 229143fd04d6c1dfc44a4bbca48da44a55b849c5
4
- data.tar.gz: f4adb0bdc538b03e55ed91340c06ec89b6066de4
3
+ metadata.gz: a6227c85a28a324ce1b0250fe3000ad2fce7080d
4
+ data.tar.gz: e4fe570d9a80974f73798ceb39152cde80235e3d
5
5
  SHA512:
6
- metadata.gz: bb9fdc6ae1b3b3adf26f8e3788e6b77910b9dc0338b9e845dc9f9fdcdc9aed07c61db2094fc1d2d24502cd022786859fb5b81b2462d3cc4e9196191906c3fe4f
7
- data.tar.gz: 1fad256df88beb72f16f23855b9195a56ec6ee8c05fc5ce3b1cf971db1c9f31e009e701d5c913baf96989dbcb8d50b81122a8d95044c20a0a8e516c129800b80
6
+ metadata.gz: 9f9cdb0f5b8877cec32b95e87308795af9383ee6c664fe9f1172191952b68e7b204947412b43dab7b9ac2c4776a3c3217275ca89c08f0fd3a1eee0ef22b1fa0a
7
+ data.tar.gz: 827cf52ac0204fabdbec791ff500ae617a0170c8069346c87e6066c63c910465b97de01864a13181866421975f9e982eadb57a295c0b4cec69acfcb64738684c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- glimr-api-client (0.1.4)
4
+ glimr-api-client (0.1.6)
5
5
  activesupport (~> 5.0)
6
6
  excon (~> 0.51)
7
7
 
@@ -1,3 +1,4 @@
1
+ require 'json'
1
2
  require 'glimr_api_client/version'
2
3
  require 'glimr_api_client/api'
3
4
  require 'glimr_api_client/available'
@@ -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
- @post ||=
9
- client.post(path: endpoint, body: request_body.to_query).tap { |resp|
10
- # Only timeouts and network issues raise errors.
11
- handle_response_errors(resp)
12
- @body = resp.body
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
- @client ||= Excon.new(
42
- ENV.fetch('GLIMR_API_URL', 'https://glimr-test.dsd.io'),
45
+ def client(uri)
46
+ Excon.new(
47
+ uri,
43
48
  headers: {
44
- 'Content-Type' => 'application/json',
45
- 'Accept' => 'application/json'
46
- },
47
- persistent: true
49
+ 'Content-Type' => 'application/json',
50
+ 'Accept' => 'application/json'
51
+ },
52
+ persistent: true
48
53
  )
49
54
  end
50
55
  end
@@ -1,3 +1,3 @@
1
1
  module GlimrApiClient
2
- VERSION = '0.1.5'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimr-api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Todd Tyree