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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 93da2aaae658c8d687731caf9767b5aaf2b16437
4
- data.tar.gz: 9ca92f90ec4f77bb28eca4caec17af0d9f16f60e
3
+ metadata.gz: 0b26499445f8caadefff6944958ddf4f2913faa7
4
+ data.tar.gz: c4407bf04564b7bc71f4d509e7b5d590b84bc66e
5
5
  SHA512:
6
- metadata.gz: d8e471acbac49e52dca44a319c08cb6df22a64f8e85b1c1255aa9b60fc32d01df1b0befca5d1bbb27e2dbb566dbd71780009b7e7b5ef541f93eeedca755e87e7
7
- data.tar.gz: 87b58bd0d2d2b4701c3b666972d748a7c4c6be2d3d1921e5f5004a7f50f71f961bab6591765e4dada345f122630316f7e93dcafab050feefed84418c267b3c87
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
- x_api_token = false # This prevents us from ending up here twice
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
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "2.14.0"
2
+ VERSION = "2.14.1"
3
3
  end
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.0
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-10 00:00:00.000000000 Z
11
+ date: 2014-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus