Class: Librevox::Listener::Inbound
- Defined in:
- lib/librevox/listener/inbound.rb
Class Attribute Summary collapse
-
.subscribe_events ⇒ Object
readonly
Returns the value of attribute subscribe_events.
-
.subscribe_filters ⇒ Object
readonly
Returns the value of attribute subscribe_filters.
Attributes inherited from Base
Class Method Summary collapse
- .events(events) ⇒ Object
- .filters(filters) ⇒ Object
- .run(barrier, host: "localhost", port: 8021, **options) ⇒ Object
Instance Method Summary collapse
- #connection_completed ⇒ Object
-
#initialize(connection, args = {}) ⇒ Inbound
constructor
A new instance of Inbound.
- #run_session ⇒ Object
Methods inherited from Base
#api, #disconnect, event, #handle_response, hooks, #on_event, #receive_message, #send_message
Constructor Details
#initialize(connection, args = {}) ⇒ Inbound
Returns a new instance of Inbound.
27 28 29 30 |
# File 'lib/librevox/listener/inbound.rb', line 27 def initialize(connection, args = {}) super(connection) @auth = args[:auth] || "ClueCon" end |
Class Attribute Details
.subscribe_events ⇒ Object (readonly)
Returns the value of attribute subscribe_events.
9 10 11 |
# File 'lib/librevox/listener/inbound.rb', line 9 def subscribe_events @subscribe_events end |
.subscribe_filters ⇒ Object (readonly)
Returns the value of attribute subscribe_filters.
10 11 12 |
# File 'lib/librevox/listener/inbound.rb', line 10 def subscribe_filters @subscribe_filters end |
Class Method Details
.events(events) ⇒ Object
12 13 14 |
# File 'lib/librevox/listener/inbound.rb', line 12 def events(events) @subscribe_events = events end |
.filters(filters) ⇒ Object
16 17 18 |
# File 'lib/librevox/listener/inbound.rb', line 16 def filters(filters) @subscribe_filters = filters end |
Instance Method Details
#connection_completed ⇒ Object
50 51 |
# File 'lib/librevox/listener/inbound.rb', line 50 def connection_completed end |
#run_session ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/librevox/listener/inbound.rb', line 32 def run_session Librevox.logger.info "Connected." "auth #{@auth}" events = self.class.subscribe_events || ['ALL'] "event plain #{events.join(' ')}" filters = self.class.subscribe_filters || {} filters.each do |header, values| [*values].each do |value| "filter #{header} #{value}" end end connection_completed end |