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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, assessment_sid) ⇒ AssessmentsContext

Initialize the AssessmentsContext

Parameters:

  • version (Version)

    Version that contains the resource

  • assessment_sid (String)

    The SID of the assessment to be modified



289
290
291
292
293
294
295
296
297
298
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 289

def initialize(version, assessment_sid)
    super(version)
    

    # Path Solution
    @solution = { assessment_sid: assessment_sid,  }
    @uri = "/Insights/QualityManagement/Assessments/#{@solution[:assessment_sid]}"

    
end

Instance Method Details

#inspectObject

Provide a detailed, user friendly representation



383
384
385
386
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 383

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

#to_sObject

Provide a user friendly representation



376
377
378
379
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 376

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, authorization: :unset) ⇒ AssessmentsInstance

Update the AssessmentsInstance

Parameters:

  • offset (Float) (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

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

    The Authorization HTTP request header

Returns:



306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 306

def update(
    offset: nil, 
    answer_text: nil, 
    answer_id: nil, 
    authorization: :unset
)

    data = Twilio::Values.of({
        'Offset' => offset,
        'AnswerText' => answer_text,
        'AnswerId' => answer_id,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => authorization, })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    AssessmentsInstance.new(
        @version,
        payload,
        assessment_sid: @solution[:assessment_sid],
    )
end

#update_with_metadata(offset: nil, answer_text: nil, answer_id: nil, authorization: :unset) ⇒ AssessmentsInstance

Update the AssessmentsInstanceMetadata

Parameters:

  • offset (Float) (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

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

    The Authorization HTTP request header

Returns:



340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 340

def (
  offset: nil, 
  answer_text: nil, 
  answer_id: nil, 
  authorization: :unset
)

    data = Twilio::Values.of({
        'Offset' => offset,
        'AnswerText' => answer_text,
        'AnswerId' => answer_id,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => authorization, })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    assessments_instance = AssessmentsInstance.new(
        @version,
        response.body,
        assessment_sid: @solution[:assessment_sid],
    )
    AssessmentsInstanceMetadata.new(
        @version,
        assessments_instance,
        response.headers,
        response.status_code
    )
end