Class: Twilio::REST::FlexApi::V1::InsightsQuestionnairesQuestionInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, question_sid: nil) ⇒ InsightsQuestionnairesQuestionInstance

Initialize the InsightsQuestionnairesQuestionInstance

Parameters:

  • Version that contains the resource

  • payload that contains response from Twilio

  • The SID of the Account that created this InsightsQuestionnairesQuestion resource.

  • The SID of the Call resource to fetch.



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

def initialize(version, payload , question_sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'account_sid' => payload['account_sid'],
        'question_sid' => payload['question_sid'],
        'question' => payload['question'],
        'description' => payload['description'],
        'category' => payload['category'],
        'answer_set_id' => payload['answer_set_id'],
        'allow_na' => payload['allow_na'],
        'usage' => payload['usage'] == nil ? payload['usage'] : payload['usage'].to_i,
        'answer_set' => payload['answer_set'],
        'url' => payload['url'],
    }

    # Context
    @instance_context = nil
    @params = { 'question_sid' => question_sid  || @properties['question_sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Flex Insights resource and owns this resource.

Returns:



341
342
343
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 341

def 
    @properties['account_sid']
end

#allow_naBoolean

Returns The flag to enable for disable NA for answer.

Returns:

  • The flag to enable for disable NA for answer.



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

def allow_na
    @properties['allow_na']
end

#answer_setHash

Returns Set of answers for the question.

Returns:

  • Set of answers for the question



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

def answer_set
    @properties['answer_set']
end

#answer_set_idString

Returns The answer_set for the question.

Returns:

  • The answer_set for the question.



371
372
373
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 371

def answer_set_id
    @properties['answer_set_id']
end

#categoryHash

Returns The Category for the question.

Returns:

  • The Category for the question.



365
366
367
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 365

def category
    @properties['category']
end

#contextInsightsQuestionnairesQuestionContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:

  • CallContext for this CallInstance



332
333
334
335
336
337
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 332

def context
    unless @instance_context
        @instance_context = InsightsQuestionnairesQuestionContext.new(@version , @params['question_sid'])
    end
    @instance_context
end

#delete(authorization: :unset) ⇒ Boolean

Delete the InsightsQuestionnairesQuestionInstance

Parameters:

  • (defaults to: :unset)

    The Authorization HTTP request header

Returns:

  • True if delete succeeds, false otherwise



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

def delete(
    authorization: :unset
)

    context.delete(
        authorization: authorization, 
    )
end

#descriptionString

Returns The description for the question.

Returns:

  • The description for the question.



359
360
361
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 359

def description
    @properties['description']
end

#inspectObject

Provide a detailed, user friendly representation



449
450
451
452
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 449

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.FlexApi.V1.InsightsQuestionnairesQuestionInstance #{values}>"
end

#questionString

Returns The question.

Returns:

  • The question.



353
354
355
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 353

def question
    @properties['question']
end

#question_sidString

Returns The SID of the question.

Returns:

  • The SID of the question



347
348
349
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 347

def question_sid
    @properties['question_sid']
end

#to_sObject

Provide a user friendly representation



442
443
444
445
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 442

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.FlexApi.V1.InsightsQuestionnairesQuestionInstance #{values}>"
end

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

Update the InsightsQuestionnairesQuestionInstance

Parameters:

  • (defaults to: nil)

    The flag to enable for disable NA for answer.

  • (defaults to: :unset)

    The SID of the category

  • (defaults to: :unset)

    The question.

  • (defaults to: :unset)

    The description for the question.

  • (defaults to: :unset)

    The answer_set for the question.

  • (defaults to: :unset)

    The Authorization HTTP request header

Returns:

  • Updated InsightsQuestionnairesQuestionInstance



421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 421

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

    context.update(
        allow_na: allow_na, 
        category_sid: category_sid, 
        question: question, 
        description: description, 
        answer_set_id: answer_set_id, 
        authorization: authorization, 
    )
end

#urlString

Returns:



395
396
397
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 395

def url
    @properties['url']
end

#usageString

Returns Integer value that tells a particular question is used by how many questionnaires.

Returns:

  • Integer value that tells a particular question is used by how many questionnaires



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

def usage
    @properties['usage']
end