iron_mq 1.7.3 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ .DS_Store
2
+ pkg/
3
+ doc
4
+ .idea
5
+ log
6
+ test/config.yml
7
+ *.sublime*
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source "https://rubygems.org"
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,37 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ iron_mq (1.8.0)
5
+ iron_core (>= 0.1.4)
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ beanstalk-client (1.1.1)
11
+ ffi (1.0.11)
12
+ iron_core (0.1.4)
13
+ bundler (> 1.0.0)
14
+ rest
15
+ rest-client
16
+ mime-types (1.19)
17
+ rake (0.9.2.2)
18
+ rest (1.0.0)
19
+ rest-client (>= 0.3.0)
20
+ rest-client (1.6.7)
21
+ mime-types (>= 1.16)
22
+ test-unit (2.5.0)
23
+ typhoeus (0.4.2)
24
+ ffi (~> 1.0)
25
+ mime-types (~> 1.18)
26
+ uber_config (0.0.3)
27
+
28
+ PLATFORMS
29
+ ruby
30
+
31
+ DEPENDENCIES
32
+ beanstalk-client
33
+ iron_mq!
34
+ rake
35
+ test-unit
36
+ typhoeus
37
+ uber_config
data/Rakefile CHANGED
@@ -1,24 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rake'
3
3
 
4
- begin
5
- require 'jeweler2'
6
- Jeweler::Tasks.new do |gem|
7
- gem.name = "iron_mq"
8
- gem.summary = "Ruby client for IronMQ"
9
- gem.description = "Ruby client for IronMQ"
10
- gem.email = "travis@iron.io"
11
- gem.homepage = "http://www.iron.io"
12
- gem.authors = ["Travis Reeder"]
13
- gem.add_dependency 'iron_core'
14
- #gem.add_dependency 'typhoeus'
15
- gem.required_ruby_version = '>= 1.9'
16
- end
17
- Jeweler::GemcutterTasks.new
18
- rescue LoadError
19
- puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler2"
20
- end
21
-
22
4
  require 'rake/testtask'
23
5
  Rake::TestTask.new(:test) do |test|
24
6
  test.libs << 'lib' << 'test'
data/iron_mq.gemspec CHANGED
@@ -1,58 +1,29 @@
1
- # Generated by jeweler
2
- # DO NOT EDIT THIS FILE DIRECTLY
3
- # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
- # -*- encoding: utf-8 -*-
1
+ require File.expand_path('../lib/iron_mq/version', __FILE__)
5
2
 
6
- Gem::Specification.new do |s|
7
- s.name = "iron_mq"
8
- s.version = "1.7.3"
3
+ Gem::Specification.new do |gem|
4
+ gem.authors = ["Travis Reeder"]
5
+ gem.email = ["treeder@gmail.com"]
6
+ gem.description = "Ruby client for IronMQ by www.iron.io"
7
+ gem.summary = "Ruby client for IronMQ by www.iron.io"
8
+ gem.homepage = "https://github.com/iron-io/iron_mq_ruby"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Travis Reeder"]
12
- s.date = "2012-06-10"
13
- s.description = "Ruby client for IronMQ"
14
- s.email = "travis@iron.io"
15
- s.extra_rdoc_files = [
16
- "README.markdown"
17
- ]
18
- s.files = [
19
- "README.markdown",
20
- "Rakefile",
21
- "VERSION.yml",
22
- "iron_mq.gemspec",
23
- "lib/iron_mq.rb",
24
- "lib/iron_mq/client.rb",
25
- "lib/iron_mq/messages.rb",
26
- "lib/iron_mq/queues.rb",
27
- "test/Gemfile",
28
- "test/Gemfile.lock",
29
- "test/long_run.rb",
30
- "test/long_run_worker.rb",
31
- "test/quick_run.rb",
32
- "test/schedule_abt.rb",
33
- "test/test_base.rb",
34
- "test/test_beanstalkd.rb",
35
- "test/test_iron_mq.rb"
36
- ]
37
- s.homepage = "http://www.iron.io"
38
- s.require_paths = ["lib"]
39
- s.required_ruby_version = Gem::Requirement.new(">= 1.9")
40
- s.rubygems_version = "1.8.24"
41
- s.summary = "Ruby client for IronMQ"
10
+ gem.files = `git ls-files`.split($\)
11
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
+ gem.name = "iron_mq"
14
+ gem.require_paths = ["lib"]
15
+ gem.version = IronMQ::VERSION
16
+
17
+ gem.required_rubygems_version = ">= 1.3.6"
18
+ gem.required_ruby_version = Gem::Requirement.new(">= 1.9")
19
+ gem.add_runtime_dependency "iron_core", ">= 0.1.4"
20
+
21
+ gem.add_development_dependency "test-unit"
22
+ gem.add_development_dependency "rake"
23
+ gem.add_development_dependency "beanstalk-client"
24
+ gem.add_development_dependency "uber_config"
25
+ gem.add_development_dependency "typhoeus"
42
26
 
