Class: VoiceML::AssistantsV1AssistantFeedbacksScope

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

Overview

/v1/Assistants/id/Feedbacks — list + create.

Constant Summary collapse

CREATE_FIELDS =
%i[session_id message_id score text].freeze

Instance Method Summary collapse

Constructor Details

#initialize(transport, assistant_id) ⇒ AssistantsV1AssistantFeedbacksScope

Returns a new instance of AssistantsV1AssistantFeedbacksScope.



211
212
213
214
# File 'lib/voiceml/resources/assistants_v1.rb', line 211

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

Instance Method Details

#create(session_id:, **kwargs) ⇒ Object



224
225
226
227
228
229
230
# File 'lib/voiceml/resources/assistants_v1.rb', line 224

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

#list(page_size: nil) ⇒ Object



216
217
218
219
220
221
222
# File 'lib/voiceml/resources/assistants_v1.rb', line 216

def list(page_size: nil)
  params = {}
  params['PageSize'] = page_size unless page_size.nil?
  AssistantsV1FeedbackList.new(
    @transport.request(:get, "/v1/Assistants/#{@assistant_id}/Feedbacks", params: params)
  )
end