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



261
262
263
264
265
266
267
268
269
270
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 261

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



275
276
277
278
279
280
281
282
283
284
285
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 275

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



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 291

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

#inspectObject

Provide a detailed, user friendly representation



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

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

#to_sObject

Provide a user friendly representation



398
399
400
401
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 398

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:



318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 318

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:



358
359
360
361
362
363
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
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 358

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