Class: Eventboss::Queue
- Inherits:
-
Object
- Object
- Eventboss::Queue
- Includes:
- Comparable
- Defined in:
- lib/eventboss/queue.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
- .build(destination:, event_name:, env:, source_app: nil) ⇒ Object
- .build_name(destination:, event_name:, env:, source_app: nil) ⇒ Object
Instance Method Summary collapse
- #<=>(another_queue) ⇒ Object
- #arn ⇒ Object
- #eql?(another_queue) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(name) ⇒ Queue
constructor
A new instance of Queue.
- #to_s ⇒ Object
- #url ⇒ Object
Constructor Details
#initialize(name) ⇒ Queue
Returns a new instance of Queue.
30 31 32 33 |
# File 'lib/eventboss/queue.rb', line 30 def initialize(name) @client = Eventboss.configuration.sqs_client @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/eventboss/queue.rb', line 6 def name @name end |
Class Method Details
.build(destination:, event_name:, env:, source_app: nil) ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/eventboss/queue.rb', line 19 def build(destination:, event_name:, env:, source_app: nil) name = build_name( destination: destination, event_name: event_name, env: env, source_app: source_app ) Queue.new(name) end |
.build_name(destination:, event_name:, env:, source_app: nil) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/eventboss/queue.rb', line 9 def build_name(destination:, event_name:, env:, source_app: nil) [ destination, Eventboss.configuration.sns_sqs_name_infix, source_app, event_name, env ].compact.join('-') end |
Instance Method Details
#<=>(another_queue) ⇒ Object
48 49 50 |
# File 'lib/eventboss/queue.rb', line 48 def <=>(another_queue) name <=> another_queue&.name end |
#arn ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/eventboss/queue.rb', line 39 def arn [ 'arn:aws:sqs', Eventboss.configuration.eventboss_region, Eventboss.configuration.eventboss_account_id, name ].join(':') end |
#eql?(another_queue) ⇒ Boolean
52 53 54 |
# File 'lib/eventboss/queue.rb', line 52 def eql?(another_queue) name == another_queue&.name end |
#hash ⇒ Object
56 57 58 |
# File 'lib/eventboss/queue.rb', line 56 def hash name.hash end |
#to_s ⇒ Object
60 61 62 |
# File 'lib/eventboss/queue.rb', line 60 def to_s "<Eventboss::Queue: #{name}>" end |
#url ⇒ Object
35 36 37 |
# File 'lib/eventboss/queue.rb', line 35 def url @url ||= client.get_queue_url(queue_name: name).queue_url end |