43
- if s.respond_to? :specification_version then
44
- s.specification_version = 3
45
27
 
46
- if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
- s.add_runtime_dependency(%q<iron_core>, [">= 0"])
48
- s.add_runtime_dependency(%q<iron_core>, [">= 0"])
49
- else
50
- s.add_dependency(%q<iron_core>, [">= 0"])
51
- s.add_dependency(%q<iron_core>, [">= 0"])
52
- end
53
- else
54
- s.add_dependency(%q<iron_core>, [">= 0"])
55
- s.add_dependency(%q<iron_core>, [">= 0"])
56
- end
57
28
  end
58
29
 
@@ -3,17 +3,6 @@ require 'yaml'
3
3
  require 'iron_core'
4
4
 
5
5
  module IronMQ
6
- @@version = nil
7
-
8
- def self.version
9
- if @@version.nil?
10
- v = YAML.load(File.read(File.dirname(__FILE__) + '/../../VERSION.yml'))
11
- $stderr.puts v.inspect
12
- @@version = [v[:major].to_s, v[:minor].to_s, v[:patch].to_s].join('.')
13
- end
14
-
15
- @@version
16
- end
17
6
 
18
7
  class Client < IronCore::Client
19
8
  AWS_US_EAST_HOST = 'mq-aws-us-east-1.iron.io'
@@ -23,7 +12,10 @@ module IronMQ
23
12
  def initialize(options={})
24
13
  super('mq', options, [:queue_name])
25
14
 
26
- load_from_hash(:scheme => 'https', :host => IronMQ::Client::AWS_US_EAST_HOST, :port => 443, :api_version => 1, :user_agent => 'iron_mq_ruby-' + IronMQ.version + ' (iron_core_ruby-' + IronCore.version + ')', :queue_name => 'default')
15
+ load_from_hash('defaults', {:scheme => 'https', :host => IronMQ::Client::AWS_US_EAST_HOST, :port => 443,
16
+ :api_version => 1,
17
+ :user_agent => 'iron_mq_ruby-' + IronMQ::VERSION + ' (iron_core_ruby-' + IronCore.version + ')',
18
+ :queue_name => 'default'})
27
19
 
28
20
  if (not @token) || (not @project_id)
29
21
  IronCore::Logger.error 'IronMQ', 'Both token and project_id must be specified'
@@ -9,6 +9,10 @@ module IronMQ
9
9
 
10
10
  def path(options={})
11
11
  path = "projects/#{@client.project_id}/queues"
12
+ if options[:name]
13
+ path << "/#{options[:name]}"
14
+ end
15
+ path
12
16
  end
13
17
 
14
18
  def list(options={})
@@ -27,10 +31,23 @@ module IronMQ
27
31
  # options:
28
32
  # :name => can specify an alternative queue name
29
33
  def get(options={})
30
- res = @client.parse_response(@client.get("#{path(options)}/#{options[:name]}"))
34
+ options[:name] ||= @client.queue_name
35
+ res = @client.parse_response(@client.get("#{path(options)}"))
31
36
  return Queue.new(self, res)
32
37
  end
33
38
 
39
+ # Update a queue
40
+ # options:
41
+ # :name => if not specified, will use global queue name
42
+ # :subscriptions => url's to subscribe to
43
+ def post(options={})
44
+ options[:name] ||= @client.queue_name
45
+ res = @client.parse_response(@client.post(path(options), options))
46
+ res
47
+ p res
48
+
49
+ end
50
+
34
51
 
