Class: VoiceML::AssistantsV1AssistantMessagesScope

Inherits:
Object
  • Object
show all
Defined in:
lib/voiceml/resources/assistants_v1.rb

Overview

/v1/Assistants/id/Messages — send (create) a message; returns the model's reply.

Constant Summary collapse

CREATE_FIELDS =
%i[identity body session_id webhook mode].freeze

Instance Method Summary collapse

Constructor Details

#initialize(transport, assistant_id) ⇒ AssistantsV1AssistantMessagesScope

Returns a new instance of AssistantsV1AssistantMessagesScope.



250
251
252
253
# File 'lib/voiceml/resources/assistants_v1.rb', line 250

def initialize(transport, assistant_id)
  @transport    = transport
  @assistant_id = assistant_id
end

Instance Method Details

#create(identity:, body:, **kwargs) ⇒ Object



255
256
257
258
259
260
261
262
# File 'lib/voiceml/resources/assistants_v1.rb', line 255

def create(identity:, body:, **kwargs)
  kwargs[:identity] = identity
  kwargs[:body]     = body
  AssistantsV1SendMessageResponse.from_hash(
    @transport.request(:post, "/v1/Assistants/#{@assistant_id}/Messages",
                       json: build_json(CREATE_FIELDS, kwargs))
  )
end