twilio-ruby 5.35.0 → 5.36.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +28 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +87 -87
  5. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +14 -0
  6. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +71 -71
  7. data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +29 -29
  8. data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +27 -4
  9. data/lib/twilio-ruby/rest/flex_api/v1/channel.rb +2 -1
  10. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +7 -0
  11. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +6 -3
  12. data/lib/twilio-ruby/rest/preview/trusted_comms/business.rb +26 -0
  13. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand.rb +239 -0
  14. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel.rb +266 -0
  15. data/lib/twilio-ruby/rest/preview/trusted_comms/business/brand/branded_channel/channel.rb +197 -0
  16. data/lib/twilio-ruby/rest/serverless/v1/service/environment/log.rb +7 -0
  17. data/lib/twilio-ruby/rest/supersim.rb +11 -1
  18. data/lib/twilio-ruby/rest/supersim/v1.rb +16 -1
  19. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +10 -1
  20. data/lib/twilio-ruby/rest/supersim/v1/network.rb +315 -0
  21. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +53 -12
  22. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb +352 -0
  23. data/lib/twilio-ruby/rest/verify.rb +9 -0
  24. data/lib/twilio-ruby/rest/verify/v2.rb +16 -0
  25. data/lib/twilio-ruby/rest/verify/v2/form.rb +197 -0
  26. data/lib/twilio-ruby/rest/verify/v2/service.rb +26 -0
  27. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +379 -0
  28. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +500 -0
  29. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor/challenge.rb +494 -0
  30. data/lib/twilio-ruby/rest/video/v1/composition_settings.rb +8 -4
  31. data/lib/twilio-ruby/rest/video/v1/recording_settings.rb +8 -4
  32. data/lib/twilio-ruby/version.rb +1 -1
  33. data/spec/integration/api/v2010/account/call_spec.rb +5 -5
  34. data/spec/integration/api/v2010/account/conference_spec.rb +42 -14
  35. data/spec/integration/conversations/v1/conversation/participant_spec.rb +7 -0
  36. data/spec/integration/flex_api/v1/configuration_spec.rb +3 -0
  37. data/spec/integration/preview/trusted_comms/business/brand/branded_channel/channel_spec.rb +54 -0
  38. data/spec/integration/preview/trusted_comms/business/brand/branded_channel_spec.rb +52 -0
  39. data/spec/integration/preview/trusted_comms/business/brand_spec.rb +49 -0
  40. data/spec/integration/preview/trusted_comms/business_spec.rb +1 -0
  41. data/spec/integration/serverless/v1/service/environment/log_spec.rb +1 -0
  42. data/spec/integration/supersim/v1/fleet_spec.rb +4 -0
  43. data/spec/integration/supersim/v1/network_access_profile/network_access_profile_network_spec.rb +179 -0
  44. data/spec/integration/supersim/v1/network_access_profile_spec.rb +20 -5
  45. data/spec/integration/supersim/v1/network_spec.rb +139 -0
  46. data/spec/integration/trunking/v1/trunk/credential_list_spec.rb +13 -13
  47. data/spec/integration/trunking/v1/trunk/ip_access_control_list_spec.rb +23 -23
  48. data/spec/integration/trunking/v1/trunk/origination_url_spec.rb +28 -28
  49. data/spec/integration/trunking/v1/trunk/phone_number_spec.rb +17 -17
  50. data/spec/integration/trunking/v1/trunk_spec.rb +33 -33
  51. data/spec/integration/verify/v2/form_spec.rb +48 -0
  52. data/spec/integration/verify/v2/service/entity/factor/challenge_spec.rb +353 -0
  53. data/spec/integration/verify/v2/service/entity/factor_spec.rb +298 -0
  54. data/spec/integration/verify/v2/service/entity_spec.rb +201 -0
  55. data/spec/integration/verify/v2/service_spec.rb +24 -4
  56. metadata +29 -2
