twilio-ruby 5.57.0 → 5.58.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.travis.yml +24 -7
  4. data/CHANGES.md +84 -0
  5. data/Gemfile +1 -0
  6. data/README.md +2 -2
  7. data/examples/examples.rb +1 -1
  8. data/lib/twilio-ruby/http/http_client.rb +1 -1
  9. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +12 -3
  10. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +4 -1
  11. data/lib/twilio-ruby/rest/api/v2010/account/conference/recording.rb +1 -1
  12. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/credential_list_mapping.rb +11 -11
  13. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain/ip_access_control_list_mapping.rb +11 -11
  14. data/lib/twilio-ruby/rest/conversations/v1/conversation/message.rb +12 -5
  15. data/lib/twilio-ruby/rest/conversations/v1/participant_conversation.rb +312 -0
  16. data/lib/twilio-ruby/rest/conversations/v1/service/conversation/message.rb +12 -5
  17. data/lib/twilio-ruby/rest/conversations/v1/service/participant_conversation.rb +324 -0
  18. data/lib/twilio-ruby/rest/conversations/v1/service/user/user_conversation.rb +2 -2
  19. data/lib/twilio-ruby/rest/conversations/v1/service.rb +23 -0
  20. data/lib/twilio-ruby/rest/conversations/v1/user/user_conversation.rb +2 -2
  21. data/lib/twilio-ruby/rest/conversations/v1.rb +7 -0
  22. data/lib/twilio-ruby/rest/conversations.rb +6 -0
  23. data/lib/twilio-ruby/rest/insights/v1/call_summaries.rb +434 -0
  24. data/lib/twilio-ruby/rest/insights/v1.rb +7 -0
  25. data/lib/twilio-ruby/rest/insights.rb +6 -0
  26. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +23 -1
  27. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb +9 -2
  28. data/lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb +6 -2
  29. data/lib/twilio-ruby/rest/pricing/v2/country.rb +280 -0
  30. data/lib/twilio-ruby/rest/pricing/v2/number.rb +225 -0
  31. data/lib/twilio-ruby/rest/pricing/v2.rb +37 -0
  32. data/lib/twilio-ruby/rest/pricing.rb +19 -0
  33. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/activity.rb +7 -0
  34. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +30 -20
  35. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge/notification.rb +6 -2
  36. data/lib/twilio-ruby/rest/verify/v2/service/entity/challenge.rb +36 -11
  37. data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +11 -9
  38. data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +8 -8
  39. data/lib/twilio-ruby/rest/verify/v2/service/entity.rb +7 -3
  40. data/lib/twilio-ruby/rest/verify/v2/service/webhook.rb +24 -5
  41. data/lib/twilio-ruby/rest/verify/v2/verification_template.rb +206 -0
  42. data/lib/twilio-ruby/rest/verify/v2.rb +7 -0
  43. data/lib/twilio-ruby/rest/verify.rb +6 -0
  44. data/lib/twilio-ruby/version.rb +1 -1
  45. data/sonar-project.properties +13 -0
  46. metadata +9 -2
@@ -15,9 +15,46 @@ module Twilio
15
15
  def initialize(domain)
16
16
  super
17
17
  @version = 'v2'
18
+ @countries = nil
19
+ @numbers = nil
18
20
  @voice = nil
19
21
  end
20
22
 
