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

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

Overview

PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact [email protected].

Instance Method Summary collapse

Constructor Details

#initialize(version, question_id) ⇒ InsightsQuestionnairesQuestionContext

Initialize the InsightsQuestionnairesQuestionContext

Parameters:

  • version (Version)

    Version that contains the resource

  • question_id (String)

    The unique ID of the question



186
187
188
189
190
191
192
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 186

def initialize(version, question_id)
  super(version)

  # Path Solution
  @solution = {question_id: question_id, }
  @uri = "/Insights/QM/Questions/#{@solution[:question_id]}"
end

Instance Method Details

#delete(token: :unset) ⇒ Boolean

Delete the InsightsQuestionnairesQuestionInstance

Parameters:

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

    The Token HTTP request header

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



222
223
224
225
226
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 222

def delete(token: :unset)
  headers = Twilio::Values.of({'Token' => token, })

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

#inspectObject

Provide a detailed, user friendly representation



237
238
239
240
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 237

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

#to_sObject

Provide a user friendly representation



230
231
232
233
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 230

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

#update(allow_na: nil, category_id: :unset, question: :unset, description: :unset, answer_set_id: :unset, token: :unset) ⇒ InsightsQuestionnairesQuestionInstance

Update the InsightsQuestionnairesQuestionInstance

Parameters:

  • allow_na (Boolean) (defaults to: nil)

    The flag to enable for disable NA for answer.

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

    The ID 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.

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

    The Token HTTP request header

Returns:



203
204
205
206
207
208
209
210
211
212
213
214
215
216
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb', line 203

def update(allow_na: nil, category_id: :unset, question: :unset, description: :unset, answer_set_id: :unset, token: :unset)
  data = Twilio::Values.of({
      'AllowNa' => allow_na,
      'CategoryId' => category_id,
      'Question' => question,
      'Description' => description,
      'AnswerSetId' => answer_set_id,
  })
  headers = Twilio::Values.of({'Token' => token, })

  payload = @version.update('POST', @uri, data: data, headers: headers)

  InsightsQuestionnairesQuestionInstance.new(@version, payload, question_id: @solution[:question_id], )
end