rail-locator-api 0.0.21 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rail-locator-api/api_request.rb +4 -16
- data/lib/rail-locator-api/version.rb +1 -1
- data/lib/rail-locator-api.rb +1 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 642255918703225bbbbe22588fad2836ea34410ca69599b481b05027a45a90fb
|
4
|
+
data.tar.gz: db7b2515ae3f3dfb5657d9d47cf49d3a4c61cd7251d3379fcd7f4ce79bb7bfb5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d59a9dc55e51c825311fac4121f28fbee9fe7ad8a7d46cd8808ea1f32cc0e1ecb3ee8fef032bd94ff49054958391d043dd29567dfbbbc54556547a28710e0c32
|
7
|
+
data.tar.gz: ade4c0153aecaa5e8c65d8bc8db56bfb4e2638b9df7e26807f4c9da9fee6d21f129e7ff7196828825bb644d98a5afe157e00f6571a36eaacedc8592a8c27e773
|
@@ -13,13 +13,7 @@ module RailLocatorApi
|
|
13
13
|
end
|
14
14
|
parse_response(response)
|
15
15
|
rescue => e
|
16
|
-
|
17
|
-
RailLocatorApi::Request.access_token = RailLocatorApi.generate_access_token.try(:dig, "access_token")
|
18
|
-
sleep(0.3.second)
|
19
|
-
self.post(params: params, headers: headers, suffix: suffix, body: body, first_time: false)
|
20
|
-
else
|
21
|
-
handle_error(e)
|
22
|
-
end
|
16
|
+
handle_error(e)
|
23
17
|
end
|
24
18
|
end
|
25
19
|
|
@@ -32,13 +26,7 @@ module RailLocatorApi
|
|
32
26
|
end
|
33
27
|
parse_response(response)
|
34
28
|
rescue => e
|
35
|
-
|
36
|
-
RailLocatorApi::Request.access_token = RailLocatorApi.generate_access_token.try(:dig, "access_token")
|
37
|
-
sleep(0.3.second)
|
38
|
-
self.get(params: params, headers: headers, first_time: false)
|
39
|
-
else
|
40
|
-
handle_error(e)
|
41
|
-
end
|
29
|
+
handle_error(e)
|
42
30
|
end
|
43
31
|
end
|
44
32
|
|
@@ -176,8 +164,8 @@ module RailLocatorApi
|
|
176
164
|
def validate_api_key
|
177
165
|
case self.api_auth_method
|
178
166
|
when :api_key
|
179
|
-
unless self.
|
180
|
-
raise RailLocatorApi::RailLocatorApiError, "You must set an
|
167
|
+
unless self.access_token && self.api_endpoint
|
168
|
+
raise RailLocatorApi::RailLocatorApiError, "You must set an access_token prior to making a call #{self.access_token} #{self.api_endpoint}"
|
181
169
|
end
|
182
170
|
when :base64
|
183
171
|
unless self.api_user_email && self.api_user_password
|
data/lib/rail-locator-api.rb
CHANGED
@@ -22,11 +22,10 @@ module RailLocatorApi
|
|
22
22
|
end
|
23
23
|
|
24
24
|
response = connection.post RailLocatorApi.keycloak_token_url, payload do |request|
|
25
|
-
request.headers['Content-Type'] = 'application/json'
|
26
25
|
request.headers['accept'] = 'application/json'
|
27
26
|
end
|
28
27
|
|
29
|
-
JSON.parse(response.body)
|
28
|
+
JSON.parse(response.body).try(:dig, "access_token")
|
30
29
|
end
|
31
30
|
|
32
31
|
def setup
|