twilio-ruby 5.22.3 → 5.23.0
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 +4 -4
- data/CHANGES.md +27 -0
- data/README.md +2 -4
- data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +14 -0
- data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v1.rb +4 -2
- data/lib/twilio-ruby/rest/chat/v1/credential.rb +68 -47
- data/lib/twilio-ruby/rest/chat/v1/service.rb +311 -320
- data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +59 -41
- data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +52 -40
- data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +71 -64
- data/lib/twilio-ruby/rest/chat/v1/service/channel/message.rb +58 -40
- data/lib/twilio-ruby/rest/chat/v1/service/role.rb +39 -29
- data/lib/twilio-ruby/rest/chat/v1/service/user.rb +51 -48
- data/lib/twilio-ruby/rest/chat/v1/service/user/user_channel.rb +16 -12
- data/lib/twilio-ruby/rest/insights/v1/summary.rb +13 -4
- data/lib/twilio-ruby/rest/ip_messaging/v1.rb +4 -2
- data/lib/twilio-ruby/rest/ip_messaging/v1/credential.rb +68 -47
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +311 -320
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +59 -41
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +52 -40
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +71 -64
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/message.rb +58 -40
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +39 -29
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user.rb +51 -48
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/user/user_channel.rb +16 -12
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +1 -1
- data/lib/twilio-ruby/rest/preview.rb +25 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +49 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/current_call.rb +217 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/device.rb +146 -0
- data/lib/twilio-ruby/rest/preview/trusted_comms/phone_call.rb +169 -0
- data/lib/twilio-ruby/rest/serverless/v1.rb +2 -1
- data/lib/twilio-ruby/rest/serverless/v1/service.rb +4 -2
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_channel.rb +30 -9
- data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +1 -1
- data/lib/twilio-ruby/rest/video/v1/room/room_participant.rb +39 -6
- data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribe_rule.rb +191 -0
- data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_subscribed_track.rb +133 -99
- data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +3 -3
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/conference_spec.rb +86 -2
- data/spec/integration/api/v2010/account/connect_app_spec.rb +28 -6
- data/spec/integration/api/v2010/account/queue/member_spec.rb +4 -4
- data/spec/integration/insights/v1/summary_spec.rb +1 -0
- data/spec/integration/preview/trusted_comms/current_call_spec.rb +46 -0
- data/spec/integration/preview/trusted_comms/device_spec.rb +45 -0
- data/spec/integration/preview/trusted_comms/phone_call_spec.rb +48 -0
- data/spec/integration/taskrouter/v1/workspace/task_channel_spec.rb +6 -0
- data/spec/integration/video/v1/room/room_participant/room_participant_subscribe_rule_spec.rb +92 -0
- data/spec/integration/video/v1/room/room_participant/room_participant_subscribed_track_spec.rb +31 -68
- data/spec/integration/video/v1/room/room_participant_spec.rb +6 -3
- data/spec/integration/wireless/v1/sim/data_session_spec.rb +2 -2
- metadata +15 -2
@@ -0,0 +1,169 @@
|
|
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 Preview < Domain
|
12
|
+
class TrustedComms < Version
|
13
|
+
##
|
14
|
+
# 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.
|
15
|
+
class PhoneCallList < ListResource
|
16
|
+
##
|
17
|
+
# Initialize the PhoneCallList
|
18
|
+
# @param [Version] version Version that contains the resource
|
19
|
+
# @return [PhoneCallList] PhoneCallList
|
20
|
+
def initialize(version)
|
21
|
+
super(version)
|
22
|
+
|
23
|
+
# Path Solution
|
24
|
+
@solution = {}
|
25
|
+
@uri = "/Business/PhoneCalls"
|
26
|
+
end
|
27
|
+
|
28
|
+
##
|
29
|
+
# Retrieve a single page of PhoneCallInstance records from the API.
|
30
|
+
# Request is executed immediately.
|
31
|
+
# @param [String] from The originating Phone Number that belongs to the Account,
|
32
|
+
# given in E.164 format (https://en.wikipedia.org/wiki/E.164).
|
33
|
+
# @param [String] to The terminating Phone Number, given in E.164 format
|
34
|
+
# (https://en.wikipedia.org/wiki/E.164).
|
35
|
+
# @param [String] url The Twiml URL to manage this phone call.
|
36
|
+
# @param [String] reason The business reason for this phone call that will appear
|
37
|
+
# in the terminating device's screen.
|
38
|
+
# @return [PhoneCallInstance] Newly created PhoneCallInstance
|
39
|
+
def create(from: nil, to: nil, url: nil, reason: :unset)
|
40
|
+
data = Twilio::Values.of({'From' => from, 'To' => to, 'Url' => url, 'Reason' => reason, })
|
41
|
+
|
42
|
+
payload = @version.create(
|
43
|
+
'POST',
|
44
|
+
@uri,
|
45
|
+
data: data
|
46
|
+
)
|
47
|
+
|
48
|
+
PhoneCallInstance.new(@version, payload, )
|
49
|
+
end
|
50
|
+
|
51
|
+
##
|
52
|
+
# Provide a user friendly representation
|
53
|
+
def to_s
|
54
|
+
'#<Twilio.Preview.TrustedComms.PhoneCallList>'
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
##
|
59
|
+
# 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.
|
60
|
+
class PhoneCallPage < Page
|
61
|
+
##
|
62
|
+
# Initialize the PhoneCallPage
|
63
|
+
# @param [Version] version Version that contains the resource
|
64
|
+
# @param [Response] response Response from the API
|
65
|
+
# @param [Hash] solution Path solution for the resource
|
66
|
+
# @return [PhoneCallPage] PhoneCallPage
|
67
|
+
def initialize(version, response, solution)
|
68
|
+
super(version, response)
|
69
|
+
|
70
|
+
# Path Solution
|
71
|
+
@solution = solution
|
72
|
+
end
|
73
|
+
|
74
|
+
##
|
75
|
+
# Build an instance of PhoneCallInstance
|
76
|
+
# @param [Hash] payload Payload response from the API
|
77
|
+
# @return [PhoneCallInstance] PhoneCallInstance
|
78
|
+
def get_instance(payload)
|
79
|
+
PhoneCallInstance.new(@version, payload, )
|
80
|
+
end
|
81
|
+
|
82
|
+
##
|
83
|
+
# Provide a user friendly representation
|
84
|
+
def to_s
|
85
|
+
'<Twilio.Preview.TrustedComms.PhoneCallPage>'
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# 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.
|
91
|
+
class PhoneCallInstance < InstanceResource
|
92
|
+
##
|
93
|
+
# Initialize the PhoneCallInstance
|
94
|
+
# @param [Version] version Version that contains the resource
|
95
|
+
# @param [Hash] payload payload that contains response from Twilio
|
96
|
+
# @return [PhoneCallInstance] PhoneCallInstance
|
97
|
+
def initialize(version, payload)
|
98
|
+
super(version)
|
99
|
+
|
100
|
+
# Marshaled Properties
|
101
|
+
@properties = {
|
102
|
+
'sid' => payload['sid'],
|
103
|
+
'account_sid' => payload['account_sid'],
|
104
|
+
'from' => payload['from'],
|
105
|
+
'to' => payload['to'],
|
106
|
+
'reason' => payload['reason'],
|
107
|
+
'created_at' => Twilio.deserialize_iso8601_datetime(payload['created_at']),
|
108
|
+
'url' => payload['url'],
|
109
|
+
}
|
110
|
+
end
|
111
|
+
|
112
|
+
##
|
113
|
+
# @return [String] A string that uniquely identifies this Current Call.
|
114
|
+
def sid
|
115
|
+
@properties['sid']
|
116
|
+
end
|
117
|
+
|
118
|
+
##
|
119
|
+
# @return [String] Account Sid.
|
120
|
+
def account_sid
|
121
|
+
@properties['account_sid']
|
122
|
+
end
|
123
|
+
|
124
|
+
##
|
125
|
+
# @return [String] The originating Phone Number
|
126
|
+
def from
|
127
|
+
@properties['from']
|
128
|
+
end
|
129
|
+
|
130
|
+
##
|
131
|
+
# @return [String] The terminating Phone Number
|
132
|
+
def to
|
133
|
+
@properties['to']
|
134
|
+
end
|
135
|
+
|
136
|
+
##
|
137
|
+
# @return [String] The business reason for this phone call
|
138
|
+
def reason
|
139
|
+
@properties['reason']
|
140
|
+
end
|
141
|
+
|
142
|
+
##
|
143
|
+
# @return [Time] The date this Current Call was created
|
144
|
+
def created_at
|
145
|
+
@properties['created_at']
|
146
|
+
end
|
147
|
+
|
148
|
+
##
|
149
|
+
# @return [String] The URL of this resource.
|
150
|
+
def url
|
151
|
+
@properties['url']
|
152
|
+
end
|
153
|
+
|
154
|
+
##
|
155
|
+
# Provide a user friendly representation
|
156
|
+
def to_s
|
157
|
+
"<Twilio.Preview.TrustedComms.PhoneCallInstance>"
|
158
|
+
end
|
159
|
+
|
160
|
+
##
|
161
|
+
# Provide a detailed, user friendly representation
|
162
|
+
def inspect
|
163
|
+
"<Twilio.Preview.TrustedComms.PhoneCallInstance>"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
end
|
169
|
+
end
|
@@ -19,7 +19,8 @@ module Twilio
|
|
19
19
|
end
|
20
20
|
|
21
21
|
##
|
22
|
-
# @param [String] sid
|
22
|
+
# @param [String] sid Identifier of the Serverless Service Instance. Either a SID
|
23
|
+
# or UniqueName.
|
23
24
|
# @return [Twilio::REST::Serverless::V1::ServiceContext] if sid was passed.
|
24
25
|
# @return [Twilio::REST::Serverless::V1::ServiceList]
|
25
26
|
def services(sid=:unset)
|
@@ -178,7 +178,8 @@ module Twilio
|
|
178
178
|
##
|
179
179
|
# Initialize the ServiceContext
|
180
180
|
# @param [Version] version Version that contains the resource
|
181
|
-
# @param [String] sid
|
181
|
+
# @param [String] sid Identifier of the Serverless Service Instance. Either a SID
|
182
|
+
# or UniqueName.
|
182
183
|
# @return [ServiceContext] ServiceContext
|
183
184
|
def initialize(version, sid)
|
184
185
|
super(version)
|
@@ -325,7 +326,8 @@ module Twilio
|
|
325
326
|
# Initialize the ServiceInstance
|
326
327
|
# @param [Version] version Version that contains the resource
|
327
328
|
# @param [Hash] payload payload that contains response from Twilio
|
328
|
-
# @param [String] sid
|
329
|
+
# @param [String] sid Identifier of the Serverless Service Instance. Either a SID
|
330
|
+
# or UniqueName.
|
329
331
|
# @return [ServiceInstance] ServiceInstance
|
330
332
|
def initialize(version, payload, sid: nil)
|
331
333
|
super(version)
|
@@ -114,9 +114,15 @@ module Twilio
|
|
114
114
|
# @param [String] friendly_name String representing user-friendly name for the
|
115
115
|
# TaskChannel
|
116
116
|
# @param [String] unique_name String representing unique name for the TaskChannel
|
117
|
+
# @param [Boolean] channel_optimized_routing A boolean that if true; mean that the
|
118
|
+
# channel will prioritize workers that have been idle
|
117
119
|
# @return [TaskChannelInstance] Newly created TaskChannelInstance
|
118
|
-
def create(friendly_name: nil, unique_name: nil)
|
119
|
-
data = Twilio::Values.of({
|
120
|
+
def create(friendly_name: nil, unique_name: nil, channel_optimized_routing: :unset)
|
121
|
+
data = Twilio::Values.of({
|
122
|
+
'FriendlyName' => friendly_name,
|
123
|
+
'UniqueName' => unique_name,
|
124
|
+
'ChannelOptimizedRouting' => channel_optimized_routing,
|
125
|
+
})
|
120
126
|
|
121
127
|
payload = @version.create(
|
122
128
|
'POST',
|
@@ -167,8 +173,9 @@ module Twilio
|
|
167
173
|
##
|
168
174
|
# Initialize the TaskChannelContext
|
169
175
|
# @param [Version] version Version that contains the resource
|
170
|
-
# @param [String] workspace_sid The
|
171
|
-
#
|
176
|
+
# @param [String] workspace_sid The unique ID of the Workspace that this
|
177
|
+
# TaskChannel belongs to.
|
178
|
+
# @param [String] sid The unique ID for this TaskChannel.
|
172
179
|
# @return [TaskChannelContext] TaskChannelContext
|
173
180
|
def initialize(version, workspace_sid, sid)
|
174
181
|
super(version)
|
@@ -201,9 +208,14 @@ module Twilio
|
|
201
208
|
##
|
202
209
|
# Update the TaskChannelInstance
|
203
210
|
# @param [String] friendly_name Toggle the FriendlyName for the TaskChannel
|
211
|
+
# @param [Boolean] channel_optimized_routing A boolean that if true; mean that the
|
212
|
+
# channel will prioritize workers that have been idle
|
204
213
|
# @return [TaskChannelInstance] Updated TaskChannelInstance
|
205
|
-
def update(friendly_name: :unset)
|
206
|
-
data = Twilio::Values.of({
|
214
|
+
def update(friendly_name: :unset, channel_optimized_routing: :unset)
|
215
|
+
data = Twilio::Values.of({
|
216
|
+
'FriendlyName' => friendly_name,
|
217
|
+
'ChannelOptimizedRouting' => channel_optimized_routing,
|
218
|
+
})
|
207
219
|
|
208
220
|
payload = @version.update(
|
209
221
|
'POST',
|
@@ -248,7 +260,7 @@ module Twilio
|
|
248
260
|
# @param [Hash] payload payload that contains response from Twilio
|
249
261
|
# @param [String] workspace_sid The unique ID of the Workspace that this
|
250
262
|
# TaskChannel belongs to.
|
251
|
-
# @param [String] sid The
|
263
|
+
# @param [String] sid The unique ID for this TaskChannel.
|
252
264
|
# @return [TaskChannelInstance] TaskChannelInstance
|
253
265
|
def initialize(version, payload, workspace_sid: nil, sid: nil)
|
254
266
|
super(version)
|
@@ -262,6 +274,7 @@ module Twilio
|
|
262
274
|
'sid' => payload['sid'],
|
263
275
|
'unique_name' => payload['unique_name'],
|
264
276
|
'workspace_sid' => payload['workspace_sid'],
|
277
|
+
'channel_optimized_routing' => payload['channel_optimized_routing'],
|
265
278
|
'url' => payload['url'],
|
266
279
|
'links' => payload['links'],
|
267
280
|
}
|
@@ -324,6 +337,12 @@ module Twilio
|
|
324
337
|
@properties['workspace_sid']
|
325
338
|
end
|
326
339
|
|
340
|
+
##
|
341
|
+
# @return [Boolean] If true then prioritize longest idle workers
|
342
|
+
def channel_optimized_routing
|
343
|
+
@properties['channel_optimized_routing']
|
344
|
+
end
|
345
|
+
|
327
346
|
##
|
328
347
|
# @return [String] The url
|
329
348
|
def url
|
@@ -346,9 +365,11 @@ module Twilio
|
|
346
365
|
##
|
347
366
|
# Update the TaskChannelInstance
|
348
367
|
# @param [String] friendly_name Toggle the FriendlyName for the TaskChannel
|
368
|
+
# @param [Boolean] channel_optimized_routing A boolean that if true; mean that the
|
369
|
+
# channel will prioritize workers that have been idle
|
349
370
|
# @return [TaskChannelInstance] Updated TaskChannelInstance
|
350
|
-
def update(friendly_name: :unset)
|
351
|
-
context.update(friendly_name: friendly_name, )
|
371
|
+
def update(friendly_name: :unset, channel_optimized_routing: :unset)
|
372
|
+
context.update(friendly_name: friendly_name, channel_optimized_routing: channel_optimized_routing, )
|
352
373
|
end
|
353
374
|
|
354
375
|
##
|
@@ -40,7 +40,7 @@ module Twilio
|
|
40
40
|
# for example, to dial an extension. For more information, see the Programmable
|
41
41
|
# Voice documentation of
|
42
42
|
# [sendDigits](https://www.twilio.com/docs/voice/twiml/number#attributes-sendDigits).
|
43
|
-
# @param [String] locale The
|
43
|
+
# @param [String] locale The locale to use for the verification SMS or call. Can
|
44
44
|
# be: `af`, `ar`, `ca`, `cs`, `da`, `de`, `el`, `en`, `es`, `fi`, `fr`, `he`,
|
45
45
|
# `hi`, `hr`, `hu`, `id`, `it`, `ja`, `ko`, `ms`, `nb`, `nl`, `pl`, `pt`, `pr-BR`,
|
46
46
|
# `ro`, `ru`, `sv`, `th`, `tl`, `tr`, `vi`, `zh`, `zh-CN`, or `zh-HK.`
|
@@ -198,8 +198,10 @@ module Twilio
|
|
198
198
|
##
|
199
199
|
# Initialize the ParticipantContext
|
200
200
|
# @param [Version] version Version that contains the resource
|
201
|
-
# @param [String] room_sid
|
202
|
-
#
|
201
|
+
# @param [String] room_sid A system-generated 34-character string that uniquely
|
202
|
+
# identifies a Room.
|
203
|
+
# @param [String] sid A system-generated 34-character string that uniquely
|
204
|
+
# identifies this Participant.
|
203
205
|
# @return [ParticipantContext] ParticipantContext
|
204
206
|
def initialize(version, room_sid, sid)
|
205
207
|
super(version)
|
@@ -211,6 +213,7 @@ module Twilio
|
|
211
213
|
# Dependents
|
212
214
|
@published_tracks = nil
|
213
215
|
@subscribed_tracks = nil
|
216
|
+
@subscribe_rules = nil
|
214
217
|
end
|
215
218
|
|
216
219
|
##
|
@@ -269,19 +272,41 @@ module Twilio
|
|
269
272
|
##
|
270
273
|
# Access the subscribed_tracks
|
271
274
|
# @return [SubscribedTrackList]
|
272
|
-
# @return [SubscribedTrackContext]
|
273
|
-
def subscribed_tracks
|
275
|
+
# @return [SubscribedTrackContext] if sid was passed.
|
276
|
+
def subscribed_tracks(sid=:unset)
|
277
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
278
|
+
|
279
|
+
if sid != :unset
|
280
|
+
return SubscribedTrackContext.new(@version, @solution[:room_sid], @solution[:sid], sid, )
|
281
|
+
end
|
282
|
+
|
274
283
|
unless @subscribed_tracks
|
275
284
|
@subscribed_tracks = SubscribedTrackList.new(
|
276
285
|
@version,
|
277
286
|
room_sid: @solution[:room_sid],
|
278
|
-
|
287
|
+
participant_sid: @solution[:sid],
|
279
288
|
)
|
280
289
|
end
|
281
290
|
|
282
291
|
@subscribed_tracks
|
283
292
|
end
|
284
293
|
|
294
|
+
##
|
295
|
+
# Access the subscribe_rules
|
296
|
+
# @return [SubscribeRulesList]
|
297
|
+
# @return [SubscribeRulesContext]
|
298
|
+
def subscribe_rules
|
299
|
+
unless @subscribe_rules
|
300
|
+
@subscribe_rules = SubscribeRulesList.new(
|
301
|
+
@version,
|
302
|
+
room_sid: @solution[:room_sid],
|
303
|
+
participant_sid: @solution[:sid],
|
304
|
+
)
|
305
|
+
end
|
306
|
+
|
307
|
+
@subscribe_rules
|
308
|
+
end
|
309
|
+
|
285
310
|
##
|
286
311
|
# Provide a user friendly representation
|
287
312
|
def to_s
|
@@ -304,7 +329,8 @@ module Twilio
|
|
304
329
|
# @param [Hash] payload payload that contains response from Twilio
|
305
330
|
# @param [String] room_sid A system-generated 34-character string that uniquely
|
306
331
|
# identifies. this room
|
307
|
-
# @param [String] sid
|
332
|
+
# @param [String] sid A system-generated 34-character string that uniquely
|
333
|
+
# identifies this Participant.
|
308
334
|
# @return [ParticipantInstance] ParticipantInstance
|
309
335
|
def initialize(version, payload, room_sid: nil, sid: nil)
|
310
336
|
super(version)
|
@@ -442,6 +468,13 @@ module Twilio
|
|
442
468
|
context.subscribed_tracks
|
443
469
|
end
|
444
470
|
|
471
|
+
##
|
472
|
+
# Access the subscribe_rules
|
473
|
+
# @return [subscribe_rules] subscribe_rules
|
474
|
+
def subscribe_rules
|
475
|
+
context.subscribe_rules
|
476
|
+
end
|
477
|
+
|
445
478
|
##
|
446
479
|
# Provide a user friendly representation
|
447
480
|
def to_s
|
@@ -0,0 +1,191 @@
|
|
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 Video < Domain
|
12
|
+
class V1 < Version
|
13
|
+
class RoomContext < InstanceContext
|
14
|
+
class ParticipantContext < InstanceContext
|
15
|
+
##
|
16
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
17
|
+
class SubscribeRulesList < ListResource
|
18
|
+
##
|
19
|
+
# Initialize the SubscribeRulesList
|
20
|
+
# @param [Version] version Version that contains the resource
|
21
|
+
# @param [String] room_sid The unique Room identifier for the Subscribe Rules
|
22
|
+
# @param [String] participant_sid The unique Participant identifier for the
|
23
|
+
# Subscribe Rules.
|
24
|
+
# @return [SubscribeRulesList] SubscribeRulesList
|
25
|
+
def initialize(version, room_sid: nil, participant_sid: nil)
|
26
|
+
super(version)
|
27
|
+
|
28
|
+
# Path Solution
|
29
|
+
@solution = {room_sid: room_sid, participant_sid: participant_sid}
|
30
|
+
@uri = "/Rooms/#{@solution[:room_sid]}/Participants/#{@solution[:participant_sid]}/SubscribeRules"
|
31
|
+
end
|
32
|
+
|
33
|
+
##
|
34
|
+
# Fetch a SubscribeRulesInstance
|
35
|
+
# @return [SubscribeRulesInstance] Fetched SubscribeRulesInstance
|
36
|
+
def fetch
|
37
|
+
params = Twilio::Values.of({})
|
38
|
+
|
39
|
+
payload = @version.fetch(
|
40
|
+
'GET',
|
41
|
+
@uri,
|
42
|
+
params,
|
43
|
+
)
|
44
|
+
|
45
|
+
SubscribeRulesInstance.new(
|
46
|
+
@version,
|
47
|
+
payload,
|
48
|
+
room_sid: @solution[:room_sid],
|
49
|
+
participant_sid: @solution[:participant_sid],
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
##
|
54
|
+
# Update the SubscribeRulesInstance
|
55
|
+
# @param [Hash] rules A JSON-encoded array of Subscribe Rules. See the [Subscribe
|
56
|
+
# Rule
|
57
|
+
# format](https://www.twilio.com/docs/video/api/track-subscriptions#specifying-sr)
|
58
|
+
# section for further information.
|
59
|
+
# @return [SubscribeRulesInstance] Updated SubscribeRulesInstance
|
60
|
+
def update(rules: :unset)
|
61
|
+
data = Twilio::Values.of({'Rules' => Twilio.serialize_object(rules), })
|
62
|
+
|
63
|
+
payload = @version.update(
|
64
|
+
'POST',
|
65
|
+
@uri,
|
66
|
+
data: data,
|
67
|
+
)
|
68
|
+
|
69
|
+
SubscribeRulesInstance.new(
|
70
|
+
@version,
|
71
|
+
payload,
|
72
|
+
room_sid: @solution[:room_sid],
|
73
|
+
participant_sid: @solution[:participant_sid],
|
74
|
+
)
|
75
|
+
end
|
76
|
+
|
77
|
+
##
|
78
|
+
# Provide a user friendly representation
|
79
|
+
def to_s
|
80
|
+
'#<Twilio.Video.V1.SubscribeRulesList>'
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
86
|
+
class SubscribeRulesPage < Page
|
87
|
+
##
|
88
|
+
# Initialize the SubscribeRulesPage
|
89
|
+
# @param [Version] version Version that contains the resource
|
90
|
+
# @param [Response] response Response from the API
|
91
|
+
# @param [Hash] solution Path solution for the resource
|
92
|
+
# @return [SubscribeRulesPage] SubscribeRulesPage
|
93
|
+
def initialize(version, response, solution)
|
94
|
+
super(version, response)
|
95
|
+
|
96
|
+
# Path Solution
|
97
|
+
@solution = solution
|
98
|
+
end
|
99
|
+
|
100
|
+
##
|
101
|
+
# Build an instance of SubscribeRulesInstance
|
102
|
+
# @param [Hash] payload Payload response from the API
|
103
|
+
# @return [SubscribeRulesInstance] SubscribeRulesInstance
|
104
|
+
def get_instance(payload)
|
105
|
+
SubscribeRulesInstance.new(
|
106
|
+
@version,
|
107
|
+
payload,
|
108
|
+
room_sid: @solution[:room_sid],
|
109
|
+
participant_sid: @solution[:participant_sid],
|
110
|
+
)
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# Provide a user friendly representation
|
115
|
+
def to_s
|
116
|
+
'<Twilio.Video.V1.SubscribeRulesPage>'
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
##
|
121
|
+
# PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
|
122
|
+
class SubscribeRulesInstance < InstanceResource
|
123
|
+
##
|
124
|
+
# Initialize the SubscribeRulesInstance
|
125
|
+
# @param [Version] version Version that contains the resource
|
126
|
+
# @param [Hash] payload payload that contains response from Twilio
|
127
|
+
# @param [String] room_sid The unique Room identifier for the Subscribe Rules
|
128
|
+
# @param [String] participant_sid The unique Participant identifier for the
|
129
|
+
# Subscribe Rules.
|
130
|
+
# @return [SubscribeRulesInstance] SubscribeRulesInstance
|
131
|
+
def initialize(version, payload, room_sid: nil, participant_sid: nil)
|
132
|
+
super(version)
|
133
|
+
|
134
|
+
# Marshaled Properties
|
135
|
+
@properties = {
|
136
|
+
'participant_sid' => payload['participant_sid'],
|
137
|
+
'room_sid' => payload['room_sid'],
|
138
|
+
'rules' => payload['rules'],
|
139
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
140
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
141
|
+
}
|
142
|
+
end
|
143
|
+
|
144
|
+
##
|
145
|
+
# @return [String] The unique Participant identifier for the Subscribe Rules.
|
146
|
+
def participant_sid
|
147
|
+
@properties['participant_sid']
|
148
|
+
end
|
149
|
+
|
150
|
+
##
|
151
|
+
# @return [String] The unique Room identifier for the Subscribe Rules
|
152
|
+
def room_sid
|
153
|
+
@properties['room_sid']
|
154
|
+
end
|
155
|
+
|
156
|
+
##
|
157
|
+
# @return [Hash] A collection of Subscribe Rules to include or exclude matching Tracks.
|
158
|
+
def rules
|
159
|
+
@properties['rules']
|
160
|
+
end
|
161
|
+
|
162
|
+
##
|
163
|
+
# @return [Time] The date that this resource was created.
|
164
|
+
def date_created
|
165
|
+
@properties['date_created']
|
166
|
+
end
|
167
|
+
|
168
|
+
##
|
169
|
+
# @return [Time] The date that this resource was last updated.
|
170
|
+
def date_updated
|
171
|
+
@properties['date_updated']
|
172
|
+
end
|
173
|
+
|
174
|
+
##
|
175
|
+
# Provide a user friendly representation
|
176
|
+
def to_s
|
177
|
+
"<Twilio.Video.V1.SubscribeRulesInstance>"
|
178
|
+
end
|
179
|
+
|
180
|
+
##
|
181
|
+
# Provide a detailed, user friendly representation
|
182
|
+
def inspect
|
183
|
+
"<Twilio.Video.V1.SubscribeRulesInstance>"
|
184
|
+
end
|
185
|
+
end
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|