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.



563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 563

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_sid ⇒ String

Returns The SID of the Account that created the Flex Insights resource and owns this resource.

Returns:

  • (String) —

    The SID of the Account that created the Flex Insights resource and owns this resource.



599
600
601
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 599

def 
    @properties['account_sid']
end

#allow_na ⇒ Boolean

Returns The flag to enable for disable NA for answer.

Returns:

  • (Boolean) —

    The flag to enable for disable NA for answer.



635
636
637
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 635

def allow_na
    @properties['allow_na']
end

#answer_set ⇒ Hash

Returns Set of answers for the question.

Returns:

  • (Hash) —

    Set of answers for the question



647
648
649
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 647

def answer_set
    @properties['answer_set']
end

#answer_set_id ⇒ String

Returns The answer_set for the question.

Returns:

  • (String) —

    The answer_set for the question.



629
630
631
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 629

def answer_set_id
    @properties['answer_set_id']
end

#category ⇒ Hash

Returns The Category for the question.

Returns:

  • (Hash) —

    The Category for the question.



623
624
625
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 623

def category
    @properties['category']
end

#context ⇒ InsightsQuestionnairesQuestionContext

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

Returns:



590
591
592
593
594
595
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 590

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



661
662
663
664
665
666
667
668
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 661

def delete(
  authorization: :unset
)

    context.delete(
        authorization: authorization, 
    )
end

#description ⇒ String

Returns The description for the question.

Returns:

  • (String) —

    The description for the question.



617
618
619
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 617

def description
    @properties['description']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



707
708
709
710
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 707

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

#question ⇒ String

Returns The question.

Returns:

  • (String) —

    The question.



611
612
613
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 611

def question
    @properties['question']
end

#question_sid ⇒ String

Returns The SID of the question.

Returns:

  • (String) —

    The SID of the question



605
606
607
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 605

def question_sid
    @properties['question_sid']
end

#to_s ⇒ Object

Provide a user friendly representation



700
701
702
703
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 700

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:



679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 679

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

#url ⇒ String

Returns:

  • (String)


653
654
655
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 653

def url
    @properties['url']
end

#usage ⇒ String

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



641
642
643
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 641

def usage
    @properties['usage']
end