twilio-ruby 5.61.1 → 5.63.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/test-and-deploy.yml +124 -0
  3. data/.rubocop.yml +1 -1
  4. data/.rubocop_todo.yml +84 -21
  5. data/CHANGES.md +96 -0
  6. data/Makefile +3 -6
  7. data/README.md +4 -4
  8. data/lib/rack/twilio_webhook_authentication.rb +25 -1
  9. data/lib/twilio-ruby/rest/api/v2010/account/message.rb +19 -5
  10. data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
  11. data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
  12. data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
  13. data/lib/twilio-ruby/rest/flex_api/v1/flex_flow.rb +33 -18
  14. data/lib/twilio-ruby/rest/insights/v1/conference/conference_participant.rb +483 -0
  15. data/lib/twilio-ruby/rest/insights/v1/conference.rb +484 -0
  16. data/lib/twilio-ruby/rest/insights/v1/setting.rb +215 -0
  17. data/lib/twilio-ruby/rest/insights/v1.rb +23 -0
  18. data/lib/twilio-ruby/rest/insights.rb +14 -0
  19. data/lib/twilio-ruby/rest/media/v1/media_processor.rb +14 -1
  20. data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +23 -0
  21. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/bundle_copy.rb +80 -0
  22. data/lib/twilio-ruby/rest/supersim/v1/esim_profile.rb +372 -0
  23. data/lib/twilio-ruby/rest/supersim/v1/ip_command.rb +416 -0
  24. data/lib/twilio-ruby/rest/supersim/v1.rb +32 -0
  25. data/lib/twilio-ruby/rest/supersim.rb +18 -0
  26. data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +138 -10
  27. data/lib/twilio-ruby/rest/verify/v2/service.rb +8 -2
  28. data/lib/twilio-ruby/rest/video/v1/composition.rb +7 -0
  29. data/lib/twilio-ruby/rest/video/v1/recording.rb +7 -0
  30. data/lib/twilio-ruby/rest/video/v1/room/recording.rb +7 -0
  31. data/lib/twilio-ruby/rest/video/v1/room.rb +34 -1
  32. data/lib/twilio-ruby/rest/voice/v1/archived_call.rb +184 -0
  33. data/lib/twilio-ruby/rest/voice/v1.rb +21 -0
  34. data/lib/twilio-ruby/rest/voice.rb +8 -0
  35. data/lib/twilio-ruby/rest/wireless/v1/sim.rb +4 -4
  36. data/lib/twilio-ruby/version.rb +1 -1
  37. data/sonar-project.properties +1 -1
  38. data/twilio-ruby.gemspec +0 -1
  39. metadata +10 -18
  40. data/.github/workflows/deploy.yml +0 -65
  41. data/.github/workflows/test.yml +0 -51
