Class: Twilio::REST::FlexApi::V1::InsightsQuestionnairesQuestionContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, question_sid) ⇒ InsightsQuestionnairesQuestionContext

Initialize the InsightsQuestionnairesQuestionContext

Parameters:

  • version (Version) —

    Version that contains the resource

  • question_sid (String) —

    The SID of the question



267
268
269
270
271
272
273
274
275
276
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 267

def initialize(version, question_sid)
    super(version)
    

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

    
end

Instance Method Details

#delete(authorization: :unset) ⇒ Boolean

Delete the InsightsQuestionnairesQuestionInstance

Parameters:

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

    The Authorization HTTP request header

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



281
282
283
284
285
286
287
288
289
290
291
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 281

def delete(
  authorization: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => authorization, })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadata(authorization: :unset) ⇒ Boolean

Delete the InsightsQuestionnairesQuestionInstanceMetadata

Parameters:

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

    The Authorization HTTP request header

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 297

def (
  authorization: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => authorization, })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      insightsQuestionnairesQuestion_instance = InsightsQuestionnairesQuestionInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      .new(@version, insightsQuestionnairesQuestion_instance, response.headers, response.status_code)
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



411
412
413
414
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 411

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

#to_s ⇒ Object

Provide a user friendly representation



404
405
406
407
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 404

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

#update(allow_na: nil, category_sid: :unset, question: :unset, description: :unset, answer_set_id: :unset, authorization: :unset) ⇒ InsightsQuestionnairesQuestionInstance

Update the InsightsQuestionnairesQuestionInstance

Parameters:

  • allow_na (Boolean) (defaults to: nil) —

    The flag to enable for disable NA for answer.

  • category_sid (String) (defaults to: :unset) —

    The SID of the category

  • question (String) (defaults to: :unset) —

    The question.

  • description (String) (defaults to: :unset) —

    The description for the question.

  • answer_set_id (String) (defaults to: :unset) —

    The answer_set for the question.

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

    The Authorization HTTP request header

Returns:



324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 324

def update(
  allow_na: nil, 
  category_sid: :unset, 
  question: :unset, 
  description: :unset, 
  answer_set_id: :unset, 
  authorization: :unset
)

    data = Twilio::Values.of({
        'AllowNa' => allow_na,
        'CategorySid' => category_sid,
        'Question' => question,
        'Description' => description,
        'AnswerSetId' => answer_set_id,
    })

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

#update_with_metadata(allow_na: nil, category_sid: :unset, question: :unset, description: :unset, answer_set_id: :unset, authorization: :unset) ⇒ InsightsQuestionnairesQuestionInstance

Update the InsightsQuestionnairesQuestionInstanceMetadata

Parameters:

  • allow_na (Boolean) (defaults to: nil) —

    The flag to enable for disable NA for answer.

  • category_sid (String) (defaults to: :unset) —

    The SID of the category

  • question (String) (defaults to: :unset) —

    The question.

  • description (String) (defaults to: :unset) —

    The description for the question.

  • answer_set_id (String) (defaults to: :unset) —

    The answer_set for the question.

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

    The Authorization HTTP request header

Returns:



364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 364

def (
  allow_na: nil, 
  category_sid: :unset, 
  question: :unset, 
  description: :unset, 
  answer_set_id: :unset, 
  authorization: :unset
)

    data = Twilio::Values.of({
        'AllowNa' => allow_na,
        'CategorySid' => category_sid,
        'Question' => question,
        'Description' => description,
        'AnswerSetId' => answer_set_id,
    })

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