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



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

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



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

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

#to_sObject

Provide a user friendly representation



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

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:



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

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:



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
378
379
# File 'lib/twilio-ruby/rest/flex_api/v1/assessments.rb', line 348

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