twilio-ruby 5.74.2 → 5.74.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +7 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/content/v1/legacy_content.rb +254 -0
  5. data/lib/twilio-ruby/rest/content/v1.rb +7 -0
  6. data/lib/twilio-ruby/rest/content.rb +6 -0
  7. data/lib/twilio-ruby/rest/flex_api/v1/insights_assessments_comment.rb +314 -0
  8. data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires.rb +394 -0
  9. data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_category.rb +84 -0
  10. data/lib/twilio-ruby/rest/flex_api/v1/insights_questionnaires_question.rb +105 -10
  11. data/lib/twilio-ruby/rest/flex_api/v1/insights_segments.rb +319 -0
  12. data/lib/twilio-ruby/rest/flex_api/v1/insights_session.rb +14 -6
  13. data/lib/twilio-ruby/rest/flex_api/v1/insights_user_roles.rb +14 -6
  14. data/lib/twilio-ruby/rest/flex_api/v1.rb +39 -0
  15. data/lib/twilio-ruby/rest/flex_api.rb +22 -0
  16. data/lib/twilio-ruby/rest/lookups/v2/phone_number.rb +14 -0
  17. data/lib/twilio-ruby/rest/microvisor/v1/account_config.rb +297 -0
  18. data/lib/twilio-ruby/rest/microvisor/v1/account_secret.rb +290 -0
  19. data/lib/twilio-ruby/rest/microvisor/v1/device/device_config.rb +317 -0
  20. data/lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb +310 -0
  21. data/lib/twilio-ruby/rest/microvisor/v1/device.rb +54 -0
  22. data/lib/twilio-ruby/rest/microvisor/v1.rb +32 -0
  23. data/lib/twilio-ruby/rest/microvisor.rb +16 -0
  24. data/lib/twilio-ruby/rest/supersim/v1/sms_command.rb +3 -3
  25. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue_bulk_real_time_statistics.rb +149 -0
  26. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +23 -0
  27. data/lib/twilio-ruby/version.rb +1 -1
  28. metadata +11 -2
