ironmq 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -1 +1,35 @@
1
- Coming soon.
1
+ IronMQ Ruby Client
2
+ -------------
3
+
4
+ Getting Started
5
+ ==============
6
+
7
+ Create an IronMQ client object:
8
+
9
+ @client = IronMQ::Client.new('token'=>'MYTOKEN', 'project_id'=>'MYPROJECTID')
10
+
11
+ You can get your `token` and `project_id` at http://www.iron.io .
12
+
13
+
14
+ The Basics
15
+ =========
16
+
17
+ **Push** a message on the queue:
18
+
19
+ res = @client.messages.post("hello world!")
20
+ p res
21
+
22
+ **Pop** a message off the queue:
23
+
24
+ res = @client.messages.get()
25
+ p res
26
+
27
+ When you pop/get a message from the queue, it will NOT be deleted. It will eventually go back onto the queue after
28
+ a timeout if you don't delete it (default timeout is 10 minutes).
29
+
30
+ **Delete** a message from the queue:
31
+
32
+ res = @client.messages.delete(res["id"])
33
+ p res
34
+
35
+ Delete a message from the queue when you're done with it.
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
- ---
1
+ ---
2
2
  :major: 1
3
3
  :minor: 2
4
- :patch: 0
5
- :build:
4
+ :patch: 1
5
+ :build:
data/ironmq.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = "ironmq"
8
- s.version = "1.2.0"
7
+ s.name = %q{ironmq}
8
+ s.version = "1.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Travis Reeder"]
12
- s.date = "2011-10-06"
13
- s.description = "Ruby client for IronMQ"
14
- s.email = "travis@iron.io"
11
+ s.authors = [%q{Travis Reeder}]
12
+ s.date = %q{2011-10-12}
13
+ s.description = %q{Ruby client for IronMQ}
14
+ s.email = %q{travis@iron.io}
15
15
  s.extra_rdoc_files = [
16
16
  "README.markdown"
17
17
  ]
@@ -24,11 +24,11 @@ Gem::Specification.new do |s|
24
24
  "lib/ironmq/client.rb",
25
25
  "test/ironmq_tests.rb"
26
26
  ]
27
- s.homepage = "http://www.iron.io"
28
- s.require_paths = ["lib"]
27
+ s.homepage = %q{http://www.iron.io}
28
+ s.require_paths = [%q{lib}]
29
29
  s.required_ruby_version = Gem::Requirement.new(">= 1.9")
30
- s.rubygems_version = "1.8.11"
31
- s.summary = "Ruby client for IronMQ"
30
+ s.rubygems_version = %q{1.8.8}
31
+ s.summary = %q{Ruby client for IronMQ}
32
32
 
33
33
  if s.respond_to? :specification_version then
34
34
  s.specification_version = 3
data/lib/ironmq/client.rb CHANGED
@@ -6,7 +6,7 @@ module IronMQ
6
6
 
7
7
  class Client
8
8
 
9
- attr_accessor :token, :project_id, :queue_name
9
+ attr_accessor :token, :project_id, :queue_name, :base_url
10
10
 
11
11
  def initialize(options={})
12
12
  @token = options[:token] || options['token']
@@ -63,26 +63,27 @@ module IronMQ
63
63
  @client = client
64
64
  end
65
65
 
66
+ def path(options={})
67
+ path = "/projects/#{@client.project_id}/queues/#{options[:queue_name] || @client.queue_name}/messages"
68
+ end
66
69
 
67
70
  # options:
68
71
  # :queue_name => can specify an alternative queue name
69
72
  def get(options={})
70
- path = "/projects/#{@client.project_id}/queues/#{options[:queue_name] || @client.queue_name}/messages"
71
- res = @client.get(path)
73
+ res = @client.get(path(options))
72
74
  res
73
75
  end
74
76
 
75
77
  # options:
76
78
  # :queue_name => can specify an alternative queue name
77
79
  def post(payload, options={})
78
- path = "/projects/#{@client.project_id}/queues/#{options[:queue_name] || @client.queue_name}/messages"
79
- res = @client.post(path, :payload=>payload)
80
+ res = @client.post(path(options), :payload=>payload)
80
81
  res
81
82
  end
82
83
 
83
84
  def delete(message_id, options={})
84
- path = "/projects/#{@client.project_id}/queues/#{options[:queue_name] || @client.queue_name}/messages/#{message_id}"
85
- res = @client.delete(path)
85
+ path2 = "#{self.path(options)}/#{message_id}"
86
+ res = @client.delete(path2)
86
87
  res
87
88
  end
88
89
 
data/test/ironmq_tests.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # Put config.yml file in ~/Dropbox/configs/ironmq_gem/test/config.yml
2
+
1
3
  gem 'test-unit'
2
4
  require 'test/unit'
3
5
  require 'yaml'
@@ -11,7 +13,7 @@ end
11
13
  class IronMQTests < Test::Unit::TestCase
12
14
  def setup
13
15
  puts 'setup'
14
- @config = YAML::load_file(File.join(File.dirname(__FILE__), "config.yml"))
16
+ @config = YAML::load_file(File.expand_path(File.join("~", "Dropbox", "configs", "ironmq_gem", "test", "config.yml")))
15
17
  @client = IronMQ::Client.new(@config['ironmq'])
16
18
  @client.queue_name = 'ironmq-gem-tests'
17
19
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: ironmq
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.2.0
5
+ version: 1.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Travis Reeder
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-10-06 00:00:00 Z
13
+ date: 2011-10-12 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client
@@ -62,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  requirements: []
63
63
 
64
64
  rubyforge_project:
65
- rubygems_version: 1.8.11
65
+ rubygems_version: 1.8.8
66
66
  signing_key:
67
67
  specification_version: 3
68
68
  summary: Ruby client for IronMQ