Class: IronMQ::Subscriber

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

Instance Attribute Summary collapse

Attributes inherited from ResponseBase

#code, #raw

Instance Method Summary collapse

Methods inherited from ResponseBase

#[], #id, #msg

Constructor Details

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

Returns a new instance of Subscriber.



7
8
9
10
11
# File 'lib/iron_mq/subscribers.rb', line 7

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

Instance Attribute Details

#optionsObject

‘options` was kept for backward compatibility



5
6
7
# File 'lib/iron_mq/subscribers.rb', line 5

def options
  @options
end

Instance Method Details

#delete(options = {}) ⇒ Object Also known as: acknowledge

‘options` was kept for backward compatibility



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/iron_mq/subscribers.rb', line 26

def delete(options = {})
  @message.call_api_and_parse_response(:delete, path,
                                       {subscriber_name: name})
rescue Rest::HttpError => ex
  #if ex.code == 404
  #  Rest.logger.info("Delete got 404, safe to ignore.")
  #  # return ResponseBase as normal
  #  ResponseBase.new({"msg" => "Deleted"}, 404)
  #else
    raise ex
  #end
end

#headersObject



21
22
23
# File 'lib/iron_mq/subscribers.rb', line 21

def headers
  @raw['headers']
end

#nameObject



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

def name
  @raw['name']
end

#urlObject



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

def url
  @raw['url']
end