Class: Twilio::REST::FlexApi::V1::InsightsQuestionnairesContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.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, id) ⇒ InsightsQuestionnairesContext

Initialize the InsightsQuestionnairesContext

Parameters:

  • version (Version)

    Version that contains the resource

  • id (String)

    The unique ID of the questionnaire



193
194
195
196
197
198
199
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 193

def initialize(version, id)
  super(version)

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

Instance Method Details

#delete(token: :unset) ⇒ Boolean

Delete the InsightsQuestionnairesInstance

Parameters:

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

    The Token HTTP request header

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise



228
229
230
231
232
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 228

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

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

#fetch(token: :unset) ⇒ InsightsQuestionnairesInstance

Fetch the InsightsQuestionnairesInstance

Parameters:

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

    The Token HTTP request header

Returns:



238
239
240
241
242
243
244
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 238

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

  payload = @version.fetch('GET', @uri, headers: headers)

  InsightsQuestionnairesInstance.new(@version, payload, id: @solution[:id], )
end

#inspectObject

Provide a detailed, user friendly representation



255
256
257
258
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 255

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

#to_sObject

Provide a user friendly representation



248
249
250
251
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 248

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

#update(active: nil, name: :unset, description: :unset, question_ids: :unset, token: :unset) ⇒ InsightsQuestionnairesInstance

Update the InsightsQuestionnairesInstance

Parameters:

  • active (Boolean) (defaults to: nil)

    The flag to enable or disable questionnaire

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

    The name of this questionnaire

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

    The description of this questionnaire

  • question_ids (Array[String]) (defaults to: :unset)

    The list of questions ids under a questionnaire

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

    The Token HTTP request header

Returns:



210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 210

def update(active: nil, name: :unset, description: :unset, question_ids: :unset, token: :unset)
  data = Twilio::Values.of({
      'Active' => active,
      'Name' => name,
      'Description' => description,
      'QuestionIds' => Twilio.serialize_list(question_ids) { |e| e },
  })
  headers = Twilio::Values.of({'Token' => token, })

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

  InsightsQuestionnairesInstance.new(@version, payload, id: @solution[:id], )
end