ocean-rails 3.9.0 → 4.0.0

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: c03d917f00041083de25676b0e29d98840a38e88
4
- data.tar.gz: 364ddfa8ad3ef5f0bf3c371cc92569b1bd982dab
3
+ metadata.gz: 2680dfb63919db3bb5b39740682bb6bb5c2714b7
4
+ data.tar.gz: 968ce1425b26201205c8972b35286c611a89566d
5
5
  SHA512:
6
- metadata.gz: 98554e6882e089e75b0751bdd879c7e3d9c4dde7ff90a1f2d778c17b552fc3ae71d99e4b5003bf8d02df144052bfa8ac016ed892037e63ac4348a9e2a03a65b4
7
- data.tar.gz: edbe8eee4187fc1fe0a284f69e6bffb33ec825c1d203f275d66c41a65fd04a886c6d19ac788643088e9ec88c9be324b3e42375ff63519fe713a7fca01b94139f
6
+ metadata.gz: d66569c6c23db6e252a9ce5c0a30ccba12658cca50a27422e18e2802f6e1e63c5cada7f4f96265466b51ebdbbdad9b6cff71eae9e33da94ec446ff322c0eb7dc
7
+ data.tar.gz: bbb575ba4514f23dcfe627fcb8fad0fb0336590bb40f251444519acadea8dc15e03a8d57d06256bf4679294a0946eab2c3eea837479165e25ba87b847ef687f1
data/lib/ocean/api.rb CHANGED
@@ -190,7 +190,7 @@ class Api
190
190
  response = nil
191
191
 
192
192
  # This is a Proc when run queues the request and schedules retries
193
- enqueue_request = Proc.new do
193
+ enqueue_request = lambda do
194
194
  # First construct a request. It will not be sent yet.
