Permalink
Browse files

Added getting queue information

  • Loading branch information...
1 parent fa9ccc0 commit 554d2667d978a0a795485b43e642249442e10875 @treeder treeder committed Nov 24, 2011
Showing with 53 additions and 0 deletions.
  1. +53 −0 lib/ironmq/queues.rb
View
53 lib/ironmq/queues.rb
@@ -0,0 +1,53 @@
+module IronMQ
+ class Queues
+
+ attr_accessor :client
+
+ def initialize(client)
+ @client = client
+ end
+
+ def path(options={})
+ path = "/projects/#{@client.project_id}/queues"
+ end
+
+ # options:
+ # :name => can specify an alternative queue name
+ def get(options={})
+ res, status = @client.get("#{path(options)}/#{options[:name]}")
+ return Queue.new(self, res)
+ end
+
+
+ end
+
+ class Queue
+
+ def initialize(queues, res)
+ @queues = queues
+ @data = res
+ end
+
+ def raw
+ @data
+ end
+
+ def [](key)
+ raw[key]
+ end
+
+ def id
+ raw["id"]
+ end
+
+ def size
+ raw["size"]
+ end
+
+ # def delete
+ # @messages.delete(self.id)
+ # end
+ end
+
+end
+

0 comments on commit 554d266

Please sign in to comment.