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 (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this InsightsQuestionnairesQuestion resource.

  • sid (String)

    The SID of the Call resource to fetch.



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

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:



330
331
332
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 330

def 
    @properties['account_sid']
end

#allow_naBoolean

Returns The flag to enable for disable NA for answer.

Returns:

  • (Boolean)

    The flag to enable for disable NA for answer.



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

def allow_na
    @properties['allow_na']
end

#answer_setHash

Returns Set of answers for the question.

Returns:

  • (Hash)

    Set of answers for the question



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

def answer_set
    @properties['answer_set']
end

#answer_set_idString

Returns The answer_set for the question.

Returns:

  • (String)

    The answer_set for the question.



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

def answer_set_id
    @properties['answer_set_id']
end

#categoryHash

Returns The Category for the question.

Returns:

  • (Hash)

    The Category for the question.



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

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:



321
322
323
324
325
326
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 321

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:

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

    The Authorization HTTP request header

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



392
393
394
395
396
397
398
399
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 392

def delete(
    authorization: :unset
)

    context.delete(
        authorization: authorization, 
    )
end

#descriptionString

Returns The description for the question.

Returns:

  • (String)

    The description for the question.



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

def description
    @properties['description']
end

#inspectObject

Provide a detailed, user friendly representation



438
439
440
441
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 438

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

#questionString

Returns The question.

Returns:

  • (String)

    The question.



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

def question
    @properties['question']
end

#question_sidString

Returns The SID of the question.

Returns:

  • (String)

    The SID of the question



336
337
338
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 336

def question_sid
    @properties['question_sid']
end

#to_sObject

Provide a user friendly representation



431
432
433
434
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 431

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:

  • 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:



410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 410

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:

  • (String)


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

def url
    @properties['url']
end

#usageString

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

Returns:

  • (String)

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



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

def usage
    @properties['usage']
end