twilio-ruby 5.4.3 → 5.4.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +12 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/framework/serialize.rb +9 -0
  5. data/lib/twilio-ruby/http/http_client.rb +1 -1
  6. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +1 -1
  7. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +8 -2
  8. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +2 -2
  9. data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +1 -1
  10. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +1 -1
  11. data/lib/twilio-ruby/rest/chat/v1/service.rb +1 -1
  12. data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +1 -1
  13. data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +1 -1
  14. data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +1 -1
  15. data/lib/twilio-ruby/rest/chat/v1/service/role.rb +2 -2
  16. data/lib/twilio-ruby/rest/chat/v2/service.rb +1 -1
  17. data/lib/twilio-ruby/rest/chat/v2/service/binding.rb +2 -2
  18. data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +1 -1
  19. data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +1 -1
  20. data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +1 -1
  21. data/lib/twilio-ruby/rest/chat/v2/service/role.rb +2 -2
  22. data/lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb +1 -1
  23. data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +1 -1
  24. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +1 -1
  25. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +1 -1
  26. data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +1 -1
  27. data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +2 -2
  28. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +1 -1
  29. data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +2 -2
  30. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +1 -1
  31. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +1 -1
  32. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +1 -1
  33. data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +2 -2
  34. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +1 -1
  35. data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +5 -1
  36. data/lib/twilio-ruby/rest/notify/v1/service/binding.rb +3 -3
  37. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +4 -4
  38. data/lib/twilio-ruby/rest/notify/v1/service/user.rb +5 -2
  39. data/lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb +2 -2
  40. data/lib/twilio-ruby/rest/preview.rb +10 -3
  41. data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +4 -4
  42. data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +2 -2
  43. data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +2 -2
  44. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +1 -1
  45. data/lib/twilio-ruby/rest/preview/understand.rb +41 -0
  46. data/lib/twilio-ruby/rest/preview/understand/service.rb +503 -0
  47. data/lib/twilio-ruby/rest/preview/understand/service/field_type.rb +399 -0
  48. data/lib/twilio-ruby/rest/preview/understand/service/field_type/field_value.rb +375 -0
  49. data/lib/twilio-ruby/rest/preview/understand/service/intent.rb +421 -0
  50. data/lib/twilio-ruby/rest/preview/understand/service/intent/field.rb +371 -0
  51. data/lib/twilio-ruby/rest/preview/understand/service/intent/sample.rb +407 -0
  52. data/lib/twilio-ruby/rest/preview/understand/service/model_build.rb +358 -0
  53. data/lib/twilio-ruby/rest/preview/understand/service/query.rb +422 -0
  54. data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +1 -1
  55. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +2 -2
  56. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +1 -1
  57. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +1 -1
  58. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +3 -3
  59. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +3 -3
  60. data/lib/twilio-ruby/rest/video/v1/recording.rb +1 -1
  61. data/lib/twilio-ruby/rest/video/v1/room.rb +27 -1
  62. data/lib/twilio-ruby/rest/video/v1/room/room_participant.rb +407 -0
  63. data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_published_track.rb +326 -0
  64. data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +1 -1
  65. data/lib/twilio-ruby/version.rb +1 -1
  66. data/spec/framework/serialize_spec.rb +21 -0
  67. data/spec/integration/chat/v1/service/role_spec.rb +6 -2
  68. data/spec/integration/chat/v2/service/role_spec.rb +6 -2
  69. data/spec/integration/ip_messaging/v1/service/role_spec.rb +6 -2
  70. data/spec/integration/ip_messaging/v2/service/role_spec.rb +6 -2
  71. data/spec/integration/preview/hosted_numbers/authorization_document_spec.rb +1 -1
  72. data/spec/integration/preview/understand/service/field_type/field_value_spec.rb +205 -0
  73. data/spec/integration/preview/understand/service/field_type_spec.rb +244 -0
  74. data/spec/integration/preview/understand/service/intent/field_spec.rb +205 -0
  75. data/spec/integration/preview/understand/service/intent/sample_spec.rb +247 -0
  76. data/spec/integration/preview/understand/service/intent_spec.rb +252 -0
  77. data/spec/integration/preview/understand/service/model_build_spec.rb +231 -0
  78. data/spec/integration/preview/understand/service/query_spec.rb +300 -0
  79. data/spec/integration/preview/understand/service_spec.rb +256 -0
  80. data/spec/integration/video/v1/room/room_participant/room_participant_published_track_spec.rb +94 -0
  81. data/spec/integration/video/v1/room/room_participant_spec.rb +182 -0
  82. data/spec/integration/video/v1/room_spec.rb +4 -0
  83. metadata +33 -2
