ocean-rails 3.9.0 → 4.0.0
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 +63 -63
- 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: 2680dfb63919db3bb5b39740682bb6bb5c2714b7
|
4
|
+
data.tar.gz: 968ce1425b26201205c8972b35286c611a89566d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
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
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
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.
|
419
|
-
|
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']
|
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:
|
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-
|
11
|
+
date: 2014-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|