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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, questionnaire_sid) ⇒ InsightsQuestionnairesContext

Initialize the InsightsQuestionnairesContext

Parameters:

  • version (Version)

    Version that contains the resource

  • questionnaire_sid (String)

    The SID of the questionnaire



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

def initialize(version, questionnaire_sid)
    super(version)

    # Path Solution
    @solution = { questionnaire_sid: questionnaire_sid,  }
    @uri = "/Insights/QualityManagement/Questionnaires/#{@solution[:questionnaire_sid]}"

    
end

Instance Method Details

#delete(authorization: :unset) ⇒ Boolean

Delete the InsightsQuestionnairesInstance

Parameters:

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

    The Authorization HTTP request header

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



197
198
199
200
201
202
203
204
205
206
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 197

def delete(
    authorization: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => authorization, })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetch(authorization: :unset) ⇒ InsightsQuestionnairesInstance

Fetch the InsightsQuestionnairesInstance

Parameters:

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

    The Authorization HTTP request header

Returns:



212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 212

def fetch(
    authorization: :unset
)

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => authorization, })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    InsightsQuestionnairesInstance.new(
        @version,
        payload,
        questionnaire_sid: @solution[:questionnaire_sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



277
278
279
280
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 277

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

#to_sObject

Provide a user friendly representation



270
271
272
273
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 270

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_sids: :unset, authorization: :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_sids (Array[String]) (defaults to: :unset)

    The list of questions sids under a questionnaire

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

    The Authorization HTTP request header

Returns:



238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# File 'lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb', line 238

def update(
    active: nil, 
    name: :unset, 
    description: :unset, 
    question_sids: :unset, 
    authorization: :unset
)

    data = Twilio::Values.of({
        'Active' => active,
        'Name' => name,
        'Description' => description,
        'QuestionSids' => Twilio.serialize_list(question_sids) { |e| e },
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Authorization' => authorization, })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    InsightsQuestionnairesInstance.new(
        @version,
        payload,
        questionnaire_sid: @solution[:questionnaire_sid],
    )
end