Skip to content
Kward Search API index

Class: Kward::Transport::Host::PluginChats

Inherits:
Object
  • Object
show all
Defined in:
lib/kward/transport/host.rb

Overview

Resolves an external conversation to a plugin-owned chat.

Instance Method Summary collapse

Constructor Details

#initialize(host) ⇒ PluginChats

Returns a new instance of PluginChats.



167
168
169
# File 'lib/kward/transport/host.rb', line 167

def initialize(host)
  @host = host
end

Instance Method Details

#resolve(type_id:, conversation:, actor:, scope_key: nil, descriptor: {}) ⇒ Object



171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/kward/transport/host.rb', line 171

def resolve(type_id:, conversation:, actor:, scope_key: nil, descriptor: {})
  scope_key ||= conversation.external_id
  @host.authorize!(:resolve_plugin_chat, type_id: type_id.to_s, conversation: conversation, actor: actor, scope_key: scope_key)
  result = @host.plugin_chat_gateway.resolve_transport_chat(
    transport_id: @host.transport_id,
    type_id: type_id,
    conversation: conversation,
    actor: actor,
    scope_key: scope_key,
    descriptor: descriptor,
    workspace_root: workspace_root
  )
  PluginChat.new(@host, normalize_handle(result), actor)
end