## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class FlexApi < Domain class V1 < Version ## # 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 help@twilio.com. class InsightsQuestionnairesQuestionList < ListResource ## # Initialize the InsightsQuestionnairesQuestionList # @param [Version] version Version that contains the resource # @return [InsightsQuestionnairesQuestionList] InsightsQuestionnairesQuestionList def initialize(version) super(version) # Path Solution @solution = {} @uri = "/Insights/QM/Questions" end ## # Create the InsightsQuestionnairesQuestionInstance # @param [String] category_id The ID of the category # @param [String] question The question. # @param [String] description The description for the question. # @param [String] answer_set_id The answer_set for the question. # @param [Boolean] allow_na The flag to enable for disable NA for answer. # @param [String] token The Token HTTP request header # @return [InsightsQuestionnairesQuestionInstance] Created InsightsQuestionnairesQuestionInstance def create(category_id: nil, question: nil, description: nil, answer_set_id: nil, allow_na: nil, token: :unset) data = Twilio::Values.of({ 'CategoryId' => category_id, 'Question' => question, 'Description' => description, 'AnswerSetId' => answer_set_id, 'AllowNa' => allow_na, }) headers = Twilio::Values.of({'Token' => token, }) payload = @version.create('POST', @uri, data: data, headers: headers) InsightsQuestionnairesQuestionInstance.new(@version, payload, ) end ## # Provide a user friendly representation def to_s '#' end end ## # 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 help@twilio.com. class InsightsQuestionnairesQuestionPage < Page ## # Initialize the InsightsQuestionnairesQuestionPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [InsightsQuestionnairesQuestionPage] InsightsQuestionnairesQuestionPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of InsightsQuestionnairesQuestionInstance # @param [Hash] payload Payload response from the API # @return [InsightsQuestionnairesQuestionInstance] InsightsQuestionnairesQuestionInstance def get_instance(payload) InsightsQuestionnairesQuestionInstance.new(@version, payload, ) end ## # Provide a user friendly representation def to_s '' end end ## # 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 help@twilio.com. class InsightsQuestionnairesQuestionContext < InstanceContext ## # Initialize the InsightsQuestionnairesQuestionContext # @param [Version] version Version that contains the resource # @param [String] question_id The unique ID of the question # @return [InsightsQuestionnairesQuestionContext] InsightsQuestionnairesQuestionContext def initialize(version, question_id) super(version) # Path Solution @solution = {question_id: question_id, } @uri = "/Insights/QM/Questions/#{@solution[:question_id]}" end ## # Update the InsightsQuestionnairesQuestionInstance # @param [String] question The question. # @param [String] description The description for the question. # @param [String] answer_set_id The answer_set for the question. # @param [Boolean] allow_na The flag to enable for disable NA for answer. # @param [String] category_id The ID of the category # @param [String] token The Token HTTP request header # @return [InsightsQuestionnairesQuestionInstance] Updated InsightsQuestionnairesQuestionInstance def update(question: nil, description: nil, answer_set_id: nil, allow_na: nil, category_id: :unset, token: :unset) data = Twilio::Values.of({ 'Question' => question, 'Description' => description, 'AnswerSetId' => answer_set_id, 'AllowNa' => allow_na, 'CategoryId' => category_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 ## # Delete the InsightsQuestionnairesQuestionInstance # @param [String] token The Token HTTP request header # @return [Boolean] true if delete succeeds, false otherwise def delete(token: :unset) headers = Twilio::Values.of({'Token' => token, }) @version.delete('DELETE', @uri, headers: headers) end ## # Provide a user friendly representation def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#" end ## # Provide a detailed, user friendly representation def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#" end end ## # 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 help@twilio.com. class InsightsQuestionnairesQuestionInstance < InstanceResource ## # Initialize the InsightsQuestionnairesQuestionInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] question_id The unique ID of the question # @return [InsightsQuestionnairesQuestionInstance] InsightsQuestionnairesQuestionInstance def initialize(version, payload, question_id: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'question_id' => payload['question_id'], 'question' => payload['question'], 'description' => payload['description'], 'category' => payload['category'], 'answer_set_id' => payload['answer_set_id'], 'allow_na' => payload['allow_na'], 'url' => payload['url'], } # Context @instance_context = nil @params = {'question_id' => question_id || @properties['question_id'], } end ## # Generate an instance context for the instance, the context is capable of # performing various actions. All instance actions are proxied to the context # @return [InsightsQuestionnairesQuestionContext] InsightsQuestionnairesQuestionContext for this InsightsQuestionnairesQuestionInstance def context unless @instance_context @instance_context = InsightsQuestionnairesQuestionContext.new(@version, @params['question_id'], ) end @instance_context end ## # @return [String] The SID of the Account that created the resource and owns this Flex Insights def account_sid @properties['account_sid'] end ## # @return [String] Unique Question ID def question_id @properties['question_id'] end ## # @return [String] The question. def question @properties['question'] end ## # @return [String] The question description. def description @properties['description'] end ## # @return [Hash] The question category. def category @properties['category'] end ## # @return [String] The answer_set for question. def answer_set_id @properties['answer_set_id'] end ## # @return [Boolean] Flag to enable NA for answer. def allow_na @properties['allow_na'] end ## # @return [String] The url def url @properties['url'] end ## # Update the InsightsQuestionnairesQuestionInstance # @param [String] question The question. # @param [String] description The description for the question. # @param [String] answer_set_id The answer_set for the question. # @param [Boolean] allow_na The flag to enable for disable NA for answer. # @param [String] category_id The ID of the category # @param [String] token The Token HTTP request header # @return [InsightsQuestionnairesQuestionInstance] Updated InsightsQuestionnairesQuestionInstance def update(question: nil, description: nil, answer_set_id: nil, allow_na: nil, category_id: :unset, token: :unset) context.update( question: question, description: description, answer_set_id: answer_set_id, allow_na: allow_na, category_id: category_id, token: token, ) end ## # Delete the InsightsQuestionnairesQuestionInstance # @param [String] token The Token HTTP request header # @return [Boolean] true if delete succeeds, false otherwise def delete(token: :unset) context.delete(token: token, ) end ## # Provide a user friendly representation def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "" end ## # Provide a detailed, user friendly representation def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "" end end end end end end