ocean-rails 3.6.0 → 3.6.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 +15 -21
- data/lib/ocean/api_remote_resource.rb +1 -1
- 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: 9b1ebefcaefe0c03253d9b06bda0853e2e989aee
|
4
|
+
data.tar.gz: a1403dc8927f967419e22cf7007893a0fbeff4be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4eca93e9da87b0baad368541f08d7c9673fd9bc59ada298be8c3e0a0b8a83322b0b11df9f5f3d0d09041541abf380d93efae65772f64b3d84346a6b1cfb0c8fe
|
7
|
+
data.tar.gz: 5b44ae5a565e4aa376c2f07b01500479ad7f01f43d57a3840efae99f38678416a287e102754dbc121b859b26f8b0304a610759ff28a1bfa9412042f97976d7c4
|
data/lib/ocean/api.rb
CHANGED
@@ -160,8 +160,8 @@ class Api
|
|
160
160
|
# 30, etc. To disable waiting between retries entirely, set +backoff_time+ to zero.
|
161
161
|
#
|
162
162
|
def self.request(url, http_method, args: nil, headers: {}, body: nil,
|
163
|
-
credentials: nil,
|
164
|
-
x_api_token: headers['X-API-Token'],
|
163
|
+
credentials: nil, #Api.credentials,
|
164
|
+
x_api_token: headers['X-API-Token'],# || Api.service_token,
|
165
165
|
reauthentication: true,
|
166
166
|
ssl_verifypeer: true, ssl_verifyhost: 2,
|
167
167
|
retries: 0, backoff_time: 1, backoff_rate: 0.9, backoff_max: 30,
|
@@ -337,13 +337,13 @@ class Api
|
|
337
337
|
plaintext: nil, html: nil,
|
338
338
|
plaintext_url: nil, html_url: nil, substitutions: nil)
|
339
339
|
Api.request "#{INTERNAL_OCEAN_API_URL}/v1/mails", :post,
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
340
|
+
x_api_token: Api.service_token, credentials: Api.credentials,
|
341
|
+
body: {
|
342
|
+
from: from, to: to, subject: subject,
|
343
|
+
plaintext: plaintext, html: html,
|
344
|
+
plaintext_url: plaintext_url, html_url: html_url,
|
345
|
+
substitutions: substitutions
|
346
|
+
}.to_json
|
347
347
|
end
|
348
348
|
|
349
349
|
|
@@ -355,17 +355,6 @@ class Api
|
|
355
355
|
end
|
356
356
|
|
357
357
|
|
358
|
-
|
359
|
-
#
|
360
|
-
# Given that this service has authenticated successfully with the Auth service,
|
361
|
-
# returns the token returned as part of the authentication response.
|
362
|
-
# NB: This method is deprecated.
|
363
|
-
#
|
364
|
-
def self.token
|
365
|
-
ActiveSupport::Deprecation.warn "Api.token is deprecated, use Api.service_token instead and skip the explicit call to Api.authenticate.", caller
|
366
|
-
service_token
|
367
|
-
end
|
368
|
-
|
369
358
|
#
|
370
359
|
# This method returns the current token. If no current token has been obtained,
|
371
360
|
# authenticates.
|
@@ -391,7 +380,7 @@ class Api
|
|
391
380
|
#
|
392
381
|
def self.authenticate(username=API_USER, password=API_PASSWORD)
|
393
382
|
response = Api.post(:auth, "/authentications", nil,
|
394
|
-
{'X-API-Authenticate' =>
|
383
|
+
{'X-API-Authenticate' => credentials(username, password)})
|
395
384
|
case response.status
|
396
385
|
when 201
|
397
386
|
token = response.body['authentication']['token']
|
@@ -419,6 +408,11 @@ class Api
|
|
419
408
|
# credentials so that they're not immediately apparent when reading logs.
|
420
409
|
#
|
421
410
|
def self.encode_credentials(username=nil, password=nil)
|
411
|
+
ActiveSupport::Deprecation.warn "Api.encode_credentials is deprecated, use Api.credentials instead", caller
|
412
|
+
credentials username, password
|
413
|
+
end
|
414
|
+
|
415
|
+
def self.credentials(username=nil, password=nil)
|
422
416
|
raise "Only specifying the username is not allowed" if username && !password
|
423
417
|
username ||= API_USER
|
424
418
|
password ||= API_PASSWORD
|
@@ -177,7 +177,7 @@ class Api
|
|
177
177
|
|
178
178
|
|
179
179
|
def self._retrieve(rr)
|
180
|
-
if rr.credentials.present? && rr.credentials != Api.
|
180
|
+
if rr.credentials.present? && rr.credentials != Api.credentials(API_USER, API_PASSWORD)
|
181
181
|
credentials = rr.credentials
|
182
182
|
token = rr.x_api_token
|
183
183
|
else
|
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: 3.6.
|
4
|
+
version: 3.6.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-10-
|
11
|
+
date: 2014-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|