Class: IronMQ::Subscriber

Inherits:
ResponseBase show all
Defined in:
lib/iron_mq/subscribers.rb

Instance Attribute Summary collapse

Attributes inherited from ResponseBase

#raw

Instance Method Summary collapse

Methods inherited from ResponseBase

#[], #id, #msg

Constructor Details

#initialize(raw, message, options = {}) ⇒ Subscriber

Returns a new instance of Subscriber.



15
16
17
18
19
# File 'lib/iron_mq/subscribers.rb', line 15

def initialize(raw, message, options={})
  super(raw)
  @message = message
  @options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



13
14
15
# File 'lib/iron_mq/subscribers.rb', line 13

def options
  @options
end

Instance Method Details

#delete(options = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/iron_mq/subscribers.rb', line 21

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