@@ -0,0 +1,422 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Preview < Domain
10
+ class Understand < Version
11
+ class ServiceContext < InstanceContext
12
+ ##
13
+ # 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.
14
+ class QueryList < ListResource
15
+ ##
16
+ # Initialize the QueryList
17
+ # @param [Version] version Version that contains the resource
18
+ # @param [String] service_sid The service_sid
19
+ # @return [QueryList] QueryList
20
+ def initialize(version, service_sid: nil)
21
+ super(version)
22
+
23
+ # Path Solution
24
+ @solution = {service_sid: service_sid}
25
+ @uri = "/Services/#{@solution[:service_sid]}/Queries"
26
+ end
27
+
28
+ ##
29
+ # Lists QueryInstance records from the API as a list.
30
+ # Unlike stream(), this operation is eager and will load `limit` records into
31
+ # memory before returning.
32
+ # @param [String] language The language
33
+ # @param [String] model_build The model_build
34
+ # @param [String] status The status
35
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
36
+ # guarantees to never return more than limit. Default is no limit
37
+ # @param [Integer] page_size Number of records to fetch per request, when
38
+ # not set will use the default value of 50 records. If no page_size is defined
39
+ # but a limit is defined, stream() will attempt to read the limit with the most
40
+ # efficient page size, i.e. min(limit, 1000)
41
+ # @return [Array] Array of up to limit results
42
+ def list(language: :unset, model_build: :unset, status: :unset, limit: nil, page_size: nil)
43
+ self.stream(
44
+ language: language,
45
+ model_build: model_build,
46
+ status: status,
47
+ limit: limit,
48
+ page_size: page_size
49
+ ).entries
50
+ end
51
+
52
+ ##
53
+ # Streams QueryInstance records from the API as an Enumerable.
54
+ # This operation lazily loads records as efficiently as possible until the limit
55
+ # is reached.
56
+ # @param [String] language The language
57
+ # @param [String] model_build The model_build
58
+ # @param [String] status The status
59
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
60
+ # guarantees to never return more than limit. Default is no limit.
61
+ # @param [Integer] page_size Number of records to fetch per request, when
62
+ # not set will use the default value of 50 records. If no page_size is defined
63
+ # but a limit is defined, stream() will attempt to read the limit with the most
64
+ # efficient page size, i.e. min(limit, 1000)
65
+ # @return [Enumerable] Enumerable that will yield up to limit results
66
+ def stream(language: :unset, model_build: :unset, status: :unset, limit: nil, page_size: nil)
67
+ limits = @version.read_limits(limit, page_size)
68
+
69
+ page = self.page(
70
+ language: language,
71
+ model_build: model_build,
72
+ status: status,
73
+ page_size: limits[:page_size],
74
+ )
75
+
76
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
77
+ end
78
+
79
+ ##
80
+ # When passed a block, yields QueryInstance records from the API.
81
+ # This operation lazily loads records as efficiently as possible until the limit
82
+ # is reached.
83
+ def each
84
+ limits = @version.read_limits
85
+
86
+ page = self.page(page_size: limits[:page_size],)
87
+
88
+ @version.stream(page,
89
+ limit: limits[:limit],
90
+ page_limit: limits[:page_limit]).each {|x| yield x}
91
+ end
92
+
93
+ ##
94
+ # Retrieve a single page of QueryInstance records from the API.
95
+ # Request is executed immediately.
96
+ # @param [String] language The language
97
+ # @param [String] model_build The model_build
98
+ # @param [String] status The status
99
+ # @param [String] page_token PageToken provided by the API
100
+ # @param [Integer] page_number Page Number, this value is simply for client state
101
+ # @param [Integer] page_size Number of records to return, defaults to 50
102
+ # @return [Page] Page of QueryInstance
103
+ def page(language: :unset, model_build: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
104
+ params = Twilio::Values.of({
105
+ 'Language' => language,
106
+ 'ModelBuild' => model_build,
107
+ 'Status' => status,
108
+ 'PageToken' => page_token,
109
+ 'Page' => page_number,
110
+ 'PageSize' => page_size,
111
+ })
112
+ response = @version.page(
113
+ 'GET',
114
+ @uri,
115
+ params
116
+ )
117
+ QueryPage.new(@version, response, @solution)
118
+ end
119
+
120
+ ##
121
+ # Retrieve a single page of QueryInstance records from the API.
122
+ # Request is executed immediately.
123
+ # @param [String] target_url API-generated URL for the requested results page
124
+ # @return [Page] Page of QueryInstance
125
+ def get_page(target_url)
126
+ response = @version.domain.request(
127
+ 'GET',
128
+ target_url
129
+ )
130
+ QueryPage.new(@version, response, @solution)
131
+ end
132
+
133
+ ##
134
+ # Retrieve a single page of QueryInstance records from the API.
135
+ # Request is executed immediately.
136
+ # @param [String] language The language
137
+ # @param [String] query The query
138
+ # @param [String] intent The intent
139
+ # @param [String] model_build The model_build
140
+ # @param [String] field The field
141
+ # @param [String] named_entity The named_entity
142
+ # @return [QueryInstance] Newly created QueryInstance
143
+ def create(language: nil, query: nil, intent: :unset, model_build: :unset, field: :unset, named_entity: :unset)
144
+ data = Twilio::Values.of({
145
+ 'Language' => language,
146
+ 'Query' => query,
147
+ 'Intent' => intent,
148
+ 'ModelBuild' => model_build,
149
+ 'Field' => field,
150
+ 'NamedEntity' => named_entity,
151
+ })
152
+
153
+ payload = @version.create(
154
+ 'POST',
155
+ @uri,
156
+ data: data
157
+ )
158
+
159
+ QueryInstance.new(@version, payload, service_sid: @solution[:service_sid],)
160
+ end
161
+
162
+ ##
163
+ # Provide a user friendly representation
164
+ def to_s
165
+ '#<Twilio.Preview.Understand.QueryList>'
166
+ end
167
+ end
168
+
169
+ ##
170
+ # 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.
171
+ class QueryPage < Page
172
+ ##
173
+ # Initialize the QueryPage
174
+ # @param [Version] version Version that contains the resource
175
+ # @param [Response] response Response from the API
176
+ # @param [Hash] solution Path solution for the resource
177
+ # @return [QueryPage] QueryPage
178
+ def initialize(version, response, solution)
179
+ super(version, response)
180
+
181
+ # Path Solution
182
+ @solution = solution
183
+ end
184
+
185
+ ##
186
+ # Build an instance of QueryInstance
187
+ # @param [Hash] payload Payload response from the API
188
+ # @return [QueryInstance] QueryInstance
189
+ def get_instance(payload)
190
+ QueryInstance.new(@version, payload, service_sid: @solution[:service_sid],)
191
+ end
192
+
193
+ ##
194
+ # Provide a user friendly representation
195
+ def to_s
196
+ '<Twilio.Preview.Understand.QueryPage>'
197
+ end
198
+ end
199
+
200
+ ##
201
+ # 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.
202
+ class QueryContext < InstanceContext
203
+ ##
204
+ # Initialize the QueryContext
205
+ # @param [Version] version Version that contains the resource
206
+ # @param [String] service_sid The service_sid
207
+ # @param [String] sid The sid
208
+ # @return [QueryContext] QueryContext
209
+ def initialize(version, service_sid, sid)
210
+ super(version)
211
+
212
+ # Path Solution
213
+ @solution = {service_sid: service_sid, sid: sid,}
214
+ @uri = "/Services/#{@solution[:service_sid]}/Queries/#{@solution[:sid]}"
215
+ end
216
+
217
+ ##
218
+ # Fetch a QueryInstance
219
+ # @return [QueryInstance] Fetched QueryInstance
220
+ def fetch
221
+ params = Twilio::Values.of({})
222
+
223
+ payload = @version.fetch(
224
+ 'GET',
225
+ @uri,
226
+ params,
227
+ )
228
+
229
+ QueryInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid],)
230
+ end
231
+
232
+ ##
233
+ # Update the QueryInstance
234
+ # @param [String] sample_sid The sample_sid
235
+ # @param [String] status The status
236
+ # @return [QueryInstance] Updated QueryInstance
237
+ def update(sample_sid: :unset, status: :unset)
238
+ data = Twilio::Values.of({'SampleSid' => sample_sid, 'Status' => status,})
239
+
240
+ payload = @version.update(
241
+ 'POST',
242
+ @uri,
243
+ data: data,
244
+ )
245
+
246
+ QueryInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid],)
247
+ end
248
+
249
+ ##
250
+ # Deletes the QueryInstance
251
+ # @return [Boolean] true if delete succeeds, true otherwise
252
+ def delete
253
+ @version.delete('delete', @uri)
254
+ end
255
+
256
+ ##
257
+ # Provide a user friendly representation
258
+ def to_s
259
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
260
+ "#<Twilio.Preview.Understand.QueryContext #{context}>"
261
+ end
262
+ end
263
+
264
+ ##
265
+ # 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.
266
+ class QueryInstance < InstanceResource
267
+ ##
268
+ # Initialize the QueryInstance
269
+ # @param [Version] version Version that contains the resource
270
+ # @param [Hash] payload payload that contains response from Twilio
271
+ # @param [String] service_sid The service_sid
272
+ # @param [String] sid The sid
273
+ # @return [QueryInstance] QueryInstance
274
+ def initialize(version, payload, service_sid: nil, sid: nil)
275
+ super(version)
276
+
277
+ # Marshaled Properties
278
+ @properties = {
279
+ 'account_sid' => payload['account_sid'],
280
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
281
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
282
+ 'results' => payload['results'],
283
+ 'language' => payload['language'],
284
+ 'model_build_sid' => payload['model_build_sid'],
285
+ 'query' => payload['query'],
286
+ 'sample_sid' => payload['sample_sid'],
287
+ 'service_sid' => payload['service_sid'],
288
+ 'sid' => payload['sid'],
289
+ 'status' => payload['status'],
290
+ 'url' => payload['url'],
291
+ }
292
+
293
+ # Context
294
+ @instance_context = nil
295
+ @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'],}
296
+ end
297
+
298
+ ##
299
+ # Generate an instance context for the instance, the context is capable of
300
+ # performing various actions. All instance actions are proxied to the context
301
+ # @return [QueryContext] QueryContext for this QueryInstance
302
+ def context
303
+ unless @instance_context
304
+ @instance_context = QueryContext.new(@version, @params['service_sid'], @params['sid'],)
305
+ end
306
+ @instance_context
307
+ end
308
+
309
+ ##
310
+ # @return [String] The account_sid
311
+ def account_sid
312
+ @properties['account_sid']
313
+ end
314
+
315
+ ##
316
+ # @return [Time] The date_created
317
+ def date_created
318
+ @properties['date_created']
319
+ end
320
+
321
+ ##
322
+ # @return [Time] The date_updated
323
+ def date_updated
324
+ @properties['date_updated']
325
+ end
326
+
327
+ ##
328
+ # @return [Hash] The results
329
+ def results
330
+ @properties['results']
331
+ end
332
+
333
+ ##
334
+ # @return [String] The language
335
+ def language
336
+ @properties['language']
337
+ end
338
+
339
+ ##
340
+ # @return [String] The model_build_sid
341
+ def model_build_sid
342
+ @properties['model_build_sid']
343
+ end
344
+
345
+ ##
346
+ # @return [String] The query
347
+ def query
348
+ @properties['query']
349
+ end
350
+
351
+ ##
352
+ # @return [String] The sample_sid
353
+ def sample_sid
354
+ @properties['sample_sid']
355
+ end
356
+
357
+ ##
358
+ # @return [String] The service_sid
359
+ def service_sid
360
+ @properties['service_sid']
361
+ end
362
+
363
+ ##
364
+ # @return [String] The sid
365
+ def sid
366
+ @properties['sid']
367
+ end
368
+
369
+ ##
370
+ # @return [String] The status
371
+ def status
372
+ @properties['status']
373
+ end
374
+
375
+ ##
376
+ # @return [String] The url
377
+ def url
378
+ @properties['url']
379
+ end
380
+
381
+ ##
382
+ # Fetch a QueryInstance
383
+ # @return [QueryInstance] Fetched QueryInstance
384
+ def fetch
385
+ context.fetch
386
+ end
387
+
388
+ ##
389
+ # Update the QueryInstance
390
+ # @param [String] sample_sid The sample_sid
391
+ # @param [String] status The status
392
+ # @return [QueryInstance] Updated QueryInstance
393
+ def update(sample_sid: :unset, status: :unset)
394
+ context.update(sample_sid: sample_sid, status: status,)
395
+ end
396
+
397
+ ##
398
+ # Deletes the QueryInstance
399
+ # @return [Boolean] true if delete succeeds, true otherwise
400
+ def delete
401
+ context.delete
402
+ end
403
+
404
+ ##
405
+ # Provide a user friendly representation
406
+ def to_s
407
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
408
+ "<Twilio.Preview.Understand.QueryInstance #{values}>"
409
+ end
410
+
411
+ ##
412
+ # Provide a detailed, user friendly representation
413
+ def inspect
414
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
415
+ "<Twilio.Preview.Understand.QueryInstance #{values}>"
416
+ end
417
+ end
418
+ end
419
+ end
420
+ end
421
+ end
422
+ end
@@ -130,7 +130,7 @@ module Twilio
130
130
  'VoiceEnabled' => voice_enabled,
