glimr-api-client 0.2.2 → 0.2.3
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 +10 -2
- 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: f2a465b55c349f163e7ed0c3a1c1615e79f81cd4
|
4
|
+
data.tar.gz: 946d139aa937ee74cb839b751a45d36d0fb11328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22dd47ac86558090a6110a34d12a83e5fde8bfcb683d4a2bd1b667bf7645ae7461a77ee03792def2adcec3669ea7be2277e88d17cb71bc783f55ab101bc2f163
|
7
|
+
data.tar.gz: bd3f2a0deaa3702e5481a666b927d4ca0e887f5999760016aa0065fcae10ed41097874dc0f60202c46131da2a2cffc661e1e788e55782335b759251c14cb5b4f
|
data/lib/glimr_api_client/api.rb
CHANGED
@@ -2,9 +2,17 @@ require 'excon'
|
|
2
2
|
|
3
3
|
module GlimrApiClient
|
4
4
|
module Api
|
5
|
+
# Showing the GLiMR post & response in the container logs is helpful
|
6
|
+
# for troubleshooting in the staging environment (when we are using
|
7
|
+
# the websocket link to communicate with a GLiMR instance to which
|
8
|
+
# we have very limited access.
|
9
|
+
# DO NOT SET THIS ENV VAR IN PRODUCTION - we should not be logging
|
10
|
+
# this sensitive user data from the live service.
|
5
11
|
def post
|
12
|
+
puts "GLIMR POST: #{request_body.to_json}" if ENV.key?('GLIMR_API_DEBUG')
|
6
13
|
client("#{api_url}#{endpoint}").post(body: request_body.to_json).tap { |resp|
|
7
14
|
handle_response_errors(resp) if (400..599).cover?(resp.status)
|
15
|
+
puts "GLIMR RESPONSE: #{resp.body}" if ENV.key?('GLIMR_API_DEBUG')
|
8
16
|
@body = resp.body
|
9
17
|
}
|
10
18
|
rescue Excon::Error => e
|
@@ -15,7 +23,7 @@ module GlimrApiClient
|
|
15
23
|
@response_body ||= JSON.parse(@body, symbolize_names: true)
|
16
24
|
end
|
17
25
|
|
18
|
-
def timeout
|
26
|
+
def timeout
|
19
27
|
Integer(ENV.fetch('GLIMR_API_TIMEOUT_SECONDS', 5))
|
20
28
|
end
|
21
29
|
|
@@ -54,7 +62,7 @@ module GlimrApiClient
|
|
54
62
|
'Accept' => 'application/json'
|
55
63
|
},
|
56
64
|
persistent: true,
|
57
|
-
read_timeout: timeout
|
65
|
+
read_timeout: timeout
|
58
66
|
)
|
59
67
|
end
|
60
68
|
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.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Tyree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-02-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|