twilio-ruby 5.11.2 → 5.12.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +20 -0
  3. data/Makefile +2 -0
  4. data/README.md +2 -2
  5. data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +13 -6
  6. data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +10 -4
  7. data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +18 -6
  8. data/lib/twilio-ruby/rest/chat/v2/service/user.rb +7 -3
  9. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +13 -6
  10. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +10 -4
  11. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +18 -6
  12. data/lib/twilio-ruby/rest/ip_messaging/v2/service/user.rb +7 -3
  13. data/lib/twilio-ruby/rest/notify/v1/service.rb +0 -46
  14. data/lib/twilio-ruby/rest/preview.rb +13 -20
  15. data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
  16. data/lib/twilio-ruby/rest/preview/understand/assistant/intent.rb +16 -0
  17. data/lib/twilio-ruby/rest/preview/understand/assistant/intent/intent_statistics.rb +226 -0
  18. data/lib/twilio-ruby/rest/studio/v1/flow/execution.rb +1 -1
  19. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +102 -50
  20. data/lib/twilio-ruby/rest/video.rb +9 -9
  21. data/lib/twilio-ruby/rest/video/v1.rb +16 -16
  22. data/lib/twilio-ruby/twiml/voice_response.rb +42 -0
  23. data/lib/twilio-ruby/version.rb +1 -1
  24. data/spec/integration/chat/v2/service/channel/message_spec.rb +1 -1
  25. data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +1 -1
  26. data/spec/integration/preview/understand/assistant/intent/intent_statistics_spec.rb +50 -0
  27. data/spec/integration/preview/understand/assistant/intent_spec.rb +8 -4
  28. data/spec/integration/taskrouter/v1/workspace/task/reservation_spec.rb +31 -0
  29. metadata +6 -37
  30. data/lib/twilio-ruby/rest/notify/v1/service/segment.rb +0 -225
  31. data/lib/twilio-ruby/rest/notify/v1/service/user.rb +0 -438
  32. data/lib/twilio-ruby/rest/notify/v1/service/user/segment_memberships.rb +0 -262
  33. data/lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb +0 -438
  34. data/lib/twilio-ruby/rest/preview/proxy.rb +0 -43
  35. data/lib/twilio-ruby/rest/preview/proxy/service.rb +0 -464
  36. data/lib/twilio-ruby/rest/preview/proxy/service/phone_number.rb +0 -347
  37. data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +0 -497
  38. data/lib/twilio-ruby/rest/preview/proxy/service/session/interaction.rb +0 -437
  39. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant.rb +0 -514
  40. data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +0 -455
  41. data/lib/twilio-ruby/rest/preview/proxy/service/short_code.rb +0 -342
  42. data/spec/integration/notify/v1/service/segment_spec.rb +0 -86
  43. data/spec/integration/notify/v1/service/user/segment_memberships_spec.rb +0 -118
  44. data/spec/integration/notify/v1/service/user/user_binding_spec.rb +0 -268
  45. data/spec/integration/notify/v1/service/user_spec.rb +0 -213
  46. data/spec/integration/preview/proxy/service/phone_number_spec.rb +0 -173
  47. data/spec/integration/preview/proxy/service/session/interaction_spec.rb +0 -106
  48. data/spec/integration/preview/proxy/service/session/participant/message_interaction_spec.rb +0 -166
  49. data/spec/integration/preview/proxy/service/session/participant_spec.rb +0 -226
  50. data/spec/integration/preview/proxy/service/session_spec.rb +0 -218
  51. data/spec/integration/preview/proxy/service/short_code_spec.rb +0 -173
  52. data/spec/integration/preview/proxy/service_spec.rb +0 -202
