ocean-rails 2.14.0 → 2.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ocean/api.rb +5 -2
- data/lib/ocean/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: 0b26499445f8caadefff6944958ddf4f2913faa7
|
4
|
+
data.tar.gz: c4407bf04564b7bc71f4d509e7b5d590b84bc66e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2f1d3e976221fc58e16ef706284bc0416e6f361c41a279f7d2cf9122dc5fb20a44a1e6cbdf6da3d17ddb7b616a19a8fa602648a4b44da349bec0fea773bbe520
|
7
|
+
data.tar.gz: 9be5c92fd768279e594f4cdb259fd1beda5e54273dc25ef30877f54cc98c92065fbfc8859b52a17a0ba43ad962765767aedb776bc1229a7eac1e4eb2b39c733b
|
data/lib/ocean/api.rb
CHANGED
@@ -130,10 +130,13 @@ class Api
|
|
130
130
|
# +headers+, if given, is a hash of extra HTTP headers for the request.
|
131
131
|
# +body+, if given, is the body of the request (:post, :put) as a string.
|
132
132
|
# +x_api_token+, if given, is a string which will be used as an X-API-Token header.
|
133
|
+
# +reauthentication+ (true by default), controls whether 400 and 419 will trigger reauth.
|
133
134
|
# +ssl_verifypeer+ (true by default), controls SSL peer verification.
|
135
|
+
# +ssl_verifyhost+ (2 by default), controls SSL host verification.
|
134
136
|
#
|
135
137
|
def self.request(url, http_method, args: nil, headers: {}, body: nil,
|
136
138
|
x_api_token: headers['X-API-Token'],
|
139
|
+
reauthentication: true,
|
137
140
|
ssl_verifypeer: true, ssl_verifyhost: 2)
|
138
141
|
# Set up the request
|
139
142
|
headers['Accept'] = "application/json"
|
@@ -160,11 +163,11 @@ class Api
|
|
160
163
|
elsif response.status == 0
|
161
164
|
# Could not get an http response, something's wrong.
|
162
165
|
raise Api::NoResponseError, "Api.request could not obtain a response"
|
163
|
-
elsif [400, 419].include?(response.status) && x_api_token.present?
|
166
|
+
elsif [400, 419].include?(response.status) && reauthentication && x_api_token.present?
|
164
167
|
# Re-authenticate and retry
|
165
168
|
Api.reset_service_token
|
166
169
|
headers['X-API-Token'] = Api.service_token
|
167
|
-
|
170
|
+
reauthentication = false # This prevents us from ending up here twice
|
168
171
|
else
|
169
172
|
# Failed
|
170
173
|
break
|
data/lib/ocean/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ocean-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.14.
|
4
|
+
version: 2.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Bengtson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|