ocean-rails 3.6.0 → 3.6.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ffd71974843be7814eb5525a922476eb6ef8fe0f
4
- data.tar.gz: 2a7a085c80e739c5e6f086d8ecf1d16a665c11ba
3
+ metadata.gz: 9b1ebefcaefe0c03253d9b06bda0853e2e989aee
4
+ data.tar.gz: a1403dc8927f967419e22cf7007893a0fbeff4be
5
5
  SHA512:
6
- metadata.gz: d5fd03559ce4ae215d0a381da478cbdd1a5010439442013257b5c6283b16d0a581778a54470171a0144d0a3582ebc16aa5e526da77a03c3601d64630b83dfa62
7
- data.tar.gz: c549619b11f6e6178d43fe01509f2b980dcb44437c8aa5893ad4c3c2a71c71ca7370f5859a50ce96a870313d77f6162423382c7af90822a75cc9a83552e4b46f
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
- x_api_token: Api.service_token,
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
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' => encode_credentials(username, password)})
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.encode_credentials(API_USER, API_PASSWORD)
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
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "3.6.0"
2
+ VERSION = "3.6.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: 3.6.0
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-01 00:00:00.000000000 Z
11
+ date: 2014-10-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus