Class: Distribot::Connector
- Inherits:
-
Object
- Object
- Distribot::Connector
- Defined in:
- lib/distribot/connector.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#amqp_url ⇒ Object
Returns the value of attribute amqp_url.
-
#bunny ⇒ Object
Returns the value of attribute bunny.
-
#channel ⇒ Object
Returns the value of attribute channel.
Instance Method Summary collapse
-
#initialize(amqp_url = 'amqp://localhost:5672') ⇒ Connector
constructor
A new instance of Connector.
- #logger ⇒ Object
- #queues ⇒ Object
Constructor Details
#initialize(amqp_url = 'amqp://localhost:5672') ⇒ Connector
Returns a new instance of Connector.
13 14 15 16 |
# File 'lib/distribot/connector.rb', line 13 def initialize(amqp_url = 'amqp://localhost:5672') self.amqp_url = amqp_url setup end |
Instance Attribute Details
#amqp_url ⇒ Object
Returns the value of attribute amqp_url.
12 13 14 |
# File 'lib/distribot/connector.rb', line 12 def amqp_url @amqp_url end |
#bunny ⇒ Object
Returns the value of attribute bunny.
12 13 14 |
# File 'lib/distribot/connector.rb', line 12 def bunny @bunny end |
#channel ⇒ Object
Returns the value of attribute channel.
12 13 14 |
# File 'lib/distribot/connector.rb', line 12 def channel @channel end |
Instance Method Details
#logger ⇒ Object
26 27 28 |
# File 'lib/distribot/connector.rb', line 26 def logger Distribot.logger end |
#queues ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/distribot/connector.rb', line 18 def queues uri = URI.parse(amqp_url) uri.scheme = 'http' uri.port = '15672'.to_i uri.path = '/api/queues' uri.to_s.to_uri.get.deserialize.map { |x| x['name'] } end |