35
52
  end
36
53
 
@@ -0,0 +1,3 @@
1
+ module IronMQ
2
+ VERSION = "1.8.0"
3
+ end
data/lib/iron_mq.rb CHANGED
@@ -1,3 +1,4 @@
1
1
  require_relative 'iron_mq/queues'
2
2
  require_relative 'iron_mq/messages'
3
3
  require_relative 'iron_mq/client'
4
+ require_relative 'iron_mq/version'
data/test/Gemfile.lock CHANGED
@@ -23,13 +23,13 @@ GEM
23
23
  faraday (0.8.1)
24
24
  multipart-post (~> 1.1)
25
25
  http_parser.rb (0.5.3)
26
- iron_core (0.1.2)
26
+ iron_core (0.1.3)
27
27
  bundler (> 1.0.0)
28
28
  rest
29
29
  rest-client
30
30
  mime-types (1.18)
31
31
  multipart-post (1.1.5)
32
- rest (0.2.0)
32
+ rest (0.3.0)
33
33
  rest-client
34
34
  rest-client
35
35
  rest-client (1.6.7)
data/test/quick_run.rb CHANGED
@@ -6,38 +6,41 @@ class QuickRun < TestBase
6
6
  def setup
7
7
  super
8
8
  @client.queue_name = 'ironmq-gem-quick'
9
+ clear_queue
9
10
  end
10
11
 
11
12
  def test_basics
13
+
12
14
  res = @client.messages.post("hello world!")
15
+ p res
13
16
  assert res.id
14
17
  post_id = res.id
15
18
  assert res.msg
16
- p res
17
19
 
18
20
  res = @client.messages.get()
21
+ p res
22
+ puts "post_id=" + post_id.inspect
19
23
  assert res.id
20
- assert res.id == post_id
24
+ assert_equal res.id, post_id
21
25
  assert res.body
22
- p res
23
26
 
24
27
  res = @client.messages.delete(res["id"])
25
- assert res.msg
26
28
  p res
29
+ assert res.msg
27
30
 
28
31
  res = @client.messages.get()
29
32
  p res
30
33
  assert res.nil?
31
34
 
32
35
  res = @client.messages.post("hello world!", :queue_name=>'test2')
36
+ p res
33
37
  assert res.id
34
38
  assert res.msg
35
- p res
36
39
 
37
40
  res = @client.messages.get(:queue_name=>'test2')
41
+ p res
38
42
  assert res.id
39
43
  assert res.body
40
- p res
41
44
 
42
45
  res = res.delete
43
46
  p res
data/test/test_iron_mq.rb CHANGED
@@ -17,6 +17,18 @@ class IronMQTests < TestBase
17
17
  clear_queue()
18
18
 
19
19
  end
20
+
21
+ def test_performance_post_100_messages
22
+ @client.queue_name = 'test_basics'
23
+ 100.times do
24
+ @client.messages.post("hello world!")
25
+ end
26
+ end
27
+
28
+ def test_performance_post_message
29
+ @client.queue_name = 'test_basics'
30
+ @client.messages.post("hello world!")
31
+ end
20
32
 
21
33
  def test_basics
22
34
  @client.queue_name = 'test_basics'
@@ -235,8 +247,6 @@ class IronMQTests < TestBase
235
247
  p msg
236
248
  assert msg
237
249
 
238
-
239
-
240
250
  end
241
251
 
242
252
  end
@@ -0,0 +1,32 @@
1
+ # Put config.yml file in ~/Dropbox/configs/ironmq_gem/test/config.yml
2
+ require_relative 'test_base'
3
+
4
+ class TestPushQueues < TestBase
5
+
6
+ def setup
7
+ super
8
+ @client.queue_name = 'ironmq-gem-quick'
9
+ end
10
+
11
+ def test_message_subscriptions
12
+ res = @client.messages.post("hello world!", :subscriptions=>["http://requestb.in/oui4adou"])
13
+ assert res.id
14
+ post_id = res.id
15
+ assert res.msg
16
+ p res
17
+ end
18
+
19
+ def test_queue_subscriptions
20
+ qname = "subscription-queue"
21
+ res = @client.queues.post(:queue_name=>qname, :subscriptions=>["http://requestb.in/1lhkwk31", "http://requestb.in/1icckwe1"])
22
+ q = @client.queues.get(:queue_name=>qname)
23
+ p q
24
+ p q["subscriptions"]
25
+
26
+ @client.messages.post("hello sub queue", :queue_name=>qname)
27
+
28
+
29
+ end
30
+
31
+ end
32
+
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.7.3
4
+ version: 1.8.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-10 00:00:00.000000000 Z
12
+ date: 2012-06-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: iron_core
@@ -18,9 +18,25 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 0.1.4
22
22
  type: :runtime
