allq 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/allq/actions/base.rb +4 -2
- data/lib/allq/actions/get.rb +1 -1
- data/lib/allq/actions/peek.rb +1 -1
- data/lib/allq/client.rb +12 -12
- data/lib/allq/job.rb +10 -9
- data/lib/allq/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4734e699bb46e5673f0ebbd2767395b3cb6bb486
|
4
|
+
data.tar.gz: 6e203ba2a656726e5e12690a900cee4995512c6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0272f731ea498ca15f3a7dc3ad3a0c45fadca88dc5683572f4e0ab8c904c081a525630c5d3e08e95ef6ded91892fa722ac4be11e6b7b7a3c1060fdf76c2078d
|
7
|
+
data.tar.gz: 055dc4c1af3431d540aee4e54d281f2e2d15fc1f1e3bb8d0c2c4c03e0eccc3a59d4a16951ef6f4f0fe5ed021494af72e7d806cd8b51c68129347ae8b1a1c6e8c
|
data/lib/allq/actions/base.rb
CHANGED
@@ -3,9 +3,11 @@ require 'json'
|
|
3
3
|
class AllQ
|
4
4
|
# Base class for handling allq actions
|
5
5
|
class Base
|
6
|
+
attr_reader :connection, :client
|
6
7
|
|
7
|
-
def initialize(connection)
|
8
|
+
def initialize(connection, client)
|
8
9
|
@connection = connection
|
10
|
+
@client = client
|
9
11
|
setup
|
10
12
|
end
|
11
13
|
|
@@ -34,7 +36,7 @@ class AllQ
|
|
34
36
|
job_info = result_hash["job"]
|
35
37
|
job_id = job_info["job_id"]
|
36
38
|
|
37
|
-
job = Job.new(job_id)
|
39
|
+
job = Job.new(job_id, @client)
|
38
40
|
# -- Optional fields
|
39
41
|
job.body = job_info["body"] if job_info["body"]
|
40
42
|
job.expireds = job_info["expireds"] if job_info["expireds"]
|
data/lib/allq/actions/get.rb
CHANGED
data/lib/allq/actions/peek.rb
CHANGED
data/lib/allq/client.rb
CHANGED
@@ -9,18 +9,18 @@ class AllQ
|
|
9
9
|
url = URL if url.nil?
|
10
10
|
|
11
11
|
@connection = AllQ::Connection.new(url)
|
12
|
-
@get_action = AllQ::Get.new(@connection)
|
13
|
-
@put_action = AllQ::Put.new(@connection)
|
14
|
-
@done_action = AllQ::Done.new(@connection)
|
15
|
-
@stats_action = AllQ::Stats.new(@connection)
|
16
|
-
@release_action = AllQ::Release.new(@connection)
|
17
|
-
@touch_action = AllQ::Touch.new(@connection)
|
18
|
-
@kick_action = AllQ::Kick.new(@connection)
|
19
|
-
@bury_action = AllQ::Bury.new(@connection)
|
20
|
-
@clear_action = AllQ::Clear.new(@connection)
|
21
|
-
@peek_action = AllQ::Peek.new(@connection)
|
22
|
-
@delete_action = AllQ::Delete.new(@connection)
|
23
|
-
@parent_job_action = AllQ::ParentJob.new(@connection)
|
12
|
+
@get_action = AllQ::Get.new(@connection, self)
|
13
|
+
@put_action = AllQ::Put.new(@connection, self)
|
14
|
+
@done_action = AllQ::Done.new(@connection, self)
|
15
|
+
@stats_action = AllQ::Stats.new(@connection, self)
|
16
|
+
@release_action = AllQ::Release.new(@connection, self)
|
17
|
+
@touch_action = AllQ::Touch.new(@connection, self)
|
18
|
+
@kick_action = AllQ::Kick.new(@connection, self)
|
19
|
+
@bury_action = AllQ::Bury.new(@connection, self)
|
20
|
+
@clear_action = AllQ::Clear.new(@connection, self)
|
21
|
+
@peek_action = AllQ::Peek.new(@connection, self)
|
22
|
+
@delete_action = AllQ::Delete.new(@connection, self)
|
23
|
+
@parent_job_action = AllQ::ParentJob.new(@connection, self)
|
24
24
|
end
|
25
25
|
|
26
26
|
def parent_job(tube, body, ttl: 3600, delay: 0, parent_id: nil, priority: 5, limit: nil, noop: false)
|
data/lib/allq/job.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
class AllQ
|
2
2
|
|
3
3
|
class Job
|
4
|
-
attr_accessor :id, :body, :expireds, :releases
|
5
|
-
def initialize(id, tube = nil, body = nil, expireds = nil, releases = nil)
|
4
|
+
attr_accessor :id, :body, :expireds, :releases, :client
|
5
|
+
def initialize(id, client, tube = nil, body = nil, expireds = nil, releases = nil)
|
6
6
|
@body = body
|
7
7
|
@id = id
|
8
8
|
@tube = tube
|
9
9
|
@expireds = expireds
|
10
10
|
@releases = releases
|
11
|
+
@client = client
|
11
12
|
end
|
12
13
|
|
13
14
|
def to_hash
|
@@ -21,23 +22,23 @@ class AllQ
|
|
21
22
|
end
|
22
23
|
|
23
24
|
def done
|
24
|
-
|
25
|
+
@client.done(self)
|
25
26
|
end
|
26
27
|
|
27
28
|
def delete
|
28
|
-
|
29
|
+
@client.delete(self)
|
29
30
|
end
|
30
31
|
|
31
32
|
def touch
|
32
|
-
|
33
|
+
@client.touch(self)
|
33
34
|
end
|
34
35
|
|
35
36
|
def release(delay = 0)
|
36
|
-
|
37
|
+
@client.release(self, delay)
|
37
38
|
end
|
38
39
|
|
39
40
|
def bury
|
40
|
-
|
41
|
+
@client.bury(self)
|
41
42
|
end
|
42
43
|
|
43
44
|
def to_json
|
@@ -58,14 +59,14 @@ class AllQ
|
|
58
59
|
}
|
59
60
|
end
|
60
61
|
|
61
|
-
def self.new_from_hash(hash)
|
62
|
+
def self.new_from_hash(hash, client)
|
62
63
|
begin
|
63
64
|
id = hash.fetch('job_id')
|
64
65
|
body = hash.fetch('body')
|
65
66
|
tube = hash.fetch('tube')
|
66
67
|
expireds = hash.fetch('expireds')
|
67
68
|
releases = hash.fetch('releases')
|
68
|
-
job = Job.new(id, tube, body, expireds, releases)
|
69
|
+
job = Job.new(id, client, tube, body, expireds, releases)
|
69
70
|
return job
|
70
71
|
rescue => ex
|
71
72
|
puts "Server value: #{hash}"
|
data/lib/allq/version.rb
CHANGED