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



112
113
114
115
116
117
118
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 112

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



145
146
147
148
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 145

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

#to_sObject

Provide a user friendly representation



138
139
140
141
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 138

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:



127
128
129
130
131
132
133
134
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 127

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