23
23
  prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: 0.1.4
30
+ - !ruby/object:Gem::Dependency
31
+ name: test-unit
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
24
40
  version_requirements: !ruby/object:Gem::Requirement
25
41
  none: false
26
42
  requirements:
@@ -28,14 +44,30 @@ dependencies:
28
44
  - !ruby/object:Gem::Version
29
45
  version: '0'
30
46
  - !ruby/object:Gem::Dependency
31
- name: iron_core
47
+ name: rake
32
48
  requirement: !ruby/object:Gem::Requirement
33
49
  none: false
34
50
  requirements:
35
51
  - - ! '>='
36
52
  - !ruby/object:Gem::Version
37
53
  version: '0'
38
- type: :runtime
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: beanstalk-client
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
39
71
  prerelease: false
40
72
  version_requirements: !ruby/object:Gem::Requirement
41
73
  none: false
@@ -43,21 +75,56 @@ dependencies:
43
75
  - - ! '>='
44
76
  - !ruby/object:Gem::Version
45
77
  version: '0'
46
- description: Ruby client for IronMQ
47
- email: travis@iron.io
78
+ - !ruby/object:Gem::Dependency
79
+ name: uber_config
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: typhoeus
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Ruby client for IronMQ by www.iron.io
111
+ email:
112
+ - treeder@gmail.com
48
113
  executables: []
49
114
  extensions: []
50
- extra_rdoc_files:
51
- - README.markdown
115
+ extra_rdoc_files: []
52
116
  files:
53
- - README.markdown
117
+ - .gitignore
118
+ - Gemfile
119
+ - Gemfile.lock
120
+ - README.md
54
121
  - Rakefile
55
- - VERSION.yml
56
122
  - iron_mq.gemspec
57
123
  - lib/iron_mq.rb
58
124
  - lib/iron_mq/client.rb
59
125
  - lib/iron_mq/messages.rb
60
126
  - lib/iron_mq/queues.rb
127
+ - lib/iron_mq/version.rb
61
128
  - test/Gemfile
62
129
  - test/Gemfile.lock
63
130
  - test/long_run.rb
@@ -67,7 +134,8 @@ files:
67
134
  - test/test_base.rb
68
135
  - test/test_beanstalkd.rb
69
136
  - test/test_iron_mq.rb
70
- homepage: http://www.iron.io
137
+ - test/test_push_queues.rb
138
+ homepage: https://github.com/iron-io/iron_mq_ruby
71
139
  licenses: []
72
140
  post_install_message:
73
141
  rdoc_options: []
@@ -84,11 +152,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
152
  requirements:
85
153
  - - ! '>='
86
154
  - !ruby/object:Gem::Version
87
- version: '0'
155
+ version: 1.3.6
88
156
  requirements: []
89
157
  rubyforge_project:
90
158
  rubygems_version: 1.8.24
91
159
  signing_key:
92
160
  specification_version: 3
93
- summary: Ruby client for IronMQ
94
- test_files: []
161
+ summary: Ruby client for IronMQ by www.iron.io
162
+ test_files:
163
+ - test/Gemfile
164
+ - test/Gemfile.lock
165
+ - test/long_run.rb
166
+ - test/long_run_worker.rb
167
+ - test/quick_run.rb
168
+ - test/schedule_abt.rb
169
+ - test/test_base.rb
170
+ - test/test_beanstalkd.rb
171
+ - test/test_iron_mq.rb
172
+ - test/test_push_queues.rb
data/VERSION.yml DELETED
@@ -1,5 +0,0 @@
1
- ---
2
- :major: 1
3
- :minor: 7
4
- :patch: 3
5
- :build:
File without changes