@@ -0,0 +1,494 @@
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 Verify < Domain
12
+ class V2 < Version
13
+ class ServiceContext < InstanceContext
14
+ class EntityContext < InstanceContext
15
+ class FactorContext < InstanceContext
16
+ ##
17
+ # 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.
18
+ class ChallengeList < ListResource
19
+ ##
20
+ # Initialize the ChallengeList
21
+ # @param [Version] version Version that contains the resource
22
+ # @param [String] service_sid The unique SID identifier of the Service.
23
+ # @param [String] identity Customer unique identity for the Entity owner of the
24
+ # Challenge
25
+ # @param [String] factor_sid The unique SID identifier of the Factor.
26
+ # @return [ChallengeList] ChallengeList
27
+ def initialize(version, service_sid: nil, identity: nil, factor_sid: nil)
28
+ super(version)
29
+
30
+ # Path Solution
31
+ @solution = {service_sid: service_sid, identity: identity, factor_sid: factor_sid}
32
+ @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}/Factors/#{@solution[:factor_sid]}/Challenges"
33
+ end
34
+
35
+ ##
36
+ # Retrieve a single page of ChallengeInstance records from the API.
37
+ # Request is executed immediately.
38
+ # @param [Time] expiration_date The future date in which this Challenge will
39
+ # expire, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
40
+ # @param [String] details Details provided to give context about the Challenge.
41
+ # Shown to the end user.
42
+ # @param [String] hidden_details Details provided to give context about the
43
+ # Challenge. Not shown to the end user.
44
+ # @return [ChallengeInstance] Newly created ChallengeInstance
45
+ def create(expiration_date: :unset, details: :unset, hidden_details: :unset)
46
+ data = Twilio::Values.of({
47
+ 'ExpirationDate' => Twilio.serialize_iso8601_datetime(expiration_date),
48
+ 'Details' => details,
49
+ 'HiddenDetails' => hidden_details,
50
+ })
51
+
52
+ payload = @version.create(
53
+ 'POST',
54
+ @uri,
55
+ data: data
56
+ )
57
+
58
+ ChallengeInstance.new(
59
+ @version,
60
+ payload,
61
+ service_sid: @solution[:service_sid],
62
+ identity: @solution[:identity],
63
+ factor_sid: @solution[:factor_sid],
64
+ )
65
+ end
66
+
67
+ ##
68
+ # Lists ChallengeInstance records from the API as a list.
69
+ # Unlike stream(), this operation is eager and will load `limit` records into
70
+ # memory before returning.
71
+ # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
72
+ # fetch. One of `pending`, `expired`, `approved` or `denied`.
73
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
74
+ # guarantees to never return more than limit. Default is no limit
75
+ # @param [Integer] page_size Number of records to fetch per request, when
76
+ # not set will use the default value of 50 records. If no page_size is defined
77
+ # but a limit is defined, stream() will attempt to read the limit with the most
78
+ # efficient page size, i.e. min(limit, 1000)
79
+ # @return [Array] Array of up to limit results
80
+ def list(status: :unset, limit: nil, page_size: nil)
81
+ self.stream(status: status, limit: limit, page_size: page_size).entries
82
+ end
83
+
84
+ ##
85
+ # Streams ChallengeInstance records from the API as an Enumerable.
86
+ # This operation lazily loads records as efficiently as possible until the limit
87
+ # is reached.
88
+ # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
89
+ # fetch. One of `pending`, `expired`, `approved` or `denied`.
90
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
91
+ # guarantees to never return more than limit. Default is no limit.
92
+ # @param [Integer] page_size Number of records to fetch per request, when
93
+ # not set will use the default value of 50 records. If no page_size is defined
94
+ # but a limit is defined, stream() will attempt to read the limit with the most
95
+ # efficient page size, i.e. min(limit, 1000)
96
+ # @return [Enumerable] Enumerable that will yield up to limit results
97
+ def stream(status: :unset, limit: nil, page_size: nil)
98
+ limits = @version.read_limits(limit, page_size)
99
+
100
+ page = self.page(status: status, page_size: limits[:page_size], )
101
+
102
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
103
+ end
104
+
105
+ ##
106
+ # When passed a block, yields ChallengeInstance records from the API.
107
+ # This operation lazily loads records as efficiently as possible until the limit
108
+ # is reached.
109
+ def each
110
+ limits = @version.read_limits
111
+
112
+ page = self.page(page_size: limits[:page_size], )
113
+
114
+ @version.stream(page,
115
+ limit: limits[:limit],
116
+ page_limit: limits[:page_limit]).each {|x| yield x}
117
+ end
118
+
119
+ ##
120
+ # Retrieve a single page of ChallengeInstance records from the API.
121
+ # Request is executed immediately.
122
+ # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
123
+ # fetch. One of `pending`, `expired`, `approved` or `denied`.
124
+ # @param [String] page_token PageToken provided by the API
125
+ # @param [Integer] page_number Page Number, this value is simply for client state
126
+ # @param [Integer] page_size Number of records to return, defaults to 50
127
+ # @return [Page] Page of ChallengeInstance
128
+ def page(status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
129
+ params = Twilio::Values.of({
130
+ 'Status' => status,
131
+ 'PageToken' => page_token,
132
+ 'Page' => page_number,
133
+ 'PageSize' => page_size,
134
+ })
135
+ response = @version.page(
136
+ 'GET',
137
+ @uri,
138
+ params
139
+ )
140
+ ChallengePage.new(@version, response, @solution)
141
+ end
142
+
143
+ ##
144
+ # Retrieve a single page of ChallengeInstance records from the API.
145
+ # Request is executed immediately.
146
+ # @param [String] target_url API-generated URL for the requested results page
147
+ # @return [Page] Page of ChallengeInstance
148
+ def get_page(target_url)
149
+ response = @version.domain.request(
150
+ 'GET',
151
+ target_url
152
+ )
153
+ ChallengePage.new(@version, response, @solution)
154
+ end
155
+
156
+ ##
157
+ # Provide a user friendly representation
158
+ def to_s
159
+ '#<Twilio.Verify.V2.ChallengeList>'
160
+ end
161
+ end
162
+
163
+ ##
164
+ # 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.
165
+ class ChallengePage < Page
166
+ ##
167
+ # Initialize the ChallengePage
168
+ # @param [Version] version Version that contains the resource
169
+ # @param [Response] response Response from the API
170
+ # @param [Hash] solution Path solution for the resource
171
+ # @return [ChallengePage] ChallengePage
172
+ def initialize(version, response, solution)
173
+ super(version, response)
174
+
175
+ # Path Solution
176
+ @solution = solution
177
+ end
178
+
179
+ ##
180
+ # Build an instance of ChallengeInstance
181
+ # @param [Hash] payload Payload response from the API
182
+ # @return [ChallengeInstance] ChallengeInstance
183
+ def get_instance(payload)
184
+ ChallengeInstance.new(
185
+ @version,
186
+ payload,
187
+ service_sid: @solution[:service_sid],
188
+ identity: @solution[:identity],
189
+ factor_sid: @solution[:factor_sid],
190
+ )
191
+ end
192
+
193
+ ##
194
+ # Provide a user friendly representation
195
+ def to_s
196
+ '<Twilio.Verify.V2.ChallengePage>'
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 ChallengeContext < InstanceContext
203
+ ##
204
+ # Initialize the ChallengeContext
205
+ # @param [Version] version Version that contains the resource
206
+ # @param [String] service_sid The unique SID identifier of the Service.
207
+ # @param [String] identity Customer unique identity for the Entity owner of the
208
+ # Challenge
209
+ # @param [String] factor_sid The unique SID identifier of the Factor.
210
+ # @param [String] sid A 34 character string that uniquely identifies this
211
+ # Challenge. It also allows the keyword `latest` to fetch the most recent active
212
+ # Challenge created for a Factor.
213
+ # @return [ChallengeContext] ChallengeContext
214
+ def initialize(version, service_sid, identity, factor_sid, sid)
215
+ super(version)
216
+
217
+ # Path Solution
218
+ @solution = {service_sid: service_sid, identity: identity, factor_sid: factor_sid, sid: sid, }
219
+ @uri = "/Services/#{@solution[:service_sid]}/Entities/#{@solution[:identity]}/Factors/#{@solution[:factor_sid]}/Challenges/#{@solution[:sid]}"
220
+ end
221
+
222
+ ##
223
+ # Deletes the ChallengeInstance
224
+ # @return [Boolean] true if delete succeeds, false otherwise
225
+ def delete
226
+ @version.delete('delete', @uri)
227
+ end
228
+
229
+ ##
230
+ # Fetch a ChallengeInstance
231
+ # @return [ChallengeInstance] Fetched ChallengeInstance
232
+ def fetch
233
+ params = Twilio::Values.of({})
234
+
235
+ payload = @version.fetch(
236
+ 'GET',
237
+ @uri,
238
+ params,
239
+ )
240
+
241
+ ChallengeInstance.new(
242
+ @version,
243
+ payload,
244
+ service_sid: @solution[:service_sid],
245
+ identity: @solution[:identity],
246
+ factor_sid: @solution[:factor_sid],
247
+ sid: @solution[:sid],
248
+ )
249
+ end
250
+
251
+ ##
252
+ # Update the ChallengeInstance
253
+ # @param [String] auth_payload The optional payload needed to verify the
254
+ # Challenge. E.g., a TOTP would use the numeric code.
255
+ # @return [ChallengeInstance] Updated ChallengeInstance
256
+ def update(auth_payload: :unset)
257
+ data = Twilio::Values.of({'AuthPayload' => auth_payload, })
258
+
259
+ payload = @version.update(
260
+ 'POST',
261
+ @uri,
262
+ data: data,
263
+ )
264
+
265
+ ChallengeInstance.new(
266
+ @version,
267
+ payload,
268
+ service_sid: @solution[:service_sid],
269
+ identity: @solution[:identity],
270
+ factor_sid: @solution[:factor_sid],
271
+ sid: @solution[:sid],
272
+ )
273
+ end
274
+
275
+ ##
276
+ # Provide a user friendly representation
277
+ def to_s
278
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
279
+ "#<Twilio.Verify.V2.ChallengeContext #{context}>"
280
+ end
281
+
282
+ ##
283
+ # Provide a detailed, user friendly representation
284
+ def inspect
285
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
286
+ "#<Twilio.Verify.V2.ChallengeContext #{context}>"
287
+ end
288
+ end
289
+
290
+ ##
291
+ # 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.
292
+ class ChallengeInstance < InstanceResource
293
+ ##
294
+ # Initialize the ChallengeInstance
295
+ # @param [Version] version Version that contains the resource
296
+ # @param [Hash] payload payload that contains response from Twilio
297
+ # @param [String] service_sid The unique SID identifier of the Service.
298
+ # @param [String] identity Customer unique identity for the Entity owner of the
299
+ # Challenge
300
+ # @param [String] factor_sid The unique SID identifier of the Factor.
301
+ # @param [String] sid A 34 character string that uniquely identifies this
302
+ # Challenge. It also allows the keyword `latest` to fetch the most recent active
303
+ # Challenge created for a Factor.
304
+ # @return [ChallengeInstance] ChallengeInstance
305
+ def initialize(version, payload, service_sid: nil, identity: nil, factor_sid: nil, sid: nil)
306
+ super(version)
307
+
308
+ # Marshaled Properties
309
+ @properties = {
310
+ 'sid' => payload['sid'],
311
+ 'account_sid' => payload['account_sid'],
312
+ 'service_sid' => payload['service_sid'],
313
+ 'entity_sid' => payload['entity_sid'],
314
+ 'identity' => payload['identity'],
315
+ 'factor_sid' => payload['factor_sid'],
316
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
317
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
318
+ 'date_responded' => Twilio.deserialize_iso8601_datetime(payload['date_responded']),
319
+ 'expiration_date' => Twilio.deserialize_iso8601_datetime(payload['expiration_date']),
320
+ 'status' => payload['status'],
321
+ 'responded_reason' => payload['responded_reason'],
322
+ 'details' => payload['details'],
323
+ 'hidden_details' => payload['hidden_details'],
324
+ 'factor_type' => payload['factor_type'],
325
+ 'url' => payload['url'],
326
+ }
327
+
328
+ # Context
329
+ @instance_context = nil
330
+ @params = {
331
+ 'service_sid' => service_sid,
332
+ 'identity' => identity,
333
+ 'factor_sid' => factor_sid,
334
+ 'sid' => sid || @properties['sid'],
335
+ }
336
+ end
337
+
338
+ ##
339
+ # Generate an instance context for the instance, the context is capable of
340
+ # performing various actions. All instance actions are proxied to the context
341
+ # @return [ChallengeContext] ChallengeContext for this ChallengeInstance
342
+ def context
343
+ unless @instance_context
344
+ @instance_context = ChallengeContext.new(
345
+ @version,
346
+ @params['service_sid'],
347
+ @params['identity'],
348
+ @params['factor_sid'],
349
+ @params['sid'],
350
+ )
351
+ end
352
+ @instance_context
353
+ end
354
+
355
+ ##
356
+ # @return [String] A string that uniquely identifies this Challenge.
357
+ def sid
358
+ @properties['sid']
359
+ end
360
+
361
+ ##
362
+ # @return [String] Account Sid.
363
+ def account_sid
364
+ @properties['account_sid']
365
+ end
366
+
367
+ ##
368
+ # @return [String] Service Sid.
369
+ def service_sid
370
+ @properties['service_sid']
371
+ end
372
+
373
+ ##
374
+ # @return [String] Entity Sid.
375
+ def entity_sid
376
+ @properties['entity_sid']
377
+ end
378
+
379
+ ##
380
+ # @return [String] Unique identity of the Entity
381
+ def identity
382
+ @properties['identity']
383
+ end
384
+
385
+ ##
386
+ # @return [String] Factor Sid.
387
+ def factor_sid
388
+ @properties['factor_sid']
389
+ end
390
+
391
+ ##
392
+ # @return [Time] The date this Challenge was created
393
+ def date_created
394
+ @properties['date_created']
395
+ end
396
+
397
+ ##
398
+ # @return [Time] The date this Challenge was updated
399
+ def date_updated
400
+ @properties['date_updated']
401
+ end
402
+
403
+ ##
404
+ # @return [Time] The date this Challenge was responded
405
+ def date_responded
406
+ @properties['date_responded']
407
+ end
408
+
409
+ ##
410
+ # @return [Time] The date this Challenge is expired
411
+ def expiration_date
412
+ @properties['expiration_date']
413
+ end
414
+
415
+ ##
416
+ # @return [challenge.ChallengeStatuses] The Status of this Challenge
417
+ def status
418
+ @properties['status']
419
+ end
420
+
421
+ ##
422
+ # @return [challenge.ChallengeReasons] The Reason of this Challenge `status`
423
+ def responded_reason
424
+ @properties['responded_reason']
425
+ end
426
+
427
+ ##
428
+ # @return [String] Public details provided to contextualize the Challenge
429
+ def details
430
+ @properties['details']
431
+ end
432
+
433
+ ##
434
+ # @return [String] Hidden details provided to contextualize the Challenge
435
+ def hidden_details
436
+ @properties['hidden_details']
437
+ end
438
+
439
+ ##
440
+ # @return [challenge.FactorTypes] The Factor Type of this Challenge
441
+ def factor_type
442
+ @properties['factor_type']
443
+ end
444
+
445
+ ##
446
+ # @return [String] The URL of this resource.
447
+ def url
448
+ @properties['url']
449
+ end
450
+
451
+ ##
452
+ # Deletes the ChallengeInstance
453
+ # @return [Boolean] true if delete succeeds, false otherwise
454
+ def delete
455
+ context.delete
456
+ end
457
+
458
+ ##
459
+ # Fetch a ChallengeInstance
460
+ # @return [ChallengeInstance] Fetched ChallengeInstance
461
+ def fetch
462
+ context.fetch
463
+ end
464
+
465
+ ##
466
+ # Update the ChallengeInstance
467
+ # @param [String] auth_payload The optional payload needed to verify the
468
+ # Challenge. E.g., a TOTP would use the numeric code.
469
+ # @return [ChallengeInstance] Updated ChallengeInstance
470
+ def update(auth_payload: :unset)
471
+ context.update(auth_payload: auth_payload, )
472
+ end
473
+
474
+ ##
475
+ # Provide a user friendly representation
476
+ def to_s
477
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
478
+ "<Twilio.Verify.V2.ChallengeInstance #{values}>"
479
+ end
480
+
481
+ ##
482
+ # Provide a detailed, user friendly representation
483
+ def inspect
484
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
485
+ "<Twilio.Verify.V2.ChallengeInstance #{values}>"
486
+ end
487
+ end
488
+ end
489
+ end
490
+ end
491
+ end
492
+ end
493
+ end
494
+ end