23
+ ##
24
+ # @param [String] iso_country The {ISO country
25
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2] of the origin-based
26
+ # voice pricing information to fetch.
27
+ # @return [Twilio::REST::Pricing::V2::CountryContext] if iso_country was passed.
28
+ # @return [Twilio::REST::Pricing::V2::CountryList]
29
+ def countries(iso_country=:unset)
30
+ if iso_country.nil?
31
+ raise ArgumentError, 'iso_country cannot be nil'
32
+ end
33
+ if iso_country == :unset
34
+ @countries ||= CountryList.new self
35
+ else
36
+ CountryContext.new(self, iso_country)
37
+ end
38
+ end
39
+
40
+ ##
41
+ # @param [String] destination_number The destination phone number, in
42
+ # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to
43
+ # fetch the origin-based voice pricing information. E.164 format consists of a +
44
+ # followed by the country code and subscriber number.
45
+ # @return [Twilio::REST::Pricing::V2::NumberContext] if destination_number was passed.
46
+ # @return [Twilio::REST::Pricing::V2::NumberList]
47
+ def numbers(destination_number=:unset)
48
+ if destination_number.nil?
49
+ raise ArgumentError, 'destination_number cannot be nil'
50
+ end
51
+ if destination_number == :unset
52
+ @numbers ||= NumberList.new self
53
+ else
54
+ NumberContext.new(self, destination_number)
55
+ end
56
+ end
57
+
21
58
  ##
22
59
  # @return [Twilio::REST::Pricing::V2::VoiceContext]
23
60
  def voice
@@ -53,6 +53,25 @@ module Twilio
53
53
  self.v2.voice()
54
54
  end
55
55
 
56
+ ##
57
+ # @param [String] iso_country The {ISO country
58
+ # code}[https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2].
59
+ # @return [Twilio::REST::Pricing::V2::CountryInstance] if iso_country was passed.
60
+ # @return [Twilio::REST::Pricing::V2::CountryList]
61
+ def countries(iso_country=:unset)
62
+ self.v2.countries(iso_country)
63
+ end
64
+
65
+ ##
66
+ # @param [String] destination_number The destination phone number in
67
+ # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, which consists
68
+ # of a + followed by the country code and subscriber number.
69
+ # @return [Twilio::REST::Pricing::V2::NumberInstance] if destination_number was passed.
70
+ # @return [Twilio::REST::Pricing::V2::NumberList]
71
+ def numbers(destination_number=:unset)
72
+ self.v2.numbers(destination_number)
73
+ end
74
+
56
75
  ##
57
76
  # Provide a user friendly representation
58
77
  def to_s
@@ -282,6 +282,7 @@ module Twilio
282
282
  'sid' => payload['sid'],
283
283
  'workspace_sid' => payload['workspace_sid'],
284
284
  'url' => payload['url'],
285
+ 'links' => payload['links'],
285
286
  }
286
287
 
287
288
  # Context
@@ -348,6 +349,12 @@ module Twilio
348
349
  @properties['url']
349
350
  end
350
351
 
352
+ ##
353
+ # @return [String] The links
354
+ def links
355
+ @properties['links']
356
+ end
357
+
351
358
  ##
352
359
  # Fetch the ActivityInstance
353
360
  # @return [ActivityInstance] Fetched ActivityInstance
@@ -124,12 +124,14 @@ module Twilio
124
124
  # worker.activity.update`, then TaskRouter will call event_callback_url only when
125
125
  # a task is created, canceled, or a Worker activity is updated.
126
126
  # @param [Boolean] multi_task_enabled Whether to enable multi-tasking. Can be:
127
- # `true` to enable multi-tasking, or `false` to disable it. The default is
128
- # `false`. Multi-tasking allows Workers to handle multiple Tasks simultaneously.
129
- # When enabled (`true`), each Worker can receive parallel reservations up to the
130
- # per-channel maximums defined in the Workers section. Otherwise, each Worker will
131
- # only receive a new reservation when the previous task is completed. Learn more
132
- # at {Multitasking}[https://www.twilio.com/docs/taskrouter/multitasking].
127
+ # `true` to enable multi-tasking, or `false` to disable it. However, all
128
+ # workspaces should be created as multi-tasking. The default is `true`.
129
+ # Multi-tasking allows Workers to handle multiple Tasks simultaneously. When
130
+ # enabled (`true`), each Worker can receive parallel reservations up to the
131
+ # per-channel maximums defined in the Workers section. In single-tasking mode
132
+ # (legacy mode), each Worker will only receive a new reservation when the previous
133
+ # task is completed. Learn more at
134
+ # {Multitasking}[https://www.twilio.com/docs/taskrouter/multitasking].
133
135
  # @param [String] template An available template name. Can be: `NONE` or `FIFO`
