twilio-ruby 5.4.3 → 5.4.4
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 +12 -0
- data/README.md +2 -2
- data/lib/twilio-ruby/framework/serialize.rb +9 -0
- data/lib/twilio-ruby/http/http_client.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +8 -2
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +2 -2
- data/lib/twilio-ruby/rest/api/v2010/account/connect_app.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010/account/message.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v1/service/channel.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v1/service/channel/invite.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v1/service/channel/member.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v1/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/binding.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service/channel.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/channel/invite.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/channel/member.rb +1 -1
- data/lib/twilio-ruby/rest/chat/v2/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/chat/v2/service/user/user_binding.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/invite.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/channel/member.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v1/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/binding.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/invite.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/member.rb +1 -1
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/role.rb +2 -2
- data/lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb +1 -1
- data/lib/twilio-ruby/rest/lookups/v1/phone_number.rb +5 -1
- data/lib/twilio-ruby/rest/notify/v1/service/binding.rb +3 -3
- data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +4 -4
- data/lib/twilio-ruby/rest/notify/v1/service/user.rb +5 -2
- data/lib/twilio-ruby/rest/notify/v1/service/user/user_binding.rb +2 -2
- data/lib/twilio-ruby/rest/preview.rb +10 -3
- data/lib/twilio-ruby/rest/preview/hosted_numbers/authorization_document.rb +4 -4
- data/lib/twilio-ruby/rest/preview/hosted_numbers/hosted_number_order.rb +2 -2
- data/lib/twilio-ruby/rest/preview/proxy/service/session.rb +2 -2
- data/lib/twilio-ruby/rest/preview/proxy/service/session/participant/message_interaction.rb +1 -1
- data/lib/twilio-ruby/rest/preview/understand.rb +41 -0
- data/lib/twilio-ruby/rest/preview/understand/service.rb +503 -0
- data/lib/twilio-ruby/rest/preview/understand/service/field_type.rb +399 -0
- data/lib/twilio-ruby/rest/preview/understand/service/field_type/field_value.rb +375 -0
- data/lib/twilio-ruby/rest/preview/understand/service/intent.rb +421 -0
- data/lib/twilio-ruby/rest/preview/understand/service/intent/field.rb +371 -0
- data/lib/twilio-ruby/rest/preview/understand/service/intent/sample.rb +407 -0
- data/lib/twilio-ruby/rest/preview/understand/service/model_build.rb +358 -0
- data/lib/twilio-ruby/rest/preview/understand/service/query.rb +422 -0
- data/lib/twilio-ruby/rest/preview/wireless/rate_plan.rb +1 -1
- data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +2 -2
- data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +1 -1
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task.rb +1 -1
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +3 -3
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +3 -3
- data/lib/twilio-ruby/rest/video/v1/recording.rb +1 -1
- data/lib/twilio-ruby/rest/video/v1/room.rb +27 -1
- data/lib/twilio-ruby/rest/video/v1/room/room_participant.rb +407 -0
- data/lib/twilio-ruby/rest/video/v1/room/room_participant/room_participant_published_track.rb +326 -0
- data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +1 -1
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/framework/serialize_spec.rb +21 -0
- data/spec/integration/chat/v1/service/role_spec.rb +6 -2
- data/spec/integration/chat/v2/service/role_spec.rb +6 -2
- data/spec/integration/ip_messaging/v1/service/role_spec.rb +6 -2
- data/spec/integration/ip_messaging/v2/service/role_spec.rb +6 -2
- data/spec/integration/preview/hosted_numbers/authorization_document_spec.rb +1 -1
- data/spec/integration/preview/understand/service/field_type/field_value_spec.rb +205 -0
- data/spec/integration/preview/understand/service/field_type_spec.rb +244 -0
- data/spec/integration/preview/understand/service/intent/field_spec.rb +205 -0
- data/spec/integration/preview/understand/service/intent/sample_spec.rb +247 -0
- data/spec/integration/preview/understand/service/intent_spec.rb +252 -0
- data/spec/integration/preview/understand/service/model_build_spec.rb +231 -0
- data/spec/integration/preview/understand/service/query_spec.rb +300 -0
- data/spec/integration/preview/understand/service_spec.rb +256 -0
- data/spec/integration/video/v1/room/room_participant/room_participant_published_track_spec.rb +94 -0
- data/spec/integration/video/v1/room/room_participant_spec.rb +182 -0
- data/spec/integration/video/v1/room_spec.rb +4 -0
- metadata +33 -2
|
@@ -131,7 +131,7 @@ module Twilio
|
|
|
131
131
|
def page(priority: :unset, assignment_status: :unset, workflow_sid: :unset, workflow_name: :unset, task_queue_sid: :unset, task_queue_name: :unset, evaluate_task_attributes: :unset, ordering: :unset, has_addons: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
|
132
132
|
params = Twilio::Values.of({
|
|
133
133
|
'Priority' => priority,
|
|
134
|
-
'AssignmentStatus' => assignment_status,
|
|
134
|
+
'AssignmentStatus' => Twilio.serialize_list(assignment_status) { |e| e },
|
|
135
135
|
'WorkflowSid' => workflow_sid,
|
|
136
136
|
'WorkflowName' => workflow_name,
|
|
137
137
|
'TaskQueueSid' => task_queue_sid,
|
|
@@ -272,7 +272,7 @@ module Twilio
|
|
|
272
272
|
'From' => from,
|
|
273
273
|
'StatusCallback' => status_callback,
|
|
274
274
|
'StatusCallbackMethod' => status_callback_method,
|
|
275
|
-
'StatusCallbackEvent' => status_callback_event,
|
|
275
|
+
'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e },
|
|
276
276
|
'Timeout' => timeout,
|
|
277
277
|
'Record' => record,
|
|
278
278
|
'Muted' => muted,
|
|
@@ -285,7 +285,7 @@ module Twilio
|
|
|
285
285
|
'MaxParticipants' => max_participants,
|
|
286
286
|
'ConferenceStatusCallback' => conference_status_callback,
|
|
287
287
|
'ConferenceStatusCallbackMethod' => conference_status_callback_method,
|
|
288
|
-
'ConferenceStatusCallbackEvent' => conference_status_callback_event,
|
|
288
|
+
'ConferenceStatusCallbackEvent' => Twilio.serialize_list(conference_status_callback_event) { |e| e },
|
|
289
289
|
'ConferenceRecord' => conference_record,
|
|
290
290
|
'ConferenceTrim' => conference_trim,
|
|
291
291
|
'RecordingChannels' => recording_channels,
|
|
@@ -296,7 +296,7 @@ module Twilio
|
|
|
296
296
|
'Region' => region,
|
|
297
297
|
'SipAuthUsername' => sip_auth_username,
|
|
298
298
|
'SipAuthPassword' => sip_auth_password,
|
|
299
|
-
'DequeueStatusCallbackEvent' => dequeue_status_callback_event,
|
|
299
|
+
'DequeueStatusCallbackEvent' => Twilio.serialize_list(dequeue_status_callback_event) { |e| e },
|
|
300
300
|
'PostWorkActivitySid' => post_work_activity_sid,
|
|
301
301
|
})
|
|
302
302
|
|
|
@@ -272,7 +272,7 @@ module Twilio
|
|
|
272
272
|
'From' => from,
|
|
273
273
|
'StatusCallback' => status_callback,
|
|
274
274
|
'StatusCallbackMethod' => status_callback_method,
|
|
275
|
-
'StatusCallbackEvent' => status_callback_event,
|
|
275
|
+
'StatusCallbackEvent' => Twilio.serialize_list(status_callback_event) { |e| e },
|
|
276
276
|
'Timeout' => timeout,
|
|
277
277
|
'Record' => record,
|
|
278
278
|
'Muted' => muted,
|
|
@@ -285,7 +285,7 @@ module Twilio
|
|
|
285
285
|
'MaxParticipants' => max_participants,
|
|
286
286
|
'ConferenceStatusCallback' => conference_status_callback,
|
|
287
287
|
'ConferenceStatusCallbackMethod' => conference_status_callback_method,
|
|
288
|
-
'ConferenceStatusCallbackEvent' => conference_status_callback_event,
|
|
288
|
+
'ConferenceStatusCallbackEvent' => Twilio.serialize_list(conference_status_callback_event) { |e| e },
|
|
289
289
|
'ConferenceRecord' => conference_record,
|
|
290
290
|
'ConferenceTrim' => conference_trim,
|
|
291
291
|
'RecordingChannels' => recording_channels,
|
|
@@ -296,7 +296,7 @@ module Twilio
|
|
|
296
296
|
'Region' => region,
|
|
297
297
|
'SipAuthUsername' => sip_auth_username,
|
|
298
298
|
'SipAuthPassword' => sip_auth_password,
|
|
299
|
-
'DequeueStatusCallbackEvent' => dequeue_status_callback_event,
|
|
299
|
+
'DequeueStatusCallbackEvent' => Twilio.serialize_list(dequeue_status_callback_event) { |e| e },
|
|
300
300
|
'PostWorkActivitySid' => post_work_activity_sid,
|
|
301
301
|
})
|
|
302
302
|
|
|
@@ -110,7 +110,7 @@ module Twilio
|
|
|
110
110
|
params = Twilio::Values.of({
|
|
111
111
|
'Status' => status,
|
|
112
112
|
'SourceSid' => source_sid,
|
|
113
|
-
'GroupingSid' => grouping_sid,
|
|
113
|
+
'GroupingSid' => Twilio.serialize_list(grouping_sid) { |e| e },
|
|
114
114
|
'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
|
|
115
115
|
'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before),
|
|
116
116
|
'PageToken' => page_token,
|
|
@@ -44,7 +44,7 @@ module Twilio
|
|
|
44
44
|
'StatusCallbackMethod' => status_callback_method,
|
|
45
45
|
'MaxParticipants' => max_participants,
|
|
46
46
|
'RecordParticipantsOnConnect' => record_participants_on_connect,
|
|
47
|
-
'VideoCodecs' => video_codecs,
|
|
47
|
+
'VideoCodecs' => Twilio.serialize_list(video_codecs) { |e| e },
|
|
48
48
|
'MediaRegion' => media_region,
|
|
49
49
|
})
|
|
50
50
|
|
|
@@ -219,6 +219,7 @@ module Twilio
|
|
|
219
219
|
|
|
220
220
|
# Dependents
|
|
221
221
|
@recordings = nil
|
|
222
|
+
@participants = nil
|
|
222
223
|
end
|
|
223
224
|
|
|
224
225
|
##
|
|
@@ -270,6 +271,24 @@ module Twilio
|
|
|
270
271
|
@recordings
|
|
271
272
|
end
|
|
272
273
|
|
|
274
|
+
##
|
|
275
|
+
# Access the participants
|
|
276
|
+
# @return [RoomParticipantList]
|
|
277
|
+
# @return [RoomParticipantContext] if sid was passed.
|
|
278
|
+
def participants(sid=:unset)
|
|
279
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
|
280
|
+
|
|
281
|
+
if sid != :unset
|
|
282
|
+
return RoomParticipantContext.new(@version, @solution[:sid], sid,)
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
unless @participants
|
|
286
|
+
@participants = RoomParticipantList.new(@version, room_sid: @solution[:sid],)
|
|
287
|
+
end
|
|
288
|
+
|
|
289
|
+
@participants
|
|
290
|
+
end
|
|
291
|
+
|
|
273
292
|
##
|
|
274
293
|
# Provide a user friendly representation
|
|
275
294
|
def to_s
|
|
@@ -449,6 +468,13 @@ module Twilio
|
|
|
449
468
|
context.recordings
|
|
450
469
|
end
|
|
451
470
|
|
|
471
|
+
##
|
|
472
|
+
# Access the participants
|
|
473
|
+
# @return [participants] participants
|
|
474
|
+
def participants
|
|
475
|
+
context.participants
|
|
476
|
+
end
|
|
477
|
+
|
|
452
478
|
##
|
|
453
479
|
# Provide a user friendly representation
|
|
454
480
|
def to_s
|
|
@@ -0,0 +1,407 @@
|
|
|
1
|
+
##
|
|
2
|
+
# This code was generated by
|
|
3
|
+
# \ / _ _ _| _ _
|
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
|
5
|
+
# / /
|
|
6
|
+
|
|
7
|
+
module Twilio
|
|
8
|
+
module REST
|
|
9
|
+
class Video < Domain
|
|
10
|
+
class V1 < Version
|
|
11
|
+
class RoomContext < InstanceContext
|
|
12
|
+
class RoomParticipantList < ListResource
|
|
13
|
+
##
|
|
14
|
+
# Initialize the RoomParticipantList
|
|
15
|
+
# @param [Version] version Version that contains the resource
|
|
16
|
+
# @param [String] room_sid The room_sid
|
|
17
|
+
# @return [RoomParticipantList] RoomParticipantList
|
|
18
|
+
def initialize(version, room_sid: nil)
|
|
19
|
+
super(version)
|
|
20
|
+
|
|
21
|
+
# Path Solution
|
|
22
|
+
@solution = {room_sid: room_sid}
|
|
23
|
+
@uri = "/Rooms/#{@solution[:room_sid]}/Participants"
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
##
|
|
27
|
+
# Lists RoomParticipantInstance records from the API as a list.
|
|
28
|
+
# Unlike stream(), this operation is eager and will load `limit` records into
|
|
29
|
+
# memory before returning.
|
|
30
|
+
# @param [room_participant.Status] status The status
|
|
31
|
+
# @param [String] identity The identity
|
|
32
|
+
# @param [Time] date_created_after The date_created_after
|
|
33
|
+
# @param [Time] date_created_before The date_created_before
|
|
34
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
35
|
+
# guarantees to never return more than limit. Default is no limit
|
|
36
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
37
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
38
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
39
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
40
|
+
# @return [Array] Array of up to limit results
|
|
41
|
+
def list(status: :unset, identity: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil)
|
|
42
|
+
self.stream(
|
|
43
|
+
status: status,
|
|
44
|
+
identity: identity,
|
|
45
|
+
date_created_after: date_created_after,
|
|
46
|
+
date_created_before: date_created_before,
|
|
47
|
+
limit: limit,
|
|
48
|
+
page_size: page_size
|
|
49
|
+
).entries
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
##
|
|
53
|
+
# Streams RoomParticipantInstance records from the API as an Enumerable.
|
|
54
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
55
|
+
# is reached.
|
|
56
|
+
# @param [room_participant.Status] status The status
|
|
57
|
+
# @param [String] identity The identity
|
|
58
|
+
# @param [Time] date_created_after The date_created_after
|
|
59
|
+
# @param [Time] date_created_before The date_created_before
|
|
60
|
+
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
|
61
|
+
# guarantees to never return more than limit. Default is no limit.
|
|
62
|
+
# @param [Integer] page_size Number of records to fetch per request, when
|
|
63
|
+
# not set will use the default value of 50 records. If no page_size is defined
|
|
64
|
+
# but a limit is defined, stream() will attempt to read the limit with the most
|
|
65
|
+
# efficient page size, i.e. min(limit, 1000)
|
|
66
|
+
# @return [Enumerable] Enumerable that will yield up to limit results
|
|
67
|
+
def stream(status: :unset, identity: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil)
|
|
68
|
+
limits = @version.read_limits(limit, page_size)
|
|
69
|
+
|
|
70
|
+
page = self.page(
|
|
71
|
+
status: status,
|
|
72
|
+
identity: identity,
|
|
73
|
+
date_created_after: date_created_after,
|
|
74
|
+
date_created_before: date_created_before,
|
|
75
|
+
page_size: limits[:page_size],
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
@version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
##
|
|
82
|
+
# When passed a block, yields RoomParticipantInstance records from the API.
|
|
83
|
+
# This operation lazily loads records as efficiently as possible until the limit
|
|
84
|
+
# is reached.
|
|
85
|
+
def each
|
|
86
|
+
limits = @version.read_limits
|
|
87
|
+
|
|
88
|
+
page = self.page(page_size: limits[:page_size],)
|
|
89
|
+
|
|
90
|
+
@version.stream(page,
|
|
91
|
+
limit: limits[:limit],
|
|
92
|
+
page_limit: limits[:page_limit]).each {|x| yield x}
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
##
|
|
96
|
+
# Retrieve a single page of RoomParticipantInstance records from the API.
|
|
97
|
+
# Request is executed immediately.
|
|
98
|
+
# @param [room_participant.Status] status The status
|
|
99
|
+
# @param [String] identity The identity
|
|
100
|
+
# @param [Time] date_created_after The date_created_after
|
|
101
|
+
# @param [Time] date_created_before The date_created_before
|
|
102
|
+
# @param [String] page_token PageToken provided by the API
|
|
103
|
+
# @param [Integer] page_number Page Number, this value is simply for client state
|
|
104
|
+
# @param [Integer] page_size Number of records to return, defaults to 50
|
|
105
|
+
# @return [Page] Page of RoomParticipantInstance
|
|
106
|
+
def page(status: :unset, identity: :unset, date_created_after: :unset, date_created_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
|
|
107
|
+
params = Twilio::Values.of({
|
|
108
|
+
'Status' => status,
|
|
109
|
+
'Identity' => identity,
|
|
110
|
+
'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
|
|
111
|
+
'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before),
|
|
112
|
+
'PageToken' => page_token,
|
|
113
|
+
'Page' => page_number,
|
|
114
|
+
'PageSize' => page_size,
|
|
115
|
+
})
|
|
116
|
+
response = @version.page(
|
|
117
|
+
'GET',
|
|
118
|
+
@uri,
|
|
119
|
+
params
|
|
120
|
+
)
|
|
121
|
+
RoomParticipantPage.new(@version, response, @solution)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
##
|
|
125
|
+
# Retrieve a single page of RoomParticipantInstance records from the API.
|
|
126
|
+
# Request is executed immediately.
|
|
127
|
+
# @param [String] target_url API-generated URL for the requested results page
|
|
128
|
+
# @return [Page] Page of RoomParticipantInstance
|
|
129
|
+
def get_page(target_url)
|
|
130
|
+
response = @version.domain.request(
|
|
131
|
+
'GET',
|
|
132
|
+
target_url
|
|
133
|
+
)
|
|
134
|
+
RoomParticipantPage.new(@version, response, @solution)
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
##
|
|
138
|
+
# Provide a user friendly representation
|
|
139
|
+
def to_s
|
|
140
|
+
'#<Twilio.Video.V1.RoomParticipantList>'
|
|
141
|
+
end
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
class RoomParticipantPage < Page
|
|
145
|
+
##
|
|
146
|
+
# Initialize the RoomParticipantPage
|
|
147
|
+
# @param [Version] version Version that contains the resource
|
|
148
|
+
# @param [Response] response Response from the API
|
|
149
|
+
# @param [Hash] solution Path solution for the resource
|
|
150
|
+
# @return [RoomParticipantPage] RoomParticipantPage
|
|
151
|
+
def initialize(version, response, solution)
|
|
152
|
+
super(version, response)
|
|
153
|
+
|
|
154
|
+
# Path Solution
|
|
155
|
+
@solution = solution
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
##
|
|
159
|
+
# Build an instance of RoomParticipantInstance
|
|
160
|
+
# @param [Hash] payload Payload response from the API
|
|
161
|
+
# @return [RoomParticipantInstance] RoomParticipantInstance
|
|
162
|
+
def get_instance(payload)
|
|
163
|
+
RoomParticipantInstance.new(@version, payload, room_sid: @solution[:room_sid],)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
##
|
|
167
|
+
# Provide a user friendly representation
|
|
168
|
+
def to_s
|
|
169
|
+
'<Twilio.Video.V1.RoomParticipantPage>'
|
|
170
|
+
end
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
class RoomParticipantContext < InstanceContext
|
|
174
|
+
##
|
|
175
|
+
# Initialize the RoomParticipantContext
|
|
176
|
+
# @param [Version] version Version that contains the resource
|
|
177
|
+
# @param [String] room_sid The room_sid
|
|
178
|
+
# @param [String] sid The sid
|
|
179
|
+
# @return [RoomParticipantContext] RoomParticipantContext
|
|
180
|
+
def initialize(version, room_sid, sid)
|
|
181
|
+
super(version)
|
|
182
|
+
|
|
183
|
+
# Path Solution
|
|
184
|
+
@solution = {room_sid: room_sid, sid: sid,}
|
|
185
|
+
@uri = "/Rooms/#{@solution[:room_sid]}/Participants/#{@solution[:sid]}"
|
|
186
|
+
|
|
187
|
+
# Dependents
|
|
188
|
+
@published_tracks = nil
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
##
|
|
192
|
+
# Fetch a RoomParticipantInstance
|
|
193
|
+
# @return [RoomParticipantInstance] Fetched RoomParticipantInstance
|
|
194
|
+
def fetch
|
|
195
|
+
params = Twilio::Values.of({})
|
|
196
|
+
|
|
197
|
+
payload = @version.fetch(
|
|
198
|
+
'GET',
|
|
199
|
+
@uri,
|
|
200
|
+
params,
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
RoomParticipantInstance.new(@version, payload, room_sid: @solution[:room_sid], sid: @solution[:sid],)
|
|
204
|
+
end
|
|
205
|
+
|
|
206
|
+
##
|
|
207
|
+
# Update the RoomParticipantInstance
|
|
208
|
+
# @param [room_participant.Status] status The status
|
|
209
|
+
# @return [RoomParticipantInstance] Updated RoomParticipantInstance
|
|
210
|
+
def update(status: :unset)
|
|
211
|
+
data = Twilio::Values.of({'Status' => status,})
|
|
212
|
+
|
|
213
|
+
payload = @version.update(
|
|
214
|
+
'POST',
|
|
215
|
+
@uri,
|
|
216
|
+
data: data,
|
|
217
|
+
)
|
|
218
|
+
|
|
219
|
+
RoomParticipantInstance.new(@version, payload, room_sid: @solution[:room_sid], sid: @solution[:sid],)
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
##
|
|
223
|
+
# Access the published_tracks
|
|
224
|
+
# @return [PublishedTrackList]
|
|
225
|
+
# @return [PublishedTrackContext] if sid was passed.
|
|
226
|
+
def published_tracks(sid=:unset)
|
|
227
|
+
raise ArgumentError, 'sid cannot be nil' if sid.nil?
|
|
228
|
+
|
|
229
|
+
if sid != :unset
|
|
230
|
+
return PublishedTrackContext.new(@version, @solution[:room_sid], @solution[:sid], sid,)
|
|
231
|
+
end
|
|
232
|
+
|
|
233
|
+
unless @published_tracks
|
|
234
|
+
@published_tracks = PublishedTrackList.new(
|
|
235
|
+
@version,
|
|
236
|
+
room_sid: @solution[:room_sid],
|
|
237
|
+
participant_sid: @solution[:sid],
|
|
238
|
+
)
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
@published_tracks
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
##
|
|
245
|
+
# Provide a user friendly representation
|
|
246
|
+
def to_s
|
|
247
|
+
context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
|
|
248
|
+
"#<Twilio.Video.V1.RoomParticipantContext #{context}>"
|
|
249
|
+
end
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
class RoomParticipantInstance < InstanceResource
|
|
253
|
+
##
|
|
254
|
+
# Initialize the RoomParticipantInstance
|
|
255
|
+
# @param [Version] version Version that contains the resource
|
|
256
|
+
# @param [Hash] payload payload that contains response from Twilio
|
|
257
|
+
# @param [String] room_sid The room_sid
|
|
258
|
+
# @param [String] sid The sid
|
|
259
|
+
# @return [RoomParticipantInstance] RoomParticipantInstance
|
|
260
|
+
def initialize(version, payload, room_sid: nil, sid: nil)
|
|
261
|
+
super(version)
|
|
262
|
+
|
|
263
|
+
# Marshaled Properties
|
|
264
|
+
@properties = {
|
|
265
|
+
'sid' => payload['sid'],
|
|
266
|
+
'room_sid' => payload['room_sid'],
|
|
267
|
+
'account_sid' => payload['account_sid'],
|
|
268
|
+
'status' => payload['status'],
|
|
269
|
+
'identity' => payload['identity'],
|
|
270
|
+
'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
|
|
271
|
+
'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
|
|
272
|
+
'start_time' => Twilio.deserialize_iso8601_datetime(payload['start_time']),
|
|
273
|
+
'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
|
|
274
|
+
'duration' => payload['duration'] == nil ? payload['duration'] : payload['duration'].to_i,
|
|
275
|
+
'url' => payload['url'],
|
|
276
|
+
'links' => payload['links'],
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
# Context
|
|
280
|
+
@instance_context = nil
|
|
281
|
+
@params = {'room_sid' => room_sid, 'sid' => sid || @properties['sid'],}
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
##
|
|
285
|
+
# Generate an instance context for the instance, the context is capable of
|
|
286
|
+
# performing various actions. All instance actions are proxied to the context
|
|
287
|
+
# @return [RoomParticipantContext] RoomParticipantContext for this RoomParticipantInstance
|
|
288
|
+
def context
|
|
289
|
+
unless @instance_context
|
|
290
|
+
@instance_context = RoomParticipantContext.new(@version, @params['room_sid'], @params['sid'],)
|
|
291
|
+
end
|
|
292
|
+
@instance_context
|
|
293
|
+
end
|
|
294
|
+
|
|
295
|
+
##
|
|
296
|
+
# @return [String] The sid
|
|
297
|
+
def sid
|
|
298
|
+
@properties['sid']
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
##
|
|
302
|
+
# @return [String] The room_sid
|
|
303
|
+
def room_sid
|
|
304
|
+
@properties['room_sid']
|
|
305
|
+
end
|
|
306
|
+
|
|
307
|
+
##
|
|
308
|
+
# @return [String] The account_sid
|
|
309
|
+
def account_sid
|
|
310
|
+
@properties['account_sid']
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
##
|
|
314
|
+
# @return [room_participant.Status] The status
|
|
315
|
+
def status
|
|
316
|
+
@properties['status']
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
##
|
|
320
|
+
# @return [String] The identity
|
|
321
|
+
def identity
|
|
322
|
+
@properties['identity']
|
|
323
|
+
end
|
|
324
|
+
|
|
325
|
+
##
|
|
326
|
+
# @return [Time] The date_created
|
|
327
|
+
def date_created
|
|
328
|
+
@properties['date_created']
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
##
|
|
332
|
+
# @return [Time] The date_updated
|
|
333
|
+
def date_updated
|
|
334
|
+
@properties['date_updated']
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
##
|
|
338
|
+
# @return [Time] The start_time
|
|
339
|
+
def start_time
|
|
340
|
+
@properties['start_time']
|
|
341
|
+
end
|
|
342
|
+
|
|
343
|
+
##
|
|
344
|
+
# @return [Time] The end_time
|
|
345
|
+
def end_time
|
|
346
|
+
@properties['end_time']
|
|
347
|
+
end
|
|
348
|
+
|
|
349
|
+
##
|
|
350
|
+
# @return [String] The duration
|
|
351
|
+
def duration
|
|
352
|
+
@properties['duration']
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
##
|
|
356
|
+
# @return [String] The url
|
|
357
|
+
def url
|
|
358
|
+
@properties['url']
|
|
359
|
+
end
|
|
360
|
+
|
|
361
|
+
##
|
|
362
|
+
# @return [String] The links
|
|
363
|
+
def links
|
|
364
|
+
@properties['links']
|
|
365
|
+
end
|
|
366
|
+
|
|
367
|
+
##
|
|
368
|
+
# Fetch a RoomParticipantInstance
|
|
369
|
+
# @return [RoomParticipantInstance] Fetched RoomParticipantInstance
|
|
370
|
+
def fetch
|
|
371
|
+
context.fetch
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
##
|
|
375
|
+
# Update the RoomParticipantInstance
|
|
376
|
+
# @param [room_participant.Status] status The status
|
|
377
|
+
# @return [RoomParticipantInstance] Updated RoomParticipantInstance
|
|
378
|
+
def update(status: :unset)
|
|
379
|
+
context.update(status: status,)
|
|
380
|
+
end
|
|
381
|
+
|
|
382
|
+
##
|
|
383
|
+
# Access the published_tracks
|
|
384
|
+
# @return [published_tracks] published_tracks
|
|
385
|
+
def published_tracks
|
|
386
|
+
context.published_tracks
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
##
|
|
390
|
+
# Provide a user friendly representation
|
|
391
|
+
def to_s
|
|
392
|
+
values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
393
|
+
"<Twilio.Video.V1.RoomParticipantInstance #{values}>"
|
|
394
|
+
end
|
|
395
|
+
|
|
396
|
+
##
|
|
397
|
+
# Provide a detailed, user friendly representation
|
|
398
|
+
def inspect
|
|
399
|
+
values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
|
|
400
|
+
"<Twilio.Video.V1.RoomParticipantInstance #{values}>"
|
|
401
|
+
end
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
end
|
|
406
|
+
end
|
|
407
|
+
end
|