Class: Circuitry::Queue

Inherits:
Object
  • Object
show all
Includes:
Services::SQS
Defined in:
lib/circuitry/queue.rb

Defined Under Namespace

Classes: Finder

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Services::SQS

#sqs

Constructor Details

#initialize(url) ⇒ Queue

Returns a new instance of Queue.



25
26
27
# File 'lib/circuitry/queue.rb', line 25

def initialize(url)
  self.url = url
end

Instance Attribute Details

#urlObject

Returns the value of attribute url.



23
24
25
# File 'lib/circuitry/queue.rb', line 23

def url
  @url
end

Class Method Details

.find(name) ⇒ Object



29
30
31
# File 'lib/circuitry/queue.rb', line 29

def self.find(name)
  new(Finder.new(name).find.queue_url)
end

Instance Method Details

#arnObject



37
38
39
# File 'lib/circuitry/queue.rb', line 37

def arn
  @arn ||= attribute('QueueArn')
end

#attribute(name) ⇒ Object



41
42
43
# File 'lib/circuitry/queue.rb', line 41

def attribute(name)
  sqs.get_queue_attributes(queue_url: url, attribute_names: [name]).attributes[name]
end

#nameObject



33
34
35
# File 'lib/circuitry/queue.rb', line 33

def name
  url.split('/').last
end