twilio-ruby 5.37.0 → 5.38.0

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