@@ -0,0 +1,394 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class FlexApi < Domain
12
+ class V1 < Version
13
+ ##
14
+ # 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.
15
+ class InsightsQuestionnairesList < ListResource
16
+ ##
17
+ # Initialize the InsightsQuestionnairesList
18
+ # @param [Version] version Version that contains the resource
19
+ # @return [InsightsQuestionnairesList] InsightsQuestionnairesList
20
+ def initialize(version)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {}
25
+ @uri = "/Insights/QM/Questionnaires"
26
+ end
27
+
28
+ ##
29
+ # Create the InsightsQuestionnairesInstance
30
+ # @param [String] name The name of this questionnaire
31
+ # @param [String] description The description of this questionnaire
32
+ # @param [Boolean] active The flag to enable or disable questionnaire
33
+ # @param [Array[String]] question_ids The list of questions ids under a
34
+ # questionnaire
35
+ # @param [String] token The Token HTTP request header
36
+ # @return [InsightsQuestionnairesInstance] Created InsightsQuestionnairesInstance
37
+ def create(name: nil, description: :unset, active: :unset, question_ids: :unset, token: :unset)
38
+ data = Twilio::Values.of({
39
+ 'Name' => name,
40
+ 'Description' => description,
41
+ 'Active' => active,
42
+ 'QuestionIds' => Twilio.serialize_list(question_ids) { |e| e },
43
+ })
44
+ headers = Twilio::Values.of({'Token' => token, })
45
+
46
+ payload = @version.create('POST', @uri, data: data, headers: headers)
47
+
48
+ InsightsQuestionnairesInstance.new(@version, payload, )
49
+ end
50
+
51
+ ##
52
+ # Lists InsightsQuestionnairesInstance records from the API as a list.
53
+ # Unlike stream(), this operation is eager and will load `limit` records into
54
+ # memory before returning.
55
+ # @param [Boolean] include_inactive Flag indicating whether to include inactive
56
+ # questionnaires or not
57
+ # @param [String] token The Token HTTP request header
58
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
59
+ # guarantees to never return more than limit. Default is no limit
60
+ # @param [Integer] page_size Number of records to fetch per request, when
61
+ # not set will use the default value of 50 records. If no page_size is defined
62
+ # but a limit is defined, stream() will attempt to read the limit with the most
63
+ # efficient page size, i.e. min(limit, 1000)
64
+ # @return [Array] Array of up to limit results
65
+ def list(include_inactive: :unset, token: :unset, limit: nil, page_size: nil)
66
+ self.stream(
67
+ include_inactive: include_inactive,
68
+ token: token,
69
+ limit: limit,
70
+ page_size: page_size
71
+ ).entries
72
+ end
73
+
74
+ ##
75
+ # Streams InsightsQuestionnairesInstance records from the API as an Enumerable.
76
+ # This operation lazily loads records as efficiently as possible until the limit
77
+ # is reached.
78
+ # @param [Boolean] include_inactive Flag indicating whether to include inactive
79
+ # questionnaires or not
80
+ # @param [String] token The Token HTTP request header
81
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
82
+ # guarantees to never return more than limit. Default is no limit.
83
+ # @param [Integer] page_size Number of records to fetch per request, when
84
+ # not set will use the default value of 50 records. If no page_size is defined
85
+ # but a limit is defined, stream() will attempt to read the limit with the most
86
+ # efficient page size, i.e. min(limit, 1000)
87
+ # @return [Enumerable] Enumerable that will yield up to limit results
88
+ def stream(include_inactive: :unset, token: :unset, limit: nil, page_size: nil)
89
+ limits = @version.read_limits(limit, page_size)
90
+
91
+ page = self.page(include_inactive: include_inactive, token: token, page_size: limits[:page_size], )
92
+
93
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
94
+ end
95
+
96
+ ##
97
+ # When passed a block, yields InsightsQuestionnairesInstance records from the API.
98
+ # This operation lazily loads records as efficiently as possible until the limit
99
+ # is reached.
100
+ def each
101
+ limits = @version.read_limits
102
+
103
+ page = self.page(page_size: limits[:page_size], )
104
+
105
+ @version.stream(page,
106
+ limit: limits[:limit],
107
+ page_limit: limits[:page_limit]).each {|x| yield x}
108
+ end
109
+
110
+ ##
111
+ # Retrieve a single page of InsightsQuestionnairesInstance records from the API.
112
+ # Request is executed immediately.
113
+ # @param [Boolean] include_inactive Flag indicating whether to include inactive
114
+ # questionnaires or not
115
+ # @param [String] token The Token HTTP request header
116
+ # @param [String] page_token PageToken provided by the API
117
+ # @param [Integer] page_number Page Number, this value is simply for client state
118
+ # @param [Integer] page_size Number of records to return, defaults to 50
119
+ # @return [Page] Page of InsightsQuestionnairesInstance
120
+ def page(include_inactive: :unset, token: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
121
+ params = Twilio::Values.of({
122
+ 'IncludeInactive' => include_inactive,
123
+ 'PageToken' => page_token,
124
+ 'Page' => page_number,
125
+ 'PageSize' => page_size,
126
+ })
127
+ headers = Twilio::Values.of({'Token' => token, })
128
+
129
+ response = @version.page('GET', @uri, params: params, headers: headers)
130
+
131
+ InsightsQuestionnairesPage.new(@version, response, @solution)
132
+ end
133
+
134
+ ##
135
+ # Retrieve a single page of InsightsQuestionnairesInstance records from the API.
136
+ # Request is executed immediately.
137
+ # @param [String] target_url API-generated URL for the requested results page
138
+ # @return [Page] Page of InsightsQuestionnairesInstance
139
+ def get_page(target_url)
140
+ response = @version.domain.request(
141
+ 'GET',
142
+ target_url
143
+ )
144
+ InsightsQuestionnairesPage.new(@version, response, @solution)
145
+ end
146
+
147
+ ##
148
+ # Provide a user friendly representation
149
+ def to_s
150
+ '#<Twilio.FlexApi.V1.InsightsQuestionnairesList>'
151
+ end
152
+ end
153
+
154
+ ##
155
+ # 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.
156
+ class InsightsQuestionnairesPage < Page
157
+ ##
158
+ # Initialize the InsightsQuestionnairesPage
159
+ # @param [Version] version Version that contains the resource
160
+ # @param [Response] response Response from the API
161
+ # @param [Hash] solution Path solution for the resource
162
+ # @return [InsightsQuestionnairesPage] InsightsQuestionnairesPage
163
+ def initialize(version, response, solution)
164
+ super(version, response)
165
+
166
+ # Path Solution
167
+ @solution = solution
168
+ end
169
+
170
+ ##
171
+ # Build an instance of InsightsQuestionnairesInstance
172
+ # @param [Hash] payload Payload response from the API
173
+ # @return [InsightsQuestionnairesInstance] InsightsQuestionnairesInstance
174
+ def get_instance(payload)
175
+ InsightsQuestionnairesInstance.new(@version, payload, )
176
+ end
177
+
178
+ ##
179
+ # Provide a user friendly representation
180
+ def to_s
181
+ '<Twilio.FlexApi.V1.InsightsQuestionnairesPage>'
182
+ end
183
+ end
184
+
185
+ ##
186
+ # 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.
187
+ class InsightsQuestionnairesContext < InstanceContext
188
+ ##
189
+ # Initialize the InsightsQuestionnairesContext
190
+ # @param [Version] version Version that contains the resource
191
+ # @param [String] id The unique ID of the questionnaire
192
+ # @return [InsightsQuestionnairesContext] InsightsQuestionnairesContext
193
+ def initialize(version, id)
194
+ super(version)
195
+
196
+ # Path Solution
197
+ @solution = {id: id, }
198
+ @uri = "/Insights/QM/Questionnaires/#{@solution[:id]}"
199
+ end
200
+
201
+ ##
202
+ # Update the InsightsQuestionnairesInstance
203
+ # @param [Boolean] active The flag to enable or disable questionnaire
204
+ # @param [String] name The name of this questionnaire
205
+ # @param [String] description The description of this questionnaire
206
+ # @param [Array[String]] question_ids The list of questions ids under a
207
+ # questionnaire
208
+ # @param [String] token The Token HTTP request header
209
+ # @return [InsightsQuestionnairesInstance] Updated InsightsQuestionnairesInstance
210
+ def update(active: nil, name: :unset, description: :unset, question_ids: :unset, token: :unset)
211
+ data = Twilio::Values.of({
212
+ 'Active' => active,
213
+ 'Name' => name,
214
+ 'Description' => description,
215
+ 'QuestionIds' => Twilio.serialize_list(question_ids) { |e| e },
216
+ })
217
+ headers = Twilio::Values.of({'Token' => token, })
218
+
219
+ payload = @version.update('POST', @uri, data: data, headers: headers)
220
+
221
+ InsightsQuestionnairesInstance.new(@version, payload, id: @solution[:id], )
222
+ end
223
+
224
+ ##
225
+ # Delete the InsightsQuestionnairesInstance
226
+ # @param [String] token The Token HTTP request header
227
+ # @return [Boolean] true if delete succeeds, false otherwise
228
+ def delete(token: :unset)
229
+ headers = Twilio::Values.of({'Token' => token, })
230
+
231
+ @version.delete('DELETE', @uri, headers: headers)
232
+ end
233
+
234
+ ##
235
+ # Fetch the InsightsQuestionnairesInstance
236
+ # @param [String] token The Token HTTP request header
237
+ # @return [InsightsQuestionnairesInstance] Fetched InsightsQuestionnairesInstance
238
+ def fetch(token: :unset)
239
+ headers = Twilio::Values.of({'Token' => token, })
240
+
241
+ payload = @version.fetch('GET', @uri, headers: headers)
242
+
243
+ InsightsQuestionnairesInstance.new(@version, payload, id: @solution[:id], )
244
+ end
245
+
246
+ ##
247
+ # Provide a user friendly representation
248
+ def to_s
249
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
250
+ "#<Twilio.FlexApi.V1.InsightsQuestionnairesContext #{context}>"
251
+ end
252
+
253
+ ##
254
+ # Provide a detailed, user friendly representation
255
+ def inspect
256
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
257
+ "#<Twilio.FlexApi.V1.InsightsQuestionnairesContext #{context}>"
258
+ end
259
+ end
260
+
261
+ ##
262
+ # 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.
263
+ class InsightsQuestionnairesInstance < InstanceResource
264
+ ##
265
+ # Initialize the InsightsQuestionnairesInstance
266
+ # @param [Version] version Version that contains the resource
267
+ # @param [Hash] payload payload that contains response from Twilio
268
+ # @param [String] id The unique ID of the questionnaire
269
+ # @return [InsightsQuestionnairesInstance] InsightsQuestionnairesInstance
270
+ def initialize(version, payload, id: nil)
271
+ super(version)
272
+
273
+ # Marshaled Properties
274
+ @properties = {
275
+ 'account_sid' => payload['account_sid'],
276
+ 'id' => payload['id'],
277
+ 'name' => payload['name'],
278
+ 'description' => payload['description'],
279
+ 'active' => payload['active'],
280
+ 'questions' => payload['questions'],
281
+ 'url' => payload['url'],
282
+ }
283
+
284
+ # Context
285
+ @instance_context = nil
286
+ @params = {'id' => id || @properties['id'], }
287
+ end
288
+
289
+ ##
290
+ # Generate an instance context for the instance, the context is capable of
291
+ # performing various actions. All instance actions are proxied to the context
292
+ # @return [InsightsQuestionnairesContext] InsightsQuestionnairesContext for this InsightsQuestionnairesInstance
293
+ def context
294
+ unless @instance_context
295
+ @instance_context = InsightsQuestionnairesContext.new(@version, @params['id'], )
296
+ end
297
+ @instance_context
298
+ end
299
+
300
+ ##
301
+ # @return [String] The SID of the Account that created the resource and owns this Flex Insights
302
+ def account_sid
303
+ @properties['account_sid']
304
+ end
305
+
306
+ ##
307
+ # @return [String] The questionnaire id
308
+ def id
309
+ @properties['id']
310
+ end
311
+
312
+ ##
313
+ # @return [String] The category name.
314
+ def name
315
+ @properties['name']
316
+ end
317
+
318
+ ##
319
+ # @return [String] The questionnaire description
320
+ def description
321
+ @properties['description']
322
+ end
323
+
324
+ ##
325
+ # @return [Boolean] Is questionnaire enabled ?
326
+ def active
327
+ @properties['active']
328
+ end
329
+
330
+ ##
331
+ # @return [Array[Hash]] The questions list
332
+ def questions
333
+ @properties['questions']
334
+ end
335
+
336
+ ##
337
+ # @return [String] The url
338
+ def url
339
+ @properties['url']
340
+ end
341
+
342
+ ##
343
+ # Update the InsightsQuestionnairesInstance
344
+ # @param [Boolean] active The flag to enable or disable questionnaire
345
+ # @param [String] name The name of this questionnaire
346
+ # @param [String] description The description of this questionnaire
347
+ # @param [Array[String]] question_ids The list of questions ids under a
348
+ # questionnaire
349
+ # @param [String] token The Token HTTP request header
350
+ # @return [InsightsQuestionnairesInstance] Updated InsightsQuestionnairesInstance
351
+ def update(active: nil, name: :unset, description: :unset, question_ids: :unset, token: :unset)
352
+ context.update(
353
+ active: active,
354
+ name: name,
355
+ description: description,
356
+ question_ids: question_ids,
357
+ token: token,
358
+ )
359
+ end
360
+
361
+ ##
362
+ # Delete the InsightsQuestionnairesInstance
363
+ # @param [String] token The Token HTTP request header
364
+ # @return [Boolean] true if delete succeeds, false otherwise
365
+ def delete(token: :unset)
366
+ context.delete(token: token, )
367
+ end
368
+
369
+ ##
370
+ # Fetch the InsightsQuestionnairesInstance
371
+ # @param [String] token The Token HTTP request header
372
+ # @return [InsightsQuestionnairesInstance] Fetched InsightsQuestionnairesInstance
373
+ def fetch(token: :unset)
374
+ context.fetch(token: token, )
375
+ end
376
+
377
+ ##
378
+ # Provide a user friendly representation
379
+ def to_s
380
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
381
+ "<Twilio.FlexApi.V1.InsightsQuestionnairesInstance #{values}>"
382
+ end
383
+
384
+ ##
385
+ # Provide a detailed, user friendly representation
386
+ def inspect
387
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
388
+ "<Twilio.FlexApi.V1.InsightsQuestionnairesInstance #{values}>"
389
+ end
390
+ end
391
+ end
392
+ end
393
+ end
394
+ end
@@ -39,6 +39,90 @@ module Twilio
39
39
  InsightsQuestionnairesCategoryInstance.new(@version, payload, )
40
40
  end
41
41
 
42
+ ##
43
+ # Lists InsightsQuestionnairesCategoryInstance records from the API as a list.
44
+ # Unlike stream(), this operation is eager and will load `limit` records into
45
+ # memory before returning.
46
+ # @param [String] token The Token HTTP request header
47
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
48
+ # guarantees to never return more than limit. Default is no limit
49
+ # @param [Integer] page_size Number of records to fetch per request, when
50
+ # not set will use the default value of 50 records. If no page_size is defined
51
+ # but a limit is defined, stream() will attempt to read the limit with the most
52
+ # efficient page size, i.e. min(limit, 1000)
53
+ # @return [Array] Array of up to limit results
54
+ def list(token: :unset, limit: nil, page_size: nil)
55
+ self.stream(token: token, limit: limit, page_size: page_size).entries
56
+ end
57
+
58
+ ##
59
+ # Streams InsightsQuestionnairesCategoryInstance records from the API as an Enumerable.
60
+ # This operation lazily loads records as efficiently as possible until the limit
61
+ # is reached.
62
+ # @param [String] token The Token HTTP request header
63
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
64
+ # guarantees to never return more than limit. Default is no limit.
65
+ # @param [Integer] page_size Number of records to fetch per request, when
66
+ # not set will use the default value of 50 records. If no page_size is defined
67
+ # but a limit is defined, stream() will attempt to read the limit with the most
68
+ # efficient page size, i.e. min(limit, 1000)
69
+ # @return [Enumerable] Enumerable that will yield up to limit results
70
+ def stream(token: :unset, limit: nil, page_size: nil)
71
+ limits = @version.read_limits(limit, page_size)
72
+
73
+ page = self.page(token: token, page_size: limits[:page_size], )
74
+
75
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
76
+ end
77
+
78
+ ##
79
+ # When passed a block, yields InsightsQuestionnairesCategoryInstance records from the API.
80
+ # This operation lazily loads records as efficiently as possible until the limit
81
+ # is reached.
82
+ def each
83
+ limits = @version.read_limits
84
+
85
+ page = self.page(page_size: limits[:page_size], )
86
+
87
+ @version.stream(page,
88
+ limit: limits[:limit],
89
+ page_limit: limits[:page_limit]).each {|x| yield x}
90
+ end
91
+
92
+ ##
93
+ # Retrieve a single page of InsightsQuestionnairesCategoryInstance records from the API.
94
+ # Request is executed immediately.
95
+ # @param [String] token The Token HTTP request header
96
+ # @param [String] page_token PageToken provided by the API
97
+ # @param [Integer] page_number Page Number, this value is simply for client state
98
+ # @param [Integer] page_size Number of records to return, defaults to 50
99
+ # @return [Page] Page of InsightsQuestionnairesCategoryInstance
100
+ def page(token: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
101
+ params = Twilio::Values.of({
102
+ 'PageToken' => page_token,
103
+ 'Page' => page_number,
104
+ 'PageSize' => page_size,
105
+ })
106
+ headers = Twilio::Values.of({'Token' => token, })
107
+
108
+ response = @version.page('GET', @uri, params: params, headers: headers)
109
+
110
+ InsightsQuestionnairesCategoryPage.new(@version, response, @solution)
111
+ end
112
+
113
+ ##
114
+ # Retrieve a single page of InsightsQuestionnairesCategoryInstance records from the API.
115
+ # Request is executed immediately.
116
+ # @param [String] target_url API-generated URL for the requested results page
117
+ # @return [Page] Page of InsightsQuestionnairesCategoryInstance
118
+ def get_page(target_url)
119
+ response = @version.domain.request(
120
+ 'GET',
121
+ target_url
122
+ )
123
+ InsightsQuestionnairesCategoryPage.new(@version, response, @solution)
124
+ end
125
+
42
126
  ##
43
127
  # Provide a user friendly representation
44
128
  def to_s
@@ -49,6 +49,94 @@ module Twilio
49
49
  InsightsQuestionnairesQuestionInstance.new(@version, payload, )
50
50
  end
51
51
 
52
+ ##
53
+ # Lists InsightsQuestionnairesQuestionInstance records from the API as a list.
54
+ # Unlike stream(), this operation is eager and will load `limit` records into
55
+ # memory before returning.
56
+ # @param [Array[String]] category_id The list of category IDs
57
+ # @param [String] token The Token HTTP request header
58
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
59
+ # guarantees to never return more than limit. Default is no limit
60
+ # @param [Integer] page_size Number of records to fetch per request, when
61
+ # not set will use the default value of 50 records. If no page_size is defined
62
+ # but a limit is defined, stream() will attempt to read the limit with the most
63
+ # efficient page size, i.e. min(limit, 1000)
64
+ # @return [Array] Array of up to limit results
65
+ def list(category_id: :unset, token: :unset, limit: nil, page_size: nil)
66
+ self.stream(category_id: category_id, token: token, limit: limit, page_size: page_size).entries
67
+ end
68
+
69
+ ##
70
+ # Streams InsightsQuestionnairesQuestionInstance records from the API as an Enumerable.
71
+ # This operation lazily loads records as efficiently as possible until the limit
72
+ # is reached.
73
+ # @param [Array[String]] category_id The list of category IDs
74
+ # @param [String] token The Token HTTP request header
75
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
76
+ # guarantees to never return more than limit. Default is no limit.
77
+ # @param [Integer] page_size Number of records to fetch per request, when
78
+ # not set will use the default value of 50 records. If no page_size is defined
79
+ # but a limit is defined, stream() will attempt to read the limit with the most
80
+ # efficient page size, i.e. min(limit, 1000)
81
+ # @return [Enumerable] Enumerable that will yield up to limit results
82
+ def stream(category_id: :unset, token: :unset, limit: nil, page_size: nil)
83
+ limits = @version.read_limits(limit, page_size)
84
+
85
+ page = self.page(category_id: category_id, token: token, page_size: limits[:page_size], )
86
+
87
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
88
+ end
89
+
90
+ ##
91
+ # When passed a block, yields InsightsQuestionnairesQuestionInstance records from the API.
92
+ # This operation lazily loads records as efficiently as possible until the limit
93
+ # is reached.
94
+ def each
95
+ limits = @version.read_limits
96
+
97
+ page = self.page(page_size: limits[:page_size], )
98
+
99
+ @version.stream(page,
100
+ limit: limits[:limit],
101
+ page_limit: limits[:page_limit]).each {|x| yield x}
102
+ end
103
+
104
+ ##
105
+ # Retrieve a single page of InsightsQuestionnairesQuestionInstance records from the API.
106
+ # Request is executed immediately.
107
+ # @param [Array[String]] category_id The list of category IDs
108
+ # @param [String] token The Token HTTP request header
109
+ # @param [String] page_token PageToken provided by the API
110
+ # @param [Integer] page_number Page Number, this value is simply for client state
111
+ # @param [Integer] page_size Number of records to return, defaults to 50
112
+ # @return [Page] Page of InsightsQuestionnairesQuestionInstance
113
+ def page(category_id: :unset, token: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
114
+ params = Twilio::Values.of({
115
+ 'CategoryId' => Twilio.serialize_list(category_id) { |e| e },
116
+ 'PageToken' => page_token,
117
+ 'Page' => page_number,
118
+ 'PageSize' => page_size,
119
+ })
120
+ headers = Twilio::Values.of({'Token' => token, })
121
+
122
+ response = @version.page('GET', @uri, params: params, headers: headers)
123
+
124
+ InsightsQuestionnairesQuestionPage.new(@version, response, @solution)
125
+ end
126
+
127
+ ##
128
+ # Retrieve a single page of InsightsQuestionnairesQuestionInstance records from the API.
129
+ # Request is executed immediately.
130
+ # @param [String] target_url API-generated URL for the requested results page
131
+ # @return [Page] Page of InsightsQuestionnairesQuestionInstance
132
+ def get_page(target_url)
133
+ response = @version.domain.request(
134
+ 'GET',
135
+ target_url
136
+ )
137
+ InsightsQuestionnairesQuestionPage.new(@version, response, @solution)
138
+ end
139
+
52
140
  ##
53
141
  # Provide a user friendly representation
54
142
  def to_s
@@ -105,20 +193,20 @@ module Twilio
105
193
 
106
194
  ##
107
195
  # Update the InsightsQuestionnairesQuestionInstance
196
+ # @param [Boolean] allow_na The flag to enable for disable NA for answer.
197
+ # @param [String] category_id The ID of the category
108
198
  # @param [String] question The question.
109
199
  # @param [String] description The description for the question.
110
200
  # @param [String] answer_set_id The answer_set for the question.
111
- # @param [Boolean] allow_na The flag to enable for disable NA for answer.
112
- # @param [String] category_id The ID of the category
113
201
  # @param [String] token The Token HTTP request header
114
202
  # @return [InsightsQuestionnairesQuestionInstance] Updated InsightsQuestionnairesQuestionInstance
115
- def update(question: nil, description: nil, answer_set_id: nil, allow_na: nil, category_id: :unset, token: :unset)
203
+ def update(allow_na: nil, category_id: :unset, question: :unset, description: :unset, answer_set_id: :unset, token: :unset)
116
204
  data = Twilio::Values.of({
205
+ 'AllowNa' => allow_na,
206
+ 'CategoryId' => category_id,
117
207
  'Question' => question,
118
208
  'Description' => description,
119
209
  'AnswerSetId' => answer_set_id,
120
- 'AllowNa' => allow_na,
121
- 'CategoryId' => category_id,
122
210
  })
123
211
  headers = Twilio::Values.of({'Token' => token, })
124
212
 
@@ -173,6 +261,7 @@ module Twilio
173
261
  'category' => payload['category'],
174
262
  'answer_set_id' => payload['answer_set_id'],
175
263
  'allow_na' => payload['allow_na'],
264
+ 'usage' => payload['usage'] == nil ? payload['usage'] : payload['usage'].to_i,
176
265
  'url' => payload['url'],
177
266
  }
178
267
 
@@ -234,6 +323,12 @@ module Twilio
234
323
  @properties['allow_na']
235
324
  end
236
325
 
326
+ ##
327
+ # @return [String] Questions usage
328
+ def usage
329
+ @properties['usage']
330
+ end
331
+
237
332
  ##
238
333
  # @return [String] The url
239
334
  def url
@@ -242,20 +337,20 @@ module Twilio
242
337
 
243
338
  ##
244
339
  # Update the InsightsQuestionnairesQuestionInstance
340
+ # @param [Boolean] allow_na The flag to enable for disable NA for answer.
341
+ # @param [String] category_id The ID of the category
245
342
  # @param [String] question The question.
246
343
  # @param [String] description The description for the question.
247
344
  # @param [String] answer_set_id The answer_set for the question.
248
- # @param [Boolean] allow_na The flag to enable for disable NA for answer.
249
- # @param [String] category_id The ID of the category
250
345
  # @param [String] token The Token HTTP request header
251
346
  # @return [InsightsQuestionnairesQuestionInstance] Updated InsightsQuestionnairesQuestionInstance
252
- def update(question: nil, description: nil, answer_set_id: nil, allow_na: nil, category_id: :unset, token: :unset)
347
+ def update(allow_na: nil, category_id: :unset, question: :unset, description: :unset, answer_set_id: :unset, token: :unset)
253
348
  context.update(
349
+ allow_na: allow_na,
350
+ category_id: category_id,
254
351
  question: question,
255
352
  description: description,
256
353
  answer_set_id: answer_set_id,
257
- allow_na: allow_na,
258
- category_id: category_id,
259
354
  token: token,
260
355
  )
261
356
  end