Class: Twilio::REST::FlexApi::V1::AssessmentsContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/flex_api/v1/assessments.rb

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, assessment_id) ⇒ AssessmentsContext

Initialize the AssessmentsContext

Parameters:

  • version (Version)

    Version that contains the resource

  • assessment_id (String)

    The id of the assessment to be modified



200
201
202
203
204
205
206
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 200

def initialize(version, assessment_id)
  super(version)

  # Path Solution
  @solution = {assessment_id: assessment_id, }
  @uri = "/Insights/QM/Assessments/#{@solution[:assessment_id]}"
end

Instance Method Details

#inspectObject

Provide a detailed, user friendly representation



233
234
235
236
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 233

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.FlexApi.V1.AssessmentsContext #{context}>"
end

#to_sObject

Provide a user friendly representation



226
227
228
229
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 226

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.FlexApi.V1.AssessmentsContext #{context}>"
end

#update(offset: nil, answer_text: nil, answer_id: nil, token: :unset) ⇒ AssessmentsInstance

Update the AssessmentsInstance

Parameters:

  • offset (String) (defaults to: nil)

    The offset of the conversation

  • answer_text (String) (defaults to: nil)

    The answer text selected by user

  • answer_id (String) (defaults to: nil)

    The id of the answer selected by user

  • token (String) (defaults to: :unset)

    The Token HTTP request header

Returns:



215
216
217
218
219
220
221
222
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 215

def update(offset: nil, answer_text: nil, answer_id: nil, token: :unset)
  data = Twilio::Values.of({'Offset' => offset, 'AnswerText' => answer_text, 'AnswerId' => answer_id, })
  headers = Twilio::Values.of({'Token' => token, })

  payload = @version.update('POST', @uri, data: data, headers: headers)

  AssessmentsInstance.new(@version, payload, assessment_id: @solution[:assessment_id], )
end