iron_mq 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +1 -1
- data/iron_mq.gemspec +2 -2
- data/lib/iron_mq/messages.rb +6 -6
- data/test/quick_run.rb +12 -7
- data/test/test_base.rb +18 -2
- data/test/test_iron_mq.rb +2 -0
- metadata +10 -10
data/VERSION.yml
CHANGED
data/iron_mq.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "iron_mq"
|
8
|
-
s.version = "1.3.
|
8
|
+
s.version = "1.3.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Travis Reeder"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2012-01-04"
|
13
13
|
s.description = "Ruby client for IronMQ"
|
14
14
|
s.email = "travis@iron.io"
|
15
15
|
s.extra_rdoc_files = [
|
data/lib/iron_mq/messages.rb
CHANGED
@@ -16,11 +16,7 @@ module IronMQ
|
|
16
16
|
# :timeout => amount of time before message goes back on the queue
|
17
17
|
def get(options={})
|
18
18
|
begin
|
19
|
-
|
20
|
-
if options[:timeout]
|
21
|
-
params = {:timeout => options[:timeout]}
|
22
|
-
end
|
23
|
-
res, status = @client.get(path(options), params)
|
19
|
+
res, status = @client.get(path(options), options)
|
24
20
|
return Message.new(self, res)
|
25
21
|
rescue IronMQ::Error => ex
|
26
22
|
if ex.status == 404
|
@@ -34,8 +30,12 @@ module IronMQ
|
|
34
30
|
|
35
31
|
# options:
|
36
32
|
# :queue_name => can specify an alternative queue name
|
33
|
+
# :delay => time to wait before message will be available on the queue
|
34
|
+
# :timeout => The time in seconds to wait after message is taken off the queue, before it is put back on. Delete before :timeout to ensure it does not go back on the queue.
|
35
|
+
# :expires_in => After this time, message will be automatically removed from the queue.
|
37
36
|
def post(payload, options={})
|
38
|
-
|
37
|
+
options[:body] = payload
|
38
|
+
res, status = @client.post(path(options), options)
|
39
39
|
return Message.new(self, res)
|
40
40
|
end
|
41
41
|
|
data/test/quick_run.rb
CHANGED
@@ -2,27 +2,32 @@
|
|
2
2
|
require_relative 'test_base'
|
3
3
|
|
4
4
|
class QuickRun < TestBase
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
end
|
5
|
+
|
6
|
+
def setup
|
7
|
+
super
|
8
|
+
@client.queue_name = 'ironmq-gem-quick'
|
9
|
+
end
|
10
10
|
|
11
11
|
def test_basics
|
12
12
|
res = @client.messages.post("hello world!")
|
13
|
+
assert res.id
|
14
|
+
assert res.msg
|
13
15
|
p res
|
14
16
|
|
15
17
|
res = @client.messages.get()
|
18
|
+
assert res.id
|
19
|
+
assert res.body
|
16
20
|
p res
|
17
21
|
|
18
22
|
res = @client.messages.delete(res["id"])
|
23
|
+
assert res.msg
|
19
24
|
p res
|
20
25
|
|
21
26
|
res = @client.messages.get()
|
22
27
|
p res
|
23
|
-
|
28
|
+
|
24
29
|
end
|
25
30
|
|
26
|
-
|
31
|
+
|
27
32
|
end
|
28
33
|
|
data/test/test_base.rb
CHANGED
@@ -10,12 +10,28 @@ end
|
|
10
10
|
|
11
11
|
|
12
12
|
class TestBase < Test::Unit::TestCase
|
13
|
-
|
13
|
+
def setup
|
14
14
|
puts 'setup'
|
15
|
-
|
15
|
+
# check multiple config locations
|
16
|
+
@config = load_config
|
17
|
+
puts "config=" + @config.inspect
|
16
18
|
@client = IronMQ::Client.new(@config['iron_mq'])
|
17
19
|
@client.logger.level = Logger::DEBUG
|
18
20
|
@client.queue_name = 'ironmq-ruby-tests'
|
19
21
|
|
20
22
|
end
|
23
|
+
|
24
|
+
def load_config
|
25
|
+
# check for config
|
26
|
+
if defined? $abt_config
|
27
|
+
@config = $abt_config
|
28
|
+
return @config
|
29
|
+
end
|
30
|
+
cf = File.expand_path(File.join("~", "Dropbox", "configs", "iron_mq_ruby", "test", "config.yml"))
|
31
|
+
if File.exist?(cf)
|
32
|
+
@config = YAML::load_file(cf)
|
33
|
+
return @config
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
21
37
|
end
|
data/test/test_iron_mq.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_mq
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|
16
|
-
requirement: &
|
16
|
+
requirement: &12253800 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *12253800
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rest
|
27
|
-
requirement: &
|
27
|
+
requirement: &12253220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *12253220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rest-client
|
38
|
-
requirement: &
|
38
|
+
requirement: &12252420 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *12252420
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rest
|
49
|
-
requirement: &
|
49
|
+
requirement: &12251440 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *12251440
|
58
58
|
description: Ruby client for IronMQ
|
59
59
|
email: travis@iron.io
|
60
60
|
executables: []
|