@@ -1,464 +0,0 @@
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 Preview < Domain
12
- class Proxy < 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 ServiceList < ListResource
16
- ##
17
- # Initialize the ServiceList
18
- # @param [Version] version Version that contains the resource
19
- # @return [ServiceList] ServiceList
20
- def initialize(version)
21
- super(version)
22
-
23
- # Path Solution
24
- @solution = {}
25
- @uri = "/Services"
26
- end
27
-
28
- ##
29
- # Lists ServiceInstance 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 [Integer] limit Upper limit for the number of records to return. stream()
33
- # guarantees to never return more than limit. Default is no limit
34
- # @param [Integer] page_size Number of records to fetch per request, when
35
- # not set will use the default value of 50 records. If no page_size is defined
36
- # but a limit is defined, stream() will attempt to read the limit with the most
37
- # efficient page size, i.e. min(limit, 1000)
38
- # @return [Array] Array of up to limit results
39
- def list(limit: nil, page_size: nil)
40
- self.stream(limit: limit, page_size: page_size).entries
41
- end
42
-
43
- ##
44
- # Streams ServiceInstance records from the API as an Enumerable.
45
- # This operation lazily loads records as efficiently as possible until the limit
46
- # is reached.
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 [Enumerable] Enumerable that will yield up to limit results
54
- def stream(limit: nil, page_size: nil)
55
- limits = @version.read_limits(limit, page_size)
56
-
57
- page = self.page(page_size: limits[:page_size], )
58
-
59
- @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
60
- end
61
-
62
- ##
63
- # When passed a block, yields ServiceInstance records from the API.
64
- # This operation lazily loads records as efficiently as possible until the limit
65
- # is reached.
66
- def each
67
- limits = @version.read_limits
68
-
69
- page = self.page(page_size: limits[:page_size], )
70
-
71
- @version.stream(page,
72
- limit: limits[:limit],
73
- page_limit: limits[:page_limit]).each {|x| yield x}
74
- end
75
-
76
- ##
77
- # Retrieve a single page of ServiceInstance records from the API.
78
- # Request is executed immediately.
79
- # @param [String] page_token PageToken provided by the API
80
- # @param [Integer] page_number Page Number, this value is simply for client state
81
- # @param [Integer] page_size Number of records to return, defaults to 50
82
- # @return [Page] Page of ServiceInstance
83
- def page(page_token: :unset, page_number: :unset, page_size: :unset)
84
- params = Twilio::Values.of({
85
- 'PageToken' => page_token,
86
- 'Page' => page_number,
87
- 'PageSize' => page_size,
88
- })
89
- response = @version.page(
90
- 'GET',
91
- @uri,
92
- params
93
- )
94
- ServicePage.new(@version, response, @solution)
95
- end
96
-
97
- ##
98
- # Retrieve a single page of ServiceInstance records from the API.
99
- # Request is executed immediately.
100
- # @param [String] target_url API-generated URL for the requested results page
101
- # @return [Page] Page of ServiceInstance
102
- def get_page(target_url)
103
- response = @version.domain.request(
104
- 'GET',
105
- target_url
106
- )
107
- ServicePage.new(@version, response, @solution)
108
- end
109
-
110
- ##
111
- # Retrieve a single page of ServiceInstance records from the API.
112
- # Request is executed immediately.
113
- # @param [String] friendly_name A human readable description of this resource, up
114
- # to 64 characters.
115
- # @param [Boolean] auto_create Boolean flag specifying whether to create threads
116
- # when a user communticates out of band.
117
- # @param [String] callback_url The URL Twilio will request for callback
118
- # notifications.
119
- # @return [ServiceInstance] Newly created ServiceInstance
120
- def create(friendly_name: :unset, auto_create: :unset, callback_url: :unset)
121
- data = Twilio::Values.of({
122
- 'FriendlyName' => friendly_name,
123
- 'AutoCreate' => auto_create,
124
- 'CallbackUrl' => callback_url,
125
- })
126
-
127
- payload = @version.create(
128
- 'POST',
129
- @uri,
130
- data: data
131
- )
132
-
133
- ServiceInstance.new(@version, payload, )
134
- end
135
-
136
- ##
137
- # Provide a user friendly representation
138
- def to_s
139
- '#<Twilio.Preview.Proxy.ServiceList>'
140
- end
141
- end
142
-
143
- ##
144
- # 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.
145
- class ServicePage < Page
146
- ##
147
- # Initialize the ServicePage
148
- # @param [Version] version Version that contains the resource
149
- # @param [Response] response Response from the API
150
- # @param [Hash] solution Path solution for the resource
151
- # @return [ServicePage] ServicePage
152
- def initialize(version, response, solution)
153
- super(version, response)
154
-
155
- # Path Solution
156
- @solution = solution
157
- end
158
-
159
- ##
160
- # Build an instance of ServiceInstance
161
- # @param [Hash] payload Payload response from the API
162
- # @return [ServiceInstance] ServiceInstance
163
- def get_instance(payload)
164
- ServiceInstance.new(@version, payload, )
165
- end
166
-
167
- ##
168
- # Provide a user friendly representation
169
- def to_s
170
- '<Twilio.Preview.Proxy.ServicePage>'
171
- end
172
- end
173
-
174
- ##
175
- # 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.
176
- class ServiceContext < InstanceContext
177
- ##
178
- # Initialize the ServiceContext
179
- # @param [Version] version Version that contains the resource
180
- # @param [String] sid A 34 character string that uniquely identifies this Service.
181
- # @return [ServiceContext] ServiceContext
182
- def initialize(version, sid)
183
- super(version)
184
-
185
- # Path Solution
186
- @solution = {sid: sid, }
187
- @uri = "/Services/#{@solution[:sid]}"
188
-
189
- # Dependents
190
- @sessions = nil
191
- @phone_numbers = nil
192
- @short_codes = nil
193
- end
194
-
195
- ##
196
- # Fetch a ServiceInstance
197
- # @return [ServiceInstance] Fetched ServiceInstance
198
- def fetch
199
- params = Twilio::Values.of({})
200
-
201
- payload = @version.fetch(
202
- 'GET',
203
- @uri,
204
- params,
205
- )
206
-
207
- ServiceInstance.new(@version, payload, sid: @solution[:sid], )
208
- end
209
-
210
- ##
211
- # Deletes the ServiceInstance
212
- # @return [Boolean] true if delete succeeds, true otherwise
213
- def delete
214
- @version.delete('delete', @uri)
215
- end
216
-
217
- ##
218
- # Update the ServiceInstance
219
- # @param [String] friendly_name A human readable description of this resource, up
220
- # to 64 characters.
221
- # @param [Boolean] auto_create Boolean flag specifying whether to create threads
222
- # when a user communticates out of band.
223
- # @param [String] callback_url The URL Twilio will request for callback
224
- # notifications.
225
- # @return [ServiceInstance] Updated ServiceInstance
226
- def update(friendly_name: :unset, auto_create: :unset, callback_url: :unset)
227
- data = Twilio::Values.of({
228
- 'FriendlyName' => friendly_name,
229
- 'AutoCreate' => auto_create,
230
- 'CallbackUrl' => callback_url,
231
- })
232
-
233
- payload = @version.update(
234
- 'POST',
235
- @uri,
236
- data: data,
237
- )
238
-
239
- ServiceInstance.new(@version, payload, sid: @solution[:sid], )
240
- end
241
-
242
- ##
243
- # Access the sessions
244
- # @return [SessionList]
245
- # @return [SessionContext] if sid was passed.
246
- def sessions(sid=:unset)
247
- raise ArgumentError, 'sid cannot be nil' if sid.nil?
248
-
249
- if sid != :unset
250
- return SessionContext.new(@version, @solution[:sid], sid, )
251
- end
252
-
253
- unless @sessions
254
- @sessions = SessionList.new(@version, service_sid: @solution[:sid], )
255
- end
256
-
257
- @sessions
258
- end
259
-
260
- ##
261
- # Access the phone_numbers
262
- # @return [PhoneNumberList]
263
- # @return [PhoneNumberContext] if sid was passed.
264
- def phone_numbers(sid=:unset)
265
- raise ArgumentError, 'sid cannot be nil' if sid.nil?
266
-
267
- if sid != :unset
268
- return PhoneNumberContext.new(@version, @solution[:sid], sid, )
269
- end
270
-
271
- unless @phone_numbers
272
- @phone_numbers = PhoneNumberList.new(@version, service_sid: @solution[:sid], )
273
- end
274
-
275
- @phone_numbers
276
- end
277
-
278
- ##
279
- # Access the short_codes
280
- # @return [ShortCodeList]
281
- # @return [ShortCodeContext] if sid was passed.
282
- def short_codes(sid=:unset)
283
- raise ArgumentError, 'sid cannot be nil' if sid.nil?
284
-
285
- if sid != :unset
286
- return ShortCodeContext.new(@version, @solution[:sid], sid, )
287
- end
288
-
289
- unless @short_codes
290
- @short_codes = ShortCodeList.new(@version, service_sid: @solution[:sid], )
291
- end
292
-
293
- @short_codes
294
- end
295
-
296
- ##
297
- # Provide a user friendly representation
298
- def to_s
299
- context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
300
- "#<Twilio.Preview.Proxy.ServiceContext #{context}>"
301
- end
302
- end
303
-
304
- ##
305
- # 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.
306
- class ServiceInstance < InstanceResource
307
- ##
308
- # Initialize the ServiceInstance
309
- # @param [Version] version Version that contains the resource
310
- # @param [Hash] payload payload that contains response from Twilio
311
- # @param [String] sid A 34 character string that uniquely identifies this Service.
312
- # @return [ServiceInstance] ServiceInstance
313
- def initialize(version, payload, sid: nil)
314
- super(version)
315
-
316
- # Marshaled Properties
317
- @properties = {
318
- 'sid' => payload['sid'],
319
- 'friendly_name' => payload['friendly_name'],
320
- 'account_sid' => payload['account_sid'],
321
- 'auto_create' => payload['auto_create'],
322
- 'callback_url' => payload['callback_url'],
323
- 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
324
- 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
325
- 'url' => payload['url'],
326
- 'links' => payload['links'],
327
- }
328
-
329
- # Context
330
- @instance_context = nil
331
- @params = {'sid' => sid || @properties['sid'], }
332
- end
333
-
334
- ##
335
- # Generate an instance context for the instance, the context is capable of
336
- # performing various actions. All instance actions are proxied to the context
337
- # @return [ServiceContext] ServiceContext for this ServiceInstance
338
- def context
339
- unless @instance_context
340
- @instance_context = ServiceContext.new(@version, @params['sid'], )
341
- end
342
- @instance_context
343
- end
344
-
345
- ##
346
- # @return [String] A string that uniquely identifies this Service.
347
- def sid
348
- @properties['sid']
349
- end
350
-
351
- ##
352
- # @return [String] A human readable description of this resource
353
- def friendly_name
354
- @properties['friendly_name']
355
- end
356
-
357
- ##
358
- # @return [String] Account Sid.
359
- def account_sid
360
- @properties['account_sid']
361
- end
362
-
363
- ##
364
- # @return [Boolean] Boolean flag specifying whether to auto-create threads.
365
- def auto_create
366
- @properties['auto_create']
367
- end
368
-
369
- ##
370
- # @return [String] URL Twilio will request for callbacks.
371
- def callback_url
372
- @properties['callback_url']
373
- end
374
-
375
- ##
376
- # @return [Time] The date this Service was created
377
- def date_created
378
- @properties['date_created']
379
- end
380
-
381
- ##
382
- # @return [Time] The date this Service was updated
383
- def date_updated
384
- @properties['date_updated']
385
- end
386
-
387
- ##
388
- # @return [String] The URL of this resource.
389
- def url
390
- @properties['url']
391
- end
392
-
393
- ##
394
- # @return [String] Nested resource URLs.
395
- def links
396
- @properties['links']
397
- end
398
-
399
- ##
400
- # Fetch a ServiceInstance
401
- # @return [ServiceInstance] Fetched ServiceInstance
402
- def fetch
403
- context.fetch
404
- end
405
-
406
- ##
407
- # Deletes the ServiceInstance
408
- # @return [Boolean] true if delete succeeds, true otherwise
409
- def delete
410
- context.delete
411
- end
412
-
413
- ##
414
- # Update the ServiceInstance
415
- # @param [String] friendly_name A human readable description of this resource, up
416
- # to 64 characters.
417
- # @param [Boolean] auto_create Boolean flag specifying whether to create threads
418
- # when a user communticates out of band.
419
- # @param [String] callback_url The URL Twilio will request for callback
420
- # notifications.
421
- # @return [ServiceInstance] Updated ServiceInstance
422
- def update(friendly_name: :unset, auto_create: :unset, callback_url: :unset)
423
- context.update(friendly_name: friendly_name, auto_create: auto_create, callback_url: callback_url, )
424
- end
425
-
426
- ##
427
- # Access the sessions
428
- # @return [sessions] sessions
429
- def sessions
430
- context.sessions
431
- end
432
-
433
- ##
434
- # Access the phone_numbers
435
- # @return [phone_numbers] phone_numbers
436
- def phone_numbers
437
- context.phone_numbers
438
- end
439
-
440
- ##
441
- # Access the short_codes
442
- # @return [short_codes] short_codes
443
- def short_codes
444
- context.short_codes
445
- end
446
-
447
- ##
448
- # Provide a user friendly representation
449
- def to_s
450
- values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
451
- "<Twilio.Preview.Proxy.ServiceInstance #{values}>"
452
- end
453
-
454
- ##
455
- # Provide a detailed, user friendly representation
456
- def inspect
457
- values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
458
- "<Twilio.Preview.Proxy.ServiceInstance #{values}>"
459
- end
460
- end
461
- end
462
- end
463
- end
464
- end