Browse files

fix deletion of pq messages

  • Loading branch information...
1 parent 0db306a commit 1c53897e834cd26d6fcf4afd3ff54c8fa01c0dfc @manveru manveru committed Dec 11, 2012
Showing with 11 additions and 10 deletions.
  1. +1 −1 lib/iron_mq/messages.rb
  2. +10 −9 lib/iron_mq/subscribers.rb
View
2 lib/iron_mq/messages.rb
@@ -93,6 +93,7 @@ def release(message_id, options={})
end
class Message < ResponseBase
+ attr_reader :messages
def initialize(messages, res, options={})
super(res)
@@ -124,5 +125,4 @@ def subscribers(options={})
ret
end
end
-
end
View
19 lib/iron_mq/subscribers.rb
@@ -1,19 +1,15 @@
module IronMQ
-
class Subscribers
-
def self.path(options)
path = "#{Messages.path(options)}/subscribers"
if options[:subscriber_id]
path << "/#{options[:subscriber_id]}"
end
path
end
-
end
class Subscriber < ResponseBase
-
attr_accessor :options
def initialize(raw, message, options={})
@@ -22,12 +18,17 @@ def initialize(raw, message, options={})
@options = options
end
- def delete(subscriber_id, options={})
- options[:subscriber_id] = subscriber_id
- res = @client.parse_response(@message.messages.client.delete(Subscribers.path(options)))
+ def delete(options={})
+ client = @message.messages.client
+
+ options[:subscriber_id] ||= @raw["id"]
+ options[:msg_id] ||= @message.id
+ options[:project_id] ||= client.project_id
+ options[:queue_name] ||= client.queue_name
+ path = Subscribers.path(options)
+ raw = client.delete(path)
+ res = client.parse_response(raw)
return ResponseBase.new(res)
end
-
end
end
-

0 comments on commit 1c53897

Please sign in to comment.