@@ -0,0 +1,269 @@
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 Conversations < Domain
12
+ class V1 < Version
13
+ class ServiceContext < InstanceContext
14
+ class ConfigurationContext < InstanceContext
15
+ class WebhookList < ListResource
16
+ ##
17
+ # Initialize the WebhookList
18
+ # @param [Version] version Version that contains the resource
19
+ # @param [String] chat_service_sid The unique string that we created to identify
20
+ # the Service configuration resource.
21
+ # @return [WebhookList] WebhookList
22
+ def initialize(version, chat_service_sid: nil)
23
+ super(version)
24
+
25
+ # Path Solution
26
+ @solution = {chat_service_sid: chat_service_sid}
27
+ end
28
+
29
+ ##
30
+ # Provide a user friendly representation
31
+ def to_s
32
+ '#<Twilio.Conversations.V1.WebhookList>'
33
+ end
34
+ end
35
+
36
+ class WebhookPage < Page
37
+ ##
38
+ # Initialize the WebhookPage
39
+ # @param [Version] version Version that contains the resource
40
+ # @param [Response] response Response from the API
41
+ # @param [Hash] solution Path solution for the resource
42
+ # @return [WebhookPage] WebhookPage
43
+ def initialize(version, response, solution)
44
+ super(version, response)
45
+
46
+ # Path Solution
47
+ @solution = solution
48
+ end
49
+
50
+ ##
51
+ # Build an instance of WebhookInstance
52
+ # @param [Hash] payload Payload response from the API
53
+ # @return [WebhookInstance] WebhookInstance
54
+ def get_instance(payload)
55
+ WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
56
+ end
57
+
58
+ ##
59
+ # Provide a user friendly representation
60
+ def to_s
61
+ '<Twilio.Conversations.V1.WebhookPage>'
62
+ end
63
+ end
64
+
65
+ class WebhookContext < InstanceContext
66
+ ##
67
+ # Initialize the WebhookContext
68
+ # @param [Version] version Version that contains the resource
69
+ # @param [String] chat_service_sid The unique ID of the {Conversation
70
+ # Service}[https://www.twilio.com/docs/conversations/api/service-resource] this
71
+ # conversation belongs to.
72
+ # @return [WebhookContext] WebhookContext
73
+ def initialize(version, chat_service_sid)
74
+ super(version)
75
+
76
+ # Path Solution
77
+ @solution = {chat_service_sid: chat_service_sid, }
78
+ @uri = "/Services/#{@solution[:chat_service_sid]}/Configuration/Webhooks"
79
+ end
80
+
81
+ ##
82
+ # Update the WebhookInstance
83
+ # @param [String] pre_webhook_url The absolute url the pre-event webhook request
84
+ # should be sent to.
85
+ # @param [String] post_webhook_url The absolute url the post-event webhook request
86
+ # should be sent to.
87
+ # @param [Array[String]] filters The list of events that your configured webhook
88
+ # targets will receive. Events not configured here will not fire. Possible values
89
+ # are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`,
90
+ # `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`,
91
+ # `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`,
92
+ # `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`,
93
+ # `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`,
94
+ # `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate`
95
+ # or `onConversationStateUpdated`.
96
+ # @param [String] method The HTTP method to be used when sending a webhook
97
+ # request. One of `GET` or `POST`.
98
+ # @return [WebhookInstance] Updated WebhookInstance
99
+ def update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset)
100
+ data = Twilio::Values.of({
101
+ 'PreWebhookUrl' => pre_webhook_url,
102
+ 'PostWebhookUrl' => post_webhook_url,
103
+ 'Filters' => Twilio.serialize_list(filters) { |e| e },
104
+ 'Method' => method,
105
+ })
106
+
107
+ payload = @version.update('POST', @uri, data: data)
108
+
109
+ WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
110
+ end
111
+
112
+ ##
113
+ # Fetch the WebhookInstance
114
+ # @return [WebhookInstance] Fetched WebhookInstance
115
+ def fetch
116
+ payload = @version.fetch('GET', @uri)
117
+
118
+ WebhookInstance.new(@version, payload, chat_service_sid: @solution[:chat_service_sid], )
119
+ end
120
+
121
+ ##
122
+ # Provide a user friendly representation
123
+ def to_s
124
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
125
+ "#<Twilio.Conversations.V1.WebhookContext #{context}>"
126
+ end
127
+
128
+ ##
129
+ # Provide a detailed, user friendly representation
130
+ def inspect
131
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
132
+ "#<Twilio.Conversations.V1.WebhookContext #{context}>"
133
+ end
134
+ end
135
+
136
+ class WebhookInstance < InstanceResource
137
+ ##
138
+ # Initialize the WebhookInstance
139
+ # @param [Version] version Version that contains the resource
140
+ # @param [Hash] payload payload that contains response from Twilio
141
+ # @param [String] chat_service_sid The unique string that we created to identify
142
+ # the Service configuration resource.
143
+ # @return [WebhookInstance] WebhookInstance
144
+ def initialize(version, payload, chat_service_sid: nil)
145
+ super(version)
146
+
147
+ # Marshaled Properties
148
+ @properties = {
149
+ 'account_sid' => payload['account_sid'],
150
+ 'chat_service_sid' => payload['chat_service_sid'],
151
+ 'pre_webhook_url' => payload['pre_webhook_url'],
152
+ 'post_webhook_url' => payload['post_webhook_url'],
153
+ 'filters' => payload['filters'],
154
+ 'method' => payload['method'],
155
+ 'url' => payload['url'],
156
+ }
157
+
158
+ # Context
159
+ @instance_context = nil
160
+ @params = {'chat_service_sid' => chat_service_sid, }
161
+ end
162
+
163
+ ##
164
+ # Generate an instance context for the instance, the context is capable of
165
+ # performing various actions. All instance actions are proxied to the context
166
+ # @return [WebhookContext] WebhookContext for this WebhookInstance
167
+ def context
168
+ unless @instance_context
169
+ @instance_context = WebhookContext.new(@version, @params['chat_service_sid'], )
170
+ end
171
+ @instance_context
172
+ end
173
+
174
+ ##
175
+ # @return [String] The unique ID of the Account responsible for this service.
176
+ def account_sid
177
+ @properties['account_sid']
178
+ end
179
+
180
+ ##
181
+ # @return [String] The unique ID of the {Conversation Service}[https://www.twilio.com/docs/conversations/api/service-resource] this conversation belongs to.
182
+ def chat_service_sid
183
+ @properties['chat_service_sid']
184
+ end
185
+
186
+ ##
187
+ # @return [String] The absolute url the pre-event webhook request should be sent to.
188
+ def pre_webhook_url
189
+ @properties['pre_webhook_url']
190
+ end
191
+
192
+ ##
193
+ # @return [String] The absolute url the post-event webhook request should be sent to.
194
+ def post_webhook_url
195
+ @properties['post_webhook_url']
196
+ end
197
+
198
+ ##
199
+ # @return [Array[String]] The list of events that your configured webhook targets will receive. Events not configured here will not fire.
200
+ def filters
201
+ @properties['filters']
202
+ end
203
+
204
+ ##
205
+ # @return [webhook.Method] The HTTP method to be used when sending a webhook request
206
+ def method
207
+ @properties['method']
208
+ end
209
+
210
+ ##
211
+ # @return [String] An absolute URL for this webhook.
212
+ def url
213
+ @properties['url']
214
+ end
215
+
216
+ ##
217
+ # Update the WebhookInstance
218
+ # @param [String] pre_webhook_url The absolute url the pre-event webhook request
219
+ # should be sent to.
220
+ # @param [String] post_webhook_url The absolute url the post-event webhook request
221
+ # should be sent to.
222
+ # @param [Array[String]] filters The list of events that your configured webhook
223
+ # targets will receive. Events not configured here will not fire. Possible values
224
+ # are `onParticipantAdd`, `onParticipantAdded`, `onDeliveryUpdated`,
225
+ # `onConversationUpdated`, `onConversationRemove`, `onParticipantRemove`,
226
+ # `onConversationUpdate`, `onMessageAdd`, `onMessageRemoved`,
227
+ # `onParticipantUpdated`, `onConversationAdded`, `onMessageAdded`,
228
+ # `onConversationAdd`, `onConversationRemoved`, `onParticipantUpdate`,
229
+ # `onMessageRemove`, `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate`
230
+ # or `onConversationStateUpdated`.
231
+ # @param [String] method The HTTP method to be used when sending a webhook
232
+ # request. One of `GET` or `POST`.
233
+ # @return [WebhookInstance] Updated WebhookInstance
234
+ def update(pre_webhook_url: :unset, post_webhook_url: :unset, filters: :unset, method: :unset)
235
+ context.update(
236
+ pre_webhook_url: pre_webhook_url,
237
+ post_webhook_url: post_webhook_url,
238
+ filters: filters,
239
+ method: method,
240
+ )
241
+ end
242
+
243
+ ##
244
+ # Fetch the WebhookInstance
245
+ # @return [WebhookInstance] Fetched WebhookInstance
246
+ def fetch
247
+ context.fetch
248
+ end
249
+
250
+ ##
251
+ # Provide a user friendly representation
252
+ def to_s
253
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
254
+ "<Twilio.Conversations.V1.WebhookInstance #{values}>"
255
+ end
256
+
257
+ ##
258
+ # Provide a detailed, user friendly representation
259
+ def inspect
260
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
261
+ "<Twilio.Conversations.V1.WebhookInstance #{values}>"
262
+ end
263
+ end
264
+ end
265
+ end
266
+ end
267
+ end
268
+ end
269
+ end
@@ -77,6 +77,7 @@ module Twilio
77
77
 