134
136
  # and the default is `NONE`. Pre-configures the Workspace with the Workflow and
135
137
  # Activities specified in the template. `NONE` will create a Workspace with only a
@@ -243,17 +245,21 @@ module Twilio
243
245
  # the Workspace resource. For example: `Sales Call Center` or `Customer Support
244
246
  # Team`.
245
247
  # @param [Boolean] multi_task_enabled Whether to enable multi-tasking. Can be:
246
- # `true` to enable multi-tasking, or `false` to disable it. The default is
247
- # `false`. Multi-tasking allows Workers to handle multiple Tasks simultaneously.
248
- # When enabled (`true`), each Worker can receive parallel reservations up to the
249
- # per-channel maximums defined in the Workers section. Otherwise, each Worker will
250
- # only receive a new reservation when the previous task is completed. Learn more
251
- # at {Multitasking}[https://www.twilio.com/docs/taskrouter/multitasking].
248
+ # `true` to enable multi-tasking, or `false` to disable it. However, all
249
+ # workspaces should be maintained as multi-tasking. There is no default when
250
+ # omitting this parameter. A multi-tasking Workspace can't be updated to
251
+ # single-tasking unless it is not a Flex Project and another (legacy)
252
+ # single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple
253
+ # Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel
254
+ # reservations up to the per-channel maximums defined in the Workers section. In
255
+ # single-tasking mode (legacy mode), each Worker will only receive a new
256
+ # reservation when the previous task is completed. Learn more at
257
+ # {Multitasking}[https://www.twilio.com/docs/taskrouter/multitasking].
252
258
  # @param [String] timeout_activity_sid The SID of the Activity that will be
253
259
  # assigned to a Worker when a Task reservation times out without a response.
254
260
  # @param [workspace.QueueOrder] prioritize_queue_order The type of TaskQueue to
255
261
  # prioritize when Workers are receiving Tasks from both types of TaskQueues. Can
256
- # be: `LIFO` or `FIFO` and the default is `FIFO`. For more information, see {Queue
262
+ # be: `LIFO` or `FIFO`. For more information, see {Queue
257
263
  # Ordering}[https://www.twilio.com/docs/taskrouter/queue-ordering-last-first-out-lifo].
258
264
  # @return [WorkspaceInstance] Updated WorkspaceInstance
259
265
  def update(default_activity_sid: :unset, event_callback_url: :unset, events_filter: :unset, friendly_name: :unset, multi_task_enabled: :unset, timeout_activity_sid: :unset, prioritize_queue_order: :unset)
@@ -602,17 +608,21 @@ module Twilio
602
608
  # the Workspace resource. For example: `Sales Call Center` or `Customer Support
603
609
  # Team`.
604
610
  # @param [Boolean] multi_task_enabled Whether to enable multi-tasking. Can be:
605
- # `true` to enable multi-tasking, or `false` to disable it. The default is
606
- # `false`. Multi-tasking allows Workers to handle multiple Tasks simultaneously.
607
- # When enabled (`true`), each Worker can receive parallel reservations up to the
608
- # per-channel maximums defined in the Workers section. Otherwise, each Worker will
609
- # only receive a new reservation when the previous task is completed. Learn more
610
- # at {Multitasking}[https://www.twilio.com/docs/taskrouter/multitasking].
611
+ # `true` to enable multi-tasking, or `false` to disable it. However, all
612
+ # workspaces should be maintained as multi-tasking. There is no default when
613
+ # omitting this parameter. A multi-tasking Workspace can't be updated to
614
+ # single-tasking unless it is not a Flex Project and another (legacy)
615
+ # single-tasking Workspace exists. Multi-tasking allows Workers to handle multiple
616
+ # Tasks simultaneously. In multi-tasking mode, each Worker can receive parallel
617
+ # reservations up to the per-channel maximums defined in the Workers section. In
618
+ # single-tasking mode (legacy mode), each Worker will only receive a new
619
+ # reservation when the previous task is completed. Learn more at
620
+ # {Multitasking}[https://www.twilio.com/docs/taskrouter/multitasking].
611
621
  # @param [String] timeout_activity_sid The SID of the Activity that will be
612
622
  # assigned to a Worker when a Task reservation times out without a response.
613
623
  # @param [workspace.QueueOrder] prioritize_queue_order The type of TaskQueue to
614
624
  # prioritize when Workers are receiving Tasks from both types of TaskQueues. Can
615
- # be: `LIFO` or `FIFO` and the default is `FIFO`. For more information, see {Queue
625
+ # be: `LIFO` or `FIFO`. For more information, see {Queue
616
626
  # Ordering}[https://www.twilio.com/docs/taskrouter/queue-ordering-last-first-out-lifo].
617
627
  # @return [WorkspaceInstance] Updated WorkspaceInstance
618
628
  def update(default_activity_sid: :unset, event_callback_url: :unset, events_filter: :unset, friendly_name: :unset, multi_task_enabled: :unset, timeout_activity_sid: :unset, prioritize_queue_order: :unset)
@@ -21,7 +21,9 @@ module Twilio
21
21
  # @param [Version] version Version that contains the resource
22
22
  # @param [String] service_sid The unique SID identifier of the Service.
23
23
  # @param [String] identity Customer unique identity for the Entity owner of the
24
- # Challenge. This value must be between 8 and 64 characters long.
24
+ # Challenge. This identifier should be immutable, not PII, length between 8 and 64
25
+ # characters, and generated by your external system, such as your user's UUID,
26
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
25
27
  # @param [String] challenge_sid The unique SID identifier of the Challenge.
26
28
  # @return [NotificationList] NotificationList
27
29
  def initialize(version, service_sid: nil, identity: nil, challenge_sid: nil)
@@ -106,7 +108,9 @@ module Twilio
106
108
  # @param [Hash] payload payload that contains response from Twilio
107
109
  # @param [String] service_sid The unique SID identifier of the Service.
108
110
  # @param [String] identity Customer unique identity for the Entity owner of the
109
- # Challenge. This value must be between 8 and 64 characters long.
111
+ # Challenge. This identifier should be immutable, not PII, length between 8 and 64
112
+ # characters, and generated by your external system, such as your user's UUID,
113
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
110
114
  # @param [String] challenge_sid The unique SID identifier of the Challenge.
111
115
  # @return [NotificationInstance] NotificationInstance
112
116
  def initialize(version, payload, service_sid: nil, identity: nil, challenge_sid: nil)
@@ -20,7 +20,9 @@ module Twilio
20
20
  # @param [Version] version Version that contains the resource
21
21
  # @param [String] service_sid The unique SID identifier of the Service.
22
22
  # @param [String] identity Customer unique identity for the Entity owner of the
23
- # Challenge. This value must be between 8 and 64 characters long.
23
+ # Challenge. This identifier should be immutable, not PII, length between 8 and 64
24
+ # characters, and generated by your external system, such as your user's UUID,
25
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
24
26
  # @return [ChallengeList] ChallengeList
25
27
  def initialize(version, service_sid: nil, identity: nil)
26
28
  super(version)
@@ -81,6 +83,9 @@ module Twilio
81
83
  # @param [String] factor_sid The unique SID identifier of the Factor.
82
84
  # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
83
85
  # fetch. One of `pending`, `expired`, `approved` or `denied`.
86
+ # @param [challenge.ListOrders] order The desired sort order of the Challenges
87
+ # list. One of `asc` or `desc` for ascending and descending respectively. Defaults
88
+ # to `asc`.
84
89
  # @param [Integer] limit Upper limit for the number of records to return. stream()
85
90
  # guarantees to never return more than limit. Default is no limit
86
91
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -88,8 +93,14 @@ module Twilio
88
93
  # but a limit is defined, stream() will attempt to read the limit with the most
89
94
  # efficient page size, i.e. min(limit, 1000)
90
95
  # @return [Array] Array of up to limit results
91
- def list(factor_sid: :unset, status: :unset, limit: nil, page_size: nil)
92
- self.stream(factor_sid: factor_sid, status: status, limit: limit, page_size: page_size).entries
96
+ def list(factor_sid: :unset, status: :unset, order: :unset, limit: nil, page_size: nil)
97
+ self.stream(
98
+ factor_sid: factor_sid,
99
+ status: status,
100
+ order: order,
101
+ limit: limit,
102
+ page_size: page_size
103
+ ).entries
93
104
  end
94
105
 
95
106
  ##
@@ -99,6 +110,9 @@ module Twilio
99
110
  # @param [String] factor_sid The unique SID identifier of the Factor.
100
111
  # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
101
112
  # fetch. One of `pending`, `expired`, `approved` or `denied`.
113
+ # @param [challenge.ListOrders] order The desired sort order of the Challenges
114
+ # list. One of `asc` or `desc` for ascending and descending respectively. Defaults
115
+ # to `asc`.
102
116
  # @param [Integer] limit Upper limit for the number of records to return. stream()
103
117
  # guarantees to never return more than limit. Default is no limit.
104
118
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -106,10 +120,15 @@ module Twilio
106
120
  # but a limit is defined, stream() will attempt to read the limit with the most
107
121
  # efficient page size, i.e. min(limit, 1000)
108
122
  # @return [Enumerable] Enumerable that will yield up to limit results
109
- def stream(factor_sid: :unset, status: :unset, limit: nil, page_size: nil)
123
+ def stream(factor_sid: :unset, status: :unset, order: :unset, limit: nil, page_size: nil)
110
124
  limits = @version.read_limits(limit, page_size)
111
125
 
112
- page = self.page(factor_sid: factor_sid, status: status, page_size: limits[:page_size], )
126
+ page = self.page(
127
+ factor_sid: factor_sid,
128
+ status: status,
129
+ order: order,
130
+ page_size: limits[:page_size],
131
+ )
113
132
 
114
133
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
115
134
  end
@@ -134,14 +153,18 @@ module Twilio
134
153
  # @param [String] factor_sid The unique SID identifier of the Factor.
135
154
  # @param [challenge.ChallengeStatuses] status The Status of the Challenges to
136
155
  # fetch. One of `pending`, `expired`, `approved` or `denied`.
156
+ # @param [challenge.ListOrders] order The desired sort order of the Challenges
157
+ # list. One of `asc` or `desc` for ascending and descending respectively. Defaults
158
+ # to `asc`.
137
159
  # @param [String] page_token PageToken provided by the API
138
160
  # @param [Integer] page_number Page Number, this value is simply for client state
139
161
  # @param [Integer] page_size Number of records to return, defaults to 50
140
162
  # @return [Page] Page of ChallengeInstance
