cloudq_client 0.0.5 → 0.0.6
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.
- data/lib/cloudq/consume.rb +18 -10
- data/lib/cloudq/publish.rb +7 -3
- data/lib/cloudq/version.rb +1 -1
- metadata +17 -3
data/lib/cloudq/consume.rb
CHANGED
@@ -12,16 +12,24 @@ module Cloudq
|
|
12
12
|
klass = Object.const_get(a_job["klass"])
|
13
13
|
klass.perform(*a_job["args"])
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def get(&block)
|
17
|
-
RestClient.get url
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
17
|
+
resp = RestClient.get url
|
18
|
+
if resp.code == 200
|
19
|
+
result = JSON.parse(resp)
|
20
|
+
return nil if result['status'] == 'empty'
|
21
|
+
yield result
|
22
|
+
result
|
24
23
|
end
|
24
|
+
|
25
|
+
# RestClient.get url do |response|
|
26
|
+
# if response.code == 200
|
27
|
+
# result = JSON.parse(response)
|
28
|
+
# return nil if result['status'] == 'empty'
|
29
|
+
# yield result
|
30
|
+
# result
|
31
|
+
# end
|
32
|
+
# end
|
25
33
|
end
|
26
34
|
|
27
35
|
def delete(job_id)
|
@@ -32,9 +40,9 @@ module Cloudq
|
|
32
40
|
[Cloudq::Connection.url, @queue].join('/')
|
33
41
|
end
|
34
42
|
|
35
|
-
|
43
|
+
|
36
44
|
|
37
45
|
end
|
38
46
|
end
|
39
47
|
|
40
|
-
|
48
|
+
|
data/lib/cloudq/publish.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'backports'
|
1
2
|
require 'rest-client'
|
2
3
|
require 'json'
|
3
4
|
|
@@ -11,9 +12,12 @@ module Cloudq
|
|
11
12
|
private
|
12
13
|
def post(data)
|
13
14
|
headers = {:content_type => :json, :accept => :json}
|
14
|
-
RestClient.post [Cloudq::Connection.url, @queue].join('/'), data, headers do |response|
|
15
|
-
|
16
|
-
end
|
15
|
+
# RestClient.post [Cloudq::Connection.url, @queue].join('/'), data, headers do |response|
|
16
|
+
# JSON.parse(response)['status'] == 'success'
|
17
|
+
# end
|
18
|
+
resp = RestClient.post [Cloudq::Connection.url, @queue].join('/'), data, headers
|
19
|
+
JSON.parse(resp)['status'] == 'success'
|
20
|
+
|
17
21
|
end
|
18
22
|
|
19
23
|
def jsonize(data)
|
data/lib/cloudq/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudq_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tom Wilson
|
@@ -64,6 +64,20 @@ dependencies:
|
|
64
64
|
version: "0"
|
65
65
|
type: :runtime
|
66
66
|
version_requirements: *id003
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: json
|
69
|
+
prerelease: false
|
70
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
hash: 3
|
76
|
+
segments:
|
77
|
+
- 0
|
78
|
+
version: "0"
|
79
|
+
type: :runtime
|
80
|
+
version_requirements: *id004
|
67
81
|
description: "The Cloudq Client gem is an awesome client interface to the cloudq a remote job queue engine that allows you to publish jobs and subscribe from jobs anywhere in the cloud.... "
|
68
82
|
email:
|
69
83
|
- tom@jackhq.com
|