78
78
  # Components
79
79
  @notifications = nil
80
+ @webhooks = nil
80
81
  end
81
82
 
82
83
  ##
@@ -127,6 +128,13 @@ module Twilio
127
128
  return NotificationContext.new(@version, @solution[:chat_service_sid], )
128
129
  end
129
130
 
131
+ ##
132
+ # Access the webhooks
133
+ # @return [WebhookContext] WebhookContext
134
+ def webhooks
135
+ return WebhookContext.new(@version, @solution[:chat_service_sid], )
136
+ end
137
+
130
138
  ##
131
139
  # Provide a user friendly representation
132
140
  def to_s
@@ -168,6 +168,8 @@ module Twilio
168
168
  'markdown' => payload['markdown'],
169
169
  'url' => payload['url'],
170
170
  'flex_insights_hr' => payload['flex_insights_hr'],
171
+ 'flex_insights_drilldown' => payload['flex_insights_drilldown'],
172
+ 'flex_url' => payload['flex_url'],
171
173
  }
172
174
 
173
175
  # Context
@@ -426,6 +428,18 @@ module Twilio
426
428
  @properties['flex_insights_hr']
427
429
  end
428
430
 
431
+ ##
432
+ # @return [Boolean] Setting to enable Flex UI redirection
433
+ def flex_insights_drilldown
434
+ @properties['flex_insights_drilldown']
435
+ end
436
+
437
+ ##
438
+ # @return [String] URL to redirect to in case drilldown is enabled.
439
+ def flex_url
440
+ @properties['flex_url']
441
+ end
442
+
429
443
  ##
