twilio-ruby 5.59.0 → 5.61.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.github/workflows/deploy.yml +65 -0
- data/.github/workflows/test.yml +52 -0
- data/.gitignore +3 -1
- data/.rubocop.yml +1 -1
- data/CHANGES.md +91 -0
- data/Makefile +3 -4
- data/README.md +4 -4
- data/lib/twilio-ruby/jwt/access_token.rb +13 -0
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +3 -3
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/local.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/mobile.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number/toll_free.rb +7 -0
- data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +7 -0
- data/lib/twilio-ruby/rest/client.rb +7 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration/webhook.rb +269 -0
- data/lib/twilio-ruby/rest/conversations/v1/service/configuration.rb +8 -0
- data/lib/twilio-ruby/rest/flex_api/v1/configuration.rb +14 -0
- data/lib/twilio-ruby/rest/frontline_api/v1/user.rb +31 -6
- data/lib/twilio-ruby/rest/media/v1/media_processor.rb +384 -0
- data/lib/twilio-ruby/rest/media/v1/player_streamer/playback_grant.rb +221 -0
- data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +390 -0
- data/lib/twilio-ruby/rest/media/v1.rb +60 -0
- data/lib/twilio-ruby/rest/media.rb +56 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration/brand_vetting.rb +353 -0
- data/lib/twilio-ruby/rest/messaging/v1/brand_registration.rb +43 -1
- data/lib/twilio-ruby/rest/messaging/v1/service.rb +29 -3
- data/lib/twilio-ruby/rest/supersim/v1/ip_command.rb +416 -0
- data/lib/twilio-ruby/rest/supersim/v1.rb +16 -0
- data/lib/twilio-ruby/rest/supersim.rb +9 -0
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +8 -2
- data/lib/twilio-ruby/rest/verify/v2/service/access_token.rb +8 -2
- data/lib/twilio-ruby/rest/verify/v2/service/entity/factor.rb +16 -6
- data/lib/twilio-ruby/rest/verify/v2/service/entity/new_factor.rb +5 -5
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +9 -1
- data/lib/twilio-ruby/rest/verify/v2/service.rb +22 -3
- data/lib/twilio-ruby/rest/video/v1/room.rb +23 -1
- data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +3 -3
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +16 -26
- data/lib/twilio-ruby/twiml/voice_response.rb +613 -36
- data/lib/twilio-ruby/version.rb +1 -1
- metadata +14 -4
- data/.travis.yml +0 -57
@@ -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 webhook event triggers that are
|
88
|
+
# enabled for this Service. Possible values are `onParticipantAdd`,
|
89
|
+
# `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`,
|
90
|
+
# `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`,
|
91
|
+
# `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`,
|
92
|
+
# `onConversationAdded`, `onMessageAdded`, `onConversationAdd`,
|
93
|
+
# `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`,
|
94
|
+
# `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or
|
95
|
+
# `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 chat_service_sid
|
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 webhook event triggers that are enabled for this Service.
|
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 webhook event triggers that are
|
223
|
+
# enabled for this Service. Possible values are `onParticipantAdd`,
|
224
|
+
# `onParticipantAdded`, `onDeliveryUpdated`, `onConversationUpdated`,
|
225
|
+
# `onConversationRemove`, `onParticipantRemove`, `onConversationUpdate`,
|
226
|
+
# `onMessageAdd`, `onMessageRemoved`, `onParticipantUpdated`,
|
227
|
+
# `onConversationAdded`, `onMessageAdded`, `onConversationAdd`,
|
228
|
+
# `onConversationRemoved`, `onParticipantUpdate`, `onMessageRemove`,
|
229
|
+
# `onMessageUpdated`, `onParticipantRemoved`, `onMessageUpdate` or
|
230
|
+
# `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
|
@@ -94,10 +94,19 @@ module Twilio
|
|
94
94
|
# @param [String] avatar The avatar URL which will be shown in Frontline
|
95
95
|
# application.
|
96
96
|
# @param [user.StateType] state Current state of this user. Can be either `active`
|
97
|
-
# or `deactivated
|
97
|
+
# or `deactivated`.
|
98
|
+
# @param [Boolean] is_available Whether the User is available for new
|
99
|
+
# conversations. Set to `false` to prevent User from receiving new inbound
|
100
|
+
# conversations if you are using {Pool
|
101
|
+
# Routing}[https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing].
|
98
102
|
# @return [UserInstance] Updated UserInstance
|
99
|
-
def update(friendly_name: :unset, avatar: :unset, state: :unset)
|
100
|
-
data = Twilio::Values.of({
|
103
|
+
def update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset)
|
104
|
+
data = Twilio::Values.of({
|
105
|
+
'FriendlyName' => friendly_name,
|
106
|
+
'Avatar' => avatar,
|
107
|
+
'State' => state,
|
108
|
+
'IsAvailable' => is_available,
|
109
|
+
})
|
101
110
|
|
102
111
|
payload = @version.update('POST', @uri, data: data)
|
103
112
|
|
@@ -139,6 +148,7 @@ module Twilio
|
|
139
148
|
'friendly_name' => payload['friendly_name'],
|
140
149
|
'avatar' => payload['avatar'],
|
141
150
|
'state' => payload['state'],
|
151
|
+
'is_available' => payload['is_available'],
|
142
152
|
'url' => payload['url'],
|
143
153
|
}
|
144
154
|
|
@@ -188,6 +198,12 @@ module Twilio
|
|
188
198
|
@properties['state']
|
189
199
|
end
|
190
200
|
|
201
|
+
##
|
202
|
+
# @return [Boolean] Whether the User is available for new conversations
|
203
|
+
def is_available
|
204
|
+
@properties['is_available']
|
205
|
+
end
|
206
|
+
|
191
207
|
##
|
192
208
|
# @return [String] An absolute URL for this user.
|
193
209
|
def url
|
@@ -207,10 +223,19 @@ module Twilio
|
|
207
223
|
# @param [String] avatar The avatar URL which will be shown in Frontline
|
208
224
|
# application.
|
209
225
|
# @param [user.StateType] state Current state of this user. Can be either `active`
|
210
|
-
# or `deactivated
|
226
|
+
# or `deactivated`.
|
227
|
+
# @param [Boolean] is_available Whether the User is available for new
|
228
|
+
# conversations. Set to `false` to prevent User from receiving new inbound
|
229
|
+
# conversations if you are using {Pool
|
230
|
+
# Routing}[https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing].
|
211
231
|
# @return [UserInstance] Updated UserInstance
|
212
|
-
def update(friendly_name: :unset, avatar: :unset, state: :unset)
|
213
|
-
context.update(
|
232
|
+
def update(friendly_name: :unset, avatar: :unset, state: :unset, is_available: :unset)
|
233
|
+
context.update(
|
234
|
+
friendly_name: friendly_name,
|
235
|
+
avatar: avatar,
|
236
|
+
state: state,
|
237
|
+
is_available: is_available,
|
238
|
+
)
|
214
239
|
end
|
215
240
|
|
216
241
|
##
|