131
131
  'CommandsEnabled' => commands_enabled,
132
132
  'NationalRoamingEnabled' => national_roaming_enabled,
133
- 'InternationalRoaming' => international_roaming,
133
+ 'InternationalRoaming' => Twilio.serialize_list(international_roaming) { |e| e },
134
134
  })
135
135
 
136
136
  payload = @version.create(
@@ -143,7 +143,7 @@ module Twilio
143
143
  'DateExpiry' => Twilio.serialize_iso8601_datetime(date_expiry),
144
144
  'Ttl' => ttl,
145
145
  'Status' => status,
146
- 'Participants' => participants,
146
+ 'Participants' => Twilio.serialize_list(participants) { |e| e },
147
147
  })
148
148
 
149
149
  payload = @version.create(
@@ -254,7 +254,7 @@ module Twilio
254
254
  'DateExpiry' => Twilio.serialize_iso8601_datetime(date_expiry),
255
255
  'Ttl' => ttl,
256
256
  'Status' => status,
257
- 'Participants' => participants,
257
+ 'Participants' => Twilio.serialize_list(participants) { |e| e },
258
258
  })
259
259
 
260
260
  payload = @version.update(
@@ -36,7 +36,7 @@ module Twilio
36
36
  # @param [String] media_url The media_url
37
37
  # @return [MessageInteractionInstance] Newly created MessageInteractionInstance
38
38
  def create(body: :unset, media_url: :unset)
39
- data = Twilio::Values.of({'Body' => body, 'MediaUrl' => media_url,})
39
+ data = Twilio::Values.of({'Body' => body, 'MediaUrl' => Twilio.serialize_list(media_url) { |e| e },})
40
40
 
41
41
  payload = @version.create(
42
42
  'POST',