430
444
  # Fetch the ConfigurationInstance
431
445
  # @param [String] ui_version The Pinned UI version of the Configuration resource
@@ -115,8 +115,13 @@ module Twilio
115
115
  # @param [String] friendly_name A descriptive string that you create to describe
116
116
  # the Flex Flow resource.
117
117
  # @param [String] chat_service_sid The SID of the chat service.
118
- # @param [flex_flow.ChannelType] channel_type The channel type. Can be: `web`,
119
- # `facebook`, `sms`, `whatsapp`, `line` or `custom`.
118
+ # @param [flex_flow.ChannelType] channel_type The channel type. One of `web`,
119
+ # `facebook`, `sms`, `whatsapp`, `line` or `custom`. By default, Studio’s Send to
120
+ # Flex widget passes it on to the Task attributes for Tasks created based on this
121
+ # Flex Flow. The Task attributes will be used by the Flex UI to render the
122
+ # respective Task as appropriate (applying channel-specific design and length
123
+ # limits). If `channelType` is `facebook`, `whatsapp` or `line`, the Send to Flex
124
+ # widget should set the Task Channel to Programmable Chat.
120
125
  # @param [String] contact_identity The channel contact's Identity.
121
126
  # @param [Boolean] enabled Whether the new Flex Flow is enabled.
122
127
  # @param [flex_flow.IntegrationType] integration_type The software that will
@@ -151,10 +156,10 @@ module Twilio
151
156
  # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
152
157
  # will remove active Proxy sessions if the associated Task is deleted outside of
153
158
  # the Flex UI. Defaults to `false`.
154
- # @param [String] integration_retry_count The number of times to retry the webhook
155
- # if the first attempt fails. Can be an integer between 0 and 3 (inclusive),
156
- # default is 3. Optional when `integrationType` is `external`, not applicable
157
- # otherwise.
159
+ # @param [String] integration_retry_count The number of times to retry the Studio
160
+ # Flow or webhook in case of failure. Takes integer values from 0 to 3 with the
161
+ # default being 3. Optional when `integrationType` is `studio` or `external`, not
162
+ # applicable otherwise.
158
163
  # @return [FlexFlowInstance] Created FlexFlowInstance
159
164
  def create(friendly_name: nil, chat_service_sid: nil, channel_type: nil, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset)
160
165
  data = Twilio::Values.of({
@@ -246,8 +251,13 @@ module Twilio
246
251
  # @param [String] friendly_name A descriptive string that you create to describe
247
252
  # the Flex Flow resource.
248
253
  # @param [String] chat_service_sid The SID of the chat service.
249
- # @param [flex_flow.ChannelType] channel_type The channel type. Can be: `web`,
250
- # `facebook`, `sms`, `whatsapp`, `line` or `custom`.
254
+ # @param [flex_flow.ChannelType] channel_type The channel type. One of `web`,
255
+ # `facebook`, `sms`, `whatsapp`, `line` or `custom`. By default, Studio’s Send to
256
+ # Flex widget passes it on to the Task attributes for Tasks created based on this
257
+ # Flex Flow. The Task attributes will be used by the Flex UI to render the
258
+ # respective Task as appropriate (applying channel-specific design and length
259
+ # limits). If `channelType` is `facebook`, `whatsapp` or `line`, the Send to Flex
260
+ # widget should set the Task Channel to Programmable Chat.
251
261
  # @param [String] contact_identity The channel contact's Identity.
252
262
  # @param [Boolean] enabled Whether the new Flex Flow is enabled.
253
263
  # @param [flex_flow.IntegrationType] integration_type The software that will
@@ -282,10 +292,10 @@ module Twilio
282
292
  # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
283
293
  # will remove active Proxy sessions if the associated Task is deleted outside of
284
294
  # the Flex UI. Defaults to `false`.
285
- # @param [String] integration_retry_count The number of times to retry the webhook
286
- # if the first attempt fails. Can be an integer between 0 and 3 (inclusive),
287
- # default is 3. Optional when `integrationType` is `external`, not applicable
288
- # otherwise.
295
+ # @param [String] integration_retry_count The number of times to retry the Studio
296
+ # Flow or webhook in case of failure. Takes integer values from 0 to 3 with the
297
+ # default being 3. Optional when `integrationType` is `studio` or `external`, not
298
+ # applicable otherwise.
289
299
  # @return [FlexFlowInstance] Updated FlexFlowInstance
290
300
  def update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset)
291
301
  data = Twilio::Values.of({
@@ -475,8 +485,13 @@ module Twilio
475
485
  # @param [String] friendly_name A descriptive string that you create to describe
476
486
  # the Flex Flow resource.
477
487
  # @param [String] chat_service_sid The SID of the chat service.
478
- # @param [flex_flow.ChannelType] channel_type The channel type. Can be: `web`,
479
- # `facebook`, `sms`, `whatsapp`, `line` or `custom`.
488
+ # @param [flex_flow.ChannelType] channel_type The channel type. One of `web`,
489
+ # `facebook`, `sms`, `whatsapp`, `line` or `custom`. By default, Studio’s Send to
490
+ # Flex widget passes it on to the Task attributes for Tasks created based on this
491
+ # Flex Flow. The Task attributes will be used by the Flex UI to render the
492
+ # respective Task as appropriate (applying channel-specific design and length
493
+ # limits). If `channelType` is `facebook`, `whatsapp` or `line`, the Send to Flex
494
+ # widget should set the Task Channel to Programmable Chat.
480
495
  # @param [String] contact_identity The channel contact's Identity.
481
496
  # @param [Boolean] enabled Whether the new Flex Flow is enabled.
482
497
  # @param [flex_flow.IntegrationType] integration_type The software that will
@@ -511,10 +526,10 @@ module Twilio
511
526
  # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
512
527
  # will remove active Proxy sessions if the associated Task is deleted outside of
513
528
  # the Flex UI. Defaults to `false`.
514
- # @param [String] integration_retry_count The number of times to retry the webhook
515
- # if the first attempt fails. Can be an integer between 0 and 3 (inclusive),
516
- # default is 3. Optional when `integrationType` is `external`, not applicable
517
- # otherwise.
529
+ # @param [String] integration_retry_count The number of times to retry the Studio
530
+ # Flow or webhook in case of failure. Takes integer values from 0 to 3 with the
531
+ # default being 3. Optional when `integrationType` is `studio` or `external`, not
532
+ # applicable otherwise.
518
533
  # @return [FlexFlowInstance] Updated FlexFlowInstance
519
534
  def update(friendly_name: :unset, chat_service_sid: :unset, channel_type: :unset, contact_identity: :unset, enabled: :unset, integration_type: :unset, integration_flow_sid: :unset, integration_url: :unset, integration_workspace_sid: :unset, integration_workflow_sid: :unset, integration_channel: :unset, integration_timeout: :unset, integration_priority: :unset, integration_creation_on_message: :unset, long_lived: :unset, janitor_enabled: :unset, integration_retry_count: :unset)
520
535
  context.update(