Class: Kward::Transport::Host::PluginChatTurn
- Inherits:
-
Object
- Object
- Kward::Transport::Host::PluginChatTurn
- Defined in:
- lib/kward/transport/host.rb
Overview
Handle for an asynchronously running plugin-chat turn.
Instance Attribute Summary collapse
-
#chat_id ⇒ Object
readonly
Returns the value of attribute chat_id.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Instance Method Summary collapse
- #cancel ⇒ Object
- #events(after: nil) ⇒ Object
-
#initialize(host, handle, actor) ⇒ PluginChatTurn
constructor
A new instance of PluginChatTurn.
- #status ⇒ Object
- #subscribe(after: nil, &block) ⇒ Object
Constructor Details
#initialize(host, handle, actor) ⇒ PluginChatTurn
Returns a new instance of PluginChatTurn.
254 255 256 257 258 259 |
# File 'lib/kward/transport/host.rb', line 254 def initialize(host, handle, actor) @host = host @actor = actor @id = handle.id.to_s.freeze @chat_id = handle.chat_id.to_s.freeze end |
Instance Attribute Details
#chat_id ⇒ Object (readonly)
Returns the value of attribute chat_id.
252 253 254 |
# File 'lib/kward/transport/host.rb', line 252 def chat_id @chat_id end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
252 253 254 |
# File 'lib/kward/transport/host.rb', line 252 def id @id end |
Instance Method Details
#cancel ⇒ Object
275 276 277 278 |
# File 'lib/kward/transport/host.rb', line 275 def cancel @host.(:cancel_plugin_chat_turn, actor: @actor, chat_id: @chat_id, turn_id: @id) @host.plugin_chat_gateway.cancel_transport_plugin_chat_turn(turn_id: @id) end |
#events(after: nil) ⇒ Object
267 268 269 |
# File 'lib/kward/transport/host.rb', line 267 def events(after: nil) @host.plugin_chat_gateway.transport_plugin_chat_turn_events(turn_id: @id, after: after) end |
#status ⇒ Object
271 272 273 |
# File 'lib/kward/transport/host.rb', line 271 def status @host.plugin_chat_gateway.transport_plugin_chat_turn_status(turn_id: @id) end |
#subscribe(after: nil, &block) ⇒ Object
261 262 263 264 265 |
# File 'lib/kward/transport/host.rb', line 261 def subscribe(after: nil, &block) raise ArgumentError, "plugin chat turn subscription requires a block" unless block @host.plugin_chat_gateway.subscribe_transport_plugin_chat_turn(turn_id: @id, after: after, &block) end |