141
- def page(factor_sid: :unset, status: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
163
+ def page(factor_sid: :unset, status: :unset, order: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
142
164
  params = Twilio::Values.of({
143
165
  'FactorSid' => factor_sid,
144
166
  'Status' => status,
167
+ 'Order' => order,
145
168
  'PageToken' => page_token,
146
169
  'Page' => page_number,
147
170
  'PageSize' => page_size,
@@ -215,10 +238,10 @@ module Twilio
215
238
  # Initialize the ChallengeContext
216
239
  # @param [Version] version Version that contains the resource
217
240
  # @param [String] service_sid The unique SID identifier of the Service.
218
- # @param [String] identity The unique external identifier for the Entity of the
219
- # Service. This identifier should be immutable, not PII, and generated by your
220
- # external system, such as your user's UUID, GUID, or SID. This value must be
221
- # between 8 and 64 characters long.
241
+ # @param [String] identity Customer unique identity for the Entity owner of the
242
+ # Challenges. This identifier should be immutable, not PII, length between 8 and
243
+ # 64 characters, and generated by your external system, such as your user's UUID,
244
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
222
245
  # @param [String] sid A 34 character string that uniquely identifies this
223
246
  # Challenge.
224
247
  # @return [ChallengeContext] ChallengeContext
@@ -310,7 +333,9 @@ module Twilio
310
333
  # @param [Hash] payload payload that contains response from Twilio
311
334
  # @param [String] service_sid The unique SID identifier of the Service.
312
335
  # @param [String] identity Customer unique identity for the Entity owner of the
313
- # Challenge. This value must be between 8 and 64 characters long.
336
+ # Challenge. This identifier should be immutable, not PII, length between 8 and 64
337
+ # characters, and generated by your external system, such as your user's UUID,
338
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
314
339
  # @param [String] sid A 34 character string that uniquely identifies this
315
340
  # Challenge.
316
341
  # @return [ChallengeInstance] ChallengeInstance
@@ -19,10 +19,10 @@ module Twilio
19
19
  # Initialize the FactorList
20
20
  # @param [Version] version Version that contains the resource
21
21
  # @param [String] service_sid The unique SID identifier of the Service.
22
- # @param [String] identity The unique external identifier for the Entity of the
23
- # Service. This identifier should be immutable, not PII, and generated by your
24
- # external system, such as your user's UUID, GUID, or SID. This value must be
25
- # between 8 and 64 characters long.
22
+ # @param [String] identity Customer unique identity for the Entity owner of the
23
+ # Factor. This identifier should be immutable, not PII, length between 8 and 64
24
+ # characters, and generated by your external system, such as your user's UUID,
25
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
26
26
  # @return [FactorList] FactorList
27
27
  def initialize(version, service_sid: nil, identity: nil)
28
28
  super(version)
@@ -163,7 +163,9 @@ module Twilio
163
163
  # @param [Version] version Version that contains the resource
164
164
  # @param [String] service_sid The unique SID identifier of the Service.
165
165
  # @param [String] identity Customer unique identity for the Entity owner of the
166
- # Factor. This value must be between 8 and 64 characters long.
166
+ # Factor. This identifier should be immutable, not PII, length between 8 and 64
167
+ # characters, and generated by your external system, such as your user's UUID,
168
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
167
169
  # @param [String] sid A 34 character string that uniquely identifies this Factor.
168
170
  # @return [FactorContext] FactorContext
169
171
  def initialize(version, service_sid, identity, sid)
@@ -264,10 +266,10 @@ module Twilio
264
266
  # @param [Version] version Version that contains the resource
265
267
  # @param [Hash] payload payload that contains response from Twilio
266
268
  # @param [String] service_sid The unique SID identifier of the Service.
267
- # @param [String] identity The unique external identifier for the Entity of the
268
- # Service. This identifier should be immutable, not PII, and generated by your
269
- # external system, such as your user's UUID, GUID, or SID. This value must be
270
- # between 8 and 64 characters long.
269
+ # @param [String] identity Customer unique identity for the Entity owner of the
270
+ # Factor. This identifier should be immutable, not PII, length between 8 and 64
271
+ # characters, and generated by your external system, such as your user's UUID,
272
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
271
273
  # @param [String] sid A 34 character string that uniquely identifies this Factor.
272
274
  # @return [FactorInstance] FactorInstance
273
275
  def initialize(version, payload, service_sid: nil, identity: nil, sid: nil)
@@ -19,10 +19,10 @@ module Twilio
19
19
  # Initialize the NewFactorList
20
20
  # @param [Version] version Version that contains the resource
21
21
  # @param [String] service_sid The unique SID identifier of the Service.
22
- # @param [String] identity The unique external identifier for the Entity of the
23
- # Service. This identifier should be immutable, not PII, and generated by your
24
- # external system, such as your user's UUID, GUID, or SID. This value must be
25
- # between 8 and 64 characters long.
22
+ # @param [String] identity Customer unique identity for the Entity owner of the
23
+ # Factor. This identifier should be immutable, not PII, length between 8 and 64
24
+ # characters, and generated by your external system, such as your user's UUID,
25
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
26
26
  # @return [NewFactorList] NewFactorList
27
27
  def initialize(version, service_sid: nil, identity: nil)
28
28
  super(version)
@@ -175,10 +175,10 @@ module Twilio
175
175
  # @param [Version] version Version that contains the resource
176
176
  # @param [Hash] payload payload that contains response from Twilio
177
177
  # @param [String] service_sid The unique SID identifier of the Service.
178
- # @param [String] identity The unique external identifier for the Entity of the
179
- # Service. This identifier should be immutable, not PII, and generated by your
180
- # external system, such as your user's UUID, GUID, or SID. This value must be
181
- # between 8 and 64 characters long.
178
+ # @param [String] identity Customer unique identity for the Entity owner of the
179
+ # Factor. This identifier should be immutable, not PII, length between 8 and 64
180
+ # characters, and generated by your external system, such as your user's UUID,
181
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
182
182
  # @return [NewFactorInstance] NewFactorInstance
183
183
  def initialize(version, payload, service_sid: nil, identity: nil)
184
184
  super(version)
@@ -32,7 +32,7 @@ module Twilio
32
32
  # @param [String] identity The unique external identifier for the Entity of the
33
33
  # Service. This identifier should be immutable, not PII, length between 8 and 64
34
34
  # characters, and generated by your external system, such as your user's UUID,
35
- # GUID, or SID.
35
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
36
36
  # @return [EntityInstance] Created EntityInstance
37
37
  def create(identity: nil)
38
38
  data = Twilio::Values.of({'Identity' => identity, })
@@ -168,7 +168,9 @@ module Twilio
168
168
  # @param [Version] version Version that contains the resource
169
169
  # @param [String] service_sid The unique SID identifier of the Service.
170
170
  # @param [String] identity The unique external identifier for the Entity of the
171
- # Service
171
+ # Service. This identifier should be immutable, not PII, length between 8 and 64
172
+ # characters, and generated by your external system, such as your user's UUID,
173
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
172
174
  # @return [EntityContext] EntityContext
173
175
  def initialize(version, service_sid, identity)
174
176
  super(version)
@@ -288,7 +290,9 @@ module Twilio
288
290
  # @param [Hash] payload payload that contains response from Twilio
289
291
  # @param [String] service_sid The unique SID identifier of the Service.
290
292
  # @param [String] identity The unique external identifier for the Entity of the
291
- # Service
293
+ # Service. This identifier should be immutable, not PII, length between 8 and 64
294
+ # characters, and generated by your external system, such as your user's UUID,
295
+ # GUID, or SID. It can only contain dash (-) separated alphanumeric characters.
292
296
  # @return [EntityInstance] EntityInstance
293
297
  def initialize(version, payload, service_sid: nil, identity: nil)
294
298
  super(version)
@@ -37,13 +37,17 @@ module Twilio
37
37
  # @param [String] webhook_url The URL associated with this Webhook.
38
38
  # @param [webhook.Status] status The webhook status. Default value is `enabled`.
39
39
  # One of: `enabled` or `disabled`
40
+ # @param [webhook.Version] version The webhook version. Default value is `v2`
41
+ # which includes all the latest fields. Version `v1` is legacy and may be removed
42
+ # in the future.
40
43
  # @return [WebhookInstance] Created WebhookInstance
41
- def create(friendly_name: nil, event_types: nil, webhook_url: nil, status: :unset)
44
+ def create(friendly_name: nil, event_types: nil, webhook_url: nil, status: :unset, version: :unset)
42
45
  data = Twilio::Values.of({
43
46
  'FriendlyName' => friendly_name,
44
47
  'EventTypes' => Twilio.serialize_list(event_types) { |e| e },
45
48
  'WebhookUrl' => webhook_url,
46
49
  'Status' => status,
50
+ 'Version' => version,
47
51
  })
48
52
 
49
53
  payload = @version.create('POST', @uri, data: data)
@@ -197,13 +201,17 @@ module Twilio
197
201
  # @param [String] webhook_url The URL associated with this Webhook.
198
202
  # @param [webhook.Status] status The webhook status. Default value is `enabled`.
199
203
  # One of: `enabled` or `disabled`
204
+ # @param [webhook.Version] version The webhook version. Default value is `v2`
205
+ # which includes all the latest fields. Version `v1` is legacy and may be removed
206
+ # in the future.
200
207
  # @return [WebhookInstance] Updated WebhookInstance
201
- def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset)
208
+ def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset)
202
209
  data = Twilio::Values.of({
203
210
  'FriendlyName' => friendly_name,
204
211
  'EventTypes' => Twilio.serialize_list(event_types) { |e| e },
205
212
  'WebhookUrl' => webhook_url,
206
213
  'Status' => status,
214
+ 'Version' => version,
207
215
  })
208
216
 
209
217
  payload = @version.update('POST', @uri, data: data)
@@ -264,6 +272,7 @@ module Twilio
264
272
  'friendly_name' => payload['friendly_name'],
265
273
  'event_types' => payload['event_types'],
266
274
  'status' => payload['status'],
275
+ 'version' => payload['version'],
267
276
  'webhook_url' => payload['webhook_url'],
268
277
  'webhook_method' => payload['webhook_method'],
269
278
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
@@ -323,6 +332,12 @@ module Twilio
323
332
  @properties['status']
324
333
  end
325
334
 
335
+ ##
336
+ # @return [webhook.Version] The webhook version
337
+ def version
338
+ @properties['version']
339
+ end
340
+
326
341
  ##
327
342
  # @return [String] The URL associated with this Webhook.
328
343
  def webhook_url
@@ -336,13 +351,13 @@ module Twilio
336
351
  end
337
352
 
338
353
  ##
339
- # @return [Time] The RFC 2822 date and time in GMT when the resource was created
354
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was created
340
355
  def date_created
341
356
  @properties['date_created']
342
357
  end
343
358
 
344
359
  ##
345
- # @return [Time] The RFC 2822 date and time in GMT when the resource was last updated
360
+ # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated
346
361
  def date_updated
347
362
  @properties['date_updated']
348
363
  end
@@ -363,13 +378,17 @@ module Twilio
363
378
  # @param [String] webhook_url The URL associated with this Webhook.
364
379
  # @param [webhook.Status] status The webhook status. Default value is `enabled`.
365
380
  # One of: `enabled` or `disabled`
381
+ # @param [webhook.Version] version The webhook version. Default value is `v2`
382
+ # which includes all the latest fields. Version `v1` is legacy and may be removed
383
+ # in the future.
366
384
  # @return [WebhookInstance] Updated WebhookInstance
367
- def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset)
385
+ def update(friendly_name: :unset, event_types: :unset, webhook_url: :unset, status: :unset, version: :unset)
368
386
  context.update(
369
387
  friendly_name: friendly_name,
370
388
  event_types: event_types,
371
389
  webhook_url: webhook_url,
372
390
  status: status,
391
+ version: version,
373
392
  )
374
393
  end
375
394