195
195
  request = Typhoeus::Request.new(url,
196
196
  method: http_method,
@@ -290,66 +290,66 @@ class Api
290
290
  class TimeoutError < StandardError; end
291
291
  class NoResponseError < StandardError; end
292
292
 
293
- #
294
- # Makes an internal HTTP request to +host_url+ using the HTTP method +method+. The +resource_name+
295
- # is used to obtain the latest version string of the resource. The arg +path+ is the
296
- # local path, +args+ is a hash of query args, and +headers+ a hash of extra HTTP headers.
297
- #
298
- # Returns the response in its entirety so that the caller can examine its status and body.
299
- #
300
- # It is quite probable that this method will become deprecated. The main reason for its existence
301
- # is the version computation, nothing more, and separating host and path isn't ideal.
302
- #
303
- def self.call(host_url, http_method, resource_name, path, args=nil, headers={})
304
- if [:post, :put].include? http_method
305
- request "#{host_url}/#{version_for resource_name}#{path}", http_method,
306
- headers: headers, body: args
307
- else
308
- request "#{host_url}/#{version_for resource_name}#{path}", http_method,
309
- headers: headers, args: args
310
- end
311
- end
312
-
313
-
314
- #
315
- # Convenience method to make an internal +GET+ request to the Ocean Api. The +resource_name+
316
- # is used to obtain the latest version string of the resource. The arg +path+ is the
317
- # local path, +args+ is a hash of query args, and +headers+ a hash of extra HTTP headers.
318
- #
319
- # Returns the response in its entirety so that the caller can examine its status and body.
320
- #
321
- #
322
- def self.get(*args) call(INTERNAL_OCEAN_API_URL, :get, *args); end
323
-
324
- #
325
- # Convenience method to make an internal +POST+ request to the Ocean Api. The +resource_name+
326
- # is used to obtain the latest version string of the resource. The arg +path+ is the
327
- # local path, +args+ is a hash of query args, and +headers+ a hash of extra HTTP headers.
328
- #
329
- # Returns the response in its entirety so that the caller can examine its status and body.
330
- #
331
- #
332
- def self.post(*args) call(INTERNAL_OCEAN_API_URL, :post, *args); end
333
-
334
- #
335
- # Convenience method to make an internal +PUT+ request to the Ocean Api. The +resource_name+
336
- # is used to obtain the latest version string of the resource. The arg +path+ is the
337
- # local path, +args+ is a hash of query args, and +headers+ a hash of extra HTTP headers.
338
- #
339
- # Returns the response in its entirety so that the caller can examine its status and body.
340
- #
341
- #
342
- def self.put(*args) call(INTERNAL_OCEAN_API_URL, :put, *args); end
343
-
344
- #
345
- # Convenience method to make an internal +DELETE+ request to the Ocean Api. The +resource_name+
346
- # is used to obtain the latest version string of the resource. The arg +path+ is the
347
- # local path, +args+ is a hash of query args, and +headers+ a hash of extra HTTP headers.
348
- #
349
- # Returns the response in its entirety so that the caller can examine its status and body.
350
- #
351
- #
352
- def self.delete(*args) call(INTERNAL_OCEAN_API_URL, :delete, *args); end
293
+ # #
294
+ # # Makes an internal HTTP request to +host_url+ using the HTTP method +method+. The +resource_name+
295
+ # # is used to obtain the latest version string of the resource. The arg +path+ is the
296
+ # # local path, +args+ is a hash of query args, and +headers+ a hash of extra HTTP headers.
297
+ # #
298
+ # # Returns the response in its entirety so that the caller can examine its status and body.
299
+ # #
300
+ # # It is quite probable that this method will become deprecated. The main reason for its existence
301
+ # # is the version computation, nothing more, and separating host and path isn't ideal.
302
+ # #
303
+ # def self.call(host_url, http_method, resource_name, path, args=nil, headers={})
304
+ # if [:post, :put].include? http_method
305
+ # request "#{host_url}/#{version_for resource_name}#{path}", http_method,
306
+ # headers: headers, body: args
307
+ # else
308
+ # request "#{host_url}/#{version_for resource_name}#{path}", http_method,
309
+ # headers: headers, args: args
310
+ # end
311
+ # end
312
+
313
+
314
+ # #
315
+ # # Convenience method to make an internal +GET+ request to the Ocean Api. The +resource_name+
316
+ # # is used to obtain the latest version string of the resource. The arg +path+ is the
317
+ # # local path, +args+ is a hash of query args, and +headers+ a hash of extra HTTP headers.
318
+ # #
319
+ # # Returns the response in its entirety so that the caller can examine its status and body.
320
+ # #
321
+ # #
322
+ # def self.get(*args) call(INTERNAL_OCEAN_API_URL, :get, *args); end
323
+
324
+ # #
325
+ # # Convenience method to make an internal +POST+ request to the Ocean Api. The +resource_name+
326
+ # # is used to obtain the latest version string of the resource. The arg +path+ is the
327
+ # # local path, +args+ is a hash of query args, and +headers+ a hash of extra HTTP headers.
328
+ # #
329
+ # # Returns the response in its entirety so that the caller can examine its status and body.
330
+ # #
331
+ # #
332
+ # def self.post(*args) call(INTERNAL_OCEAN_API_URL, :post, *args); end
333
+
334
+ # #
335
+ # # Convenience method to make an internal +PUT+ request to the Ocean Api. The +resource_name+
336
+ # # is used to obtain the latest version string of the resource. The arg +path+ is the
337
+ # # local path, +args+ is a hash of query args, and +headers+ a hash of extra HTTP headers.
338
+ # #
339
+ # # Returns the response in its entirety so that the caller can examine its status and body.
340
+ # #
341
+ # #
342
+ # def self.put(*args) call(INTERNAL_OCEAN_API_URL, :put, *args); end
343
+
344
+ # #
345
+ # # Convenience method to make an internal +DELETE+ request to the Ocean Api. The +resource_name+
346
+ # # is used to obtain the latest version string of the resource. The arg +path+ is the
347
+ # # local path, +args+ is a hash of query args, and +headers+ a hash of extra HTTP headers.
348
+ # #
349
+ # # Returns the response in its entirety so that the caller can examine its status and body.
350
+ # #
351
+ # #
352
+ # def self.delete(*args) call(INTERNAL_OCEAN_API_URL, :delete, *args); end
353
353
 
354
354
 
355
355
  #
@@ -415,8 +415,8 @@ class Api
415
415
  # If not successful, +nil+ is returned.
416
416
  #
417
417
  def self.authenticate(username=API_USER, password=API_PASSWORD)
418
- response = Api.post(:auth, "/authentications", nil,
419
- {'X-API-Authenticate' => credentials(username, password)})
418
+ response = Api.request "#{INTERNAL_OCEAN_API_URL}/v1/authentications", :post,
419
+ headers: {'X-API-Authenticate' => credentials(username, password)}
420
420
  case response.status
421
421
  when 201
422
422
  token = response.body['authentication']['token']
@@ -447,7 +447,7 @@ class Api
447
447
  end
448
448
 
449
449
 
450
- def _retrieve#(args: nil)
450
+ def _retrieve
451
451
  credentials, token = _credentials(self)
452
452
  response = Api.request Api.internalize_uri(uri), :get, args: args,
453
453
  headers: {},
data/lib/ocean/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ocean
2
- VERSION = "3.9.0"
2
+ VERSION = "4.0.0"
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.9.0
4
+ version: 4.0.0
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-14 00:00:00.000000000 Z
11
+ date: 2014-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus