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



295
296
297
298
299
300
301
302
303
304
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 295

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

#inspect ⇒ Object

Provide a detailed, user friendly representation



389
390
391
392
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 389

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

#to_s ⇒ Object

Provide a user friendly representation



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

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:



312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 312

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:



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
372
373
374
375
376
377
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 346

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