Class: Kward::Transport::Host::Turn
- Inherits:
-
Object
- Object
- Kward::Transport::Host::Turn
- Defined in:
- lib/kward/transport/host.rb
Overview
Handle for an asynchronously running Kward turn.
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
Instance Method Summary collapse
- #cancel ⇒ Object
- #events(after: nil) ⇒ Object
-
#initialize(host, handle, actor) ⇒ Turn
constructor
A new instance of Turn.
- #status ⇒ Object
- #subscribe(after: nil, &block) ⇒ Object
Constructor Details
#initialize(host, handle, actor) ⇒ Turn
Returns a new instance of Turn.
298 299 300 301 302 303 |
# File 'lib/kward/transport/host.rb', line 298 def initialize(host, handle, actor) @host = host @actor = actor @id = handle.id.to_s.freeze @session_id = handle.session_id.to_s.freeze end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
296 297 298 |
# File 'lib/kward/transport/host.rb', line 296 def id @id end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
296 297 298 |
# File 'lib/kward/transport/host.rb', line 296 def session_id @session_id end |
Instance Method Details
#cancel ⇒ Object
319 320 321 322 |
# File 'lib/kward/transport/host.rb', line 319 def cancel @host.(:cancel_turn, actor: @actor, session_id: @session_id, turn_id: @id) @host.gateway.cancel_transport_turn(turn_id: @id) end |
#events(after: nil) ⇒ Object
311 312 313 |
# File 'lib/kward/transport/host.rb', line 311 def events(after: nil) @host.gateway.transport_turn_events(turn_id: @id, after: after) end |
#status ⇒ Object
315 316 317 |
# File 'lib/kward/transport/host.rb', line 315 def status @host.gateway.transport_turn_status(turn_id: @id) end |
#subscribe(after: nil, &block) ⇒ Object
305 306 307 308 309 |
# File 'lib/kward/transport/host.rb', line 305 def subscribe(after: nil, &block) raise ArgumentError, "turn subscription requires a block" unless block @host.gateway.subscribe_transport_turn(turn_id: @id, after: after, &block) end |