analytics-psw 0.3.9 → 0.4.0
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/lib/analytics-psw/utilities.rb +9 -8
- 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: 9499d8a657ac60c485780e5ddd2d275ee32a1329
|
|
4
|
+
data.tar.gz: 9026c4856a76242889d8d895ab1f2fad66ff1fe8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4f119b8f4c62f5463f8a1a4e24152876acc7f59357d00d3cebad6fab3093cb36ef0d26ba8b5062f1fb9a0ddba285957a77b06301cfa872bc1f1236be60ff0dd0
|
|
7
|
+
data.tar.gz: 81329a78dea56cc5019b0b871ea767f0f681e427d1d5c57e8e69dc254ad500990b12b9885db102ee094f060d25695757b87be8ddc7a8e653f69042fe03293a0d
|
|
@@ -6,11 +6,12 @@ module AnalyticsPSW
|
|
|
6
6
|
@expires = nil
|
|
7
7
|
response = @conn.post do |request|
|
|
8
8
|
request.url "#{@server_url}/oauth/token?client_id=#{@client_id}&client_secret=#{@client_secret}"
|
|
9
|
-
request.headers['Content-Type'] = 'application/json'
|
|
9
|
+
request.headers['Content-Type'] = 'application/json'
|
|
10
10
|
end
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
@
|
|
11
|
+
parsed_response = parse_json_response(response)
|
|
12
|
+
if parsed_response['body'].present?
|
|
13
|
+
@token = parsed_response['body']['access_token']
|
|
14
|
+
@expires = Time.now + parsed_response['body']['expires_in']
|
|
14
15
|
end
|
|
15
16
|
end
|
|
16
17
|
|
|
@@ -27,12 +28,12 @@ module AnalyticsPSW
|
|
|
27
28
|
req.params = params if params
|
|
28
29
|
req.body = body if body
|
|
29
30
|
end
|
|
30
|
-
|
|
31
|
-
break if [200, 201, 202].include?(
|
|
32
|
-
update_token if
|
|
31
|
+
parsed_response = parse_json_response(@conn.send(http_method, &json_block))
|
|
32
|
+
break if [200, 201, 202].include?(parsed_response['status'])
|
|
33
|
+
update_token if parsed_response['status'] == 401
|
|
33
34
|
retries -= 1
|
|
34
35
|
end
|
|
35
|
-
|
|
36
|
+
parsed_response
|
|
36
37
|
end
|
|
37
38
|
|
|
38
39
|
def multi_get_json(service_location, query_parameters)
|