Class: Twilio::REST::Video::V1::RoomContext::ParticipantContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/video/v1/room/participant.rb,
lib/twilio-ruby/rest/video/v1/room/participant/anonymize.rb,
lib/twilio-ruby/rest/video/v1/room/participant/published_track.rb,
lib/twilio-ruby/rest/video/v1/room/participant/subscribe_rules.rb,
lib/twilio-ruby/rest/video/v1/room/participant/subscribed_track.rb

Defined Under Namespace

Classes: AnonymizeContext, AnonymizeInstance, AnonymizeList, AnonymizePage, PublishedTrackContext, PublishedTrackInstance, PublishedTrackList, PublishedTrackPage, SubscribeRulesInstance, SubscribeRulesList, SubscribeRulesPage, SubscribedTrackContext, SubscribedTrackInstance, SubscribedTrackList, SubscribedTrackPage

Instance Method Summary collapse

Constructor Details

#initialize(version, room_sid, sid) ⇒ ParticipantContext

Initialize the ParticipantContext

Parameters:

  • version (Version)

    Version that contains the resource

  • room_sid (String)

    The SID of the room with the participant to update.

  • sid (String)

    The SID of the RoomParticipant resource to update.



159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 159

def initialize(version, room_sid, sid)
    super(version)

    # Path Solution
    @solution = { room_sid: room_sid, sid: sid,  }
    @uri = "/Rooms/#{@solution[:room_sid]}/Participants/#{@solution[:sid]}"

    # Dependents
    @subscribe_rules = nil
    @subscribed_tracks = nil
    @anonymize = nil
    @published_tracks = nil
end

Instance Method Details

#anonymizeAnonymizeList, AnonymizeContext

Access the anonymize



241
242
243
244
245
246
247
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 241

def anonymize
    AnonymizeContext.new(
            @version,
            @solution[:room_sid],
            @solution[:sid]
            )
end

#fetchParticipantInstance

Fetch the ParticipantInstance

Returns:



175
176
177
178
179
180
181
182
183
184
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 175

def fetch

    payload = @version.fetch('GET', @uri)
    ParticipantInstance.new(
        @version,
        payload,
        room_sid: @solution[:room_sid],
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



277
278
279
280
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 277

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Video.V1.ParticipantContext #{context}>"
end

#published_tracks(sid = :unset) ⇒ PublishedTrackList, PublishedTrackContext

Access the published_tracks

Returns:

Raises:

  • (ArgumentError)


252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 252

def published_tracks(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return PublishedTrackContext.new(@version, @solution[:room_sid], @solution[:sid],sid )
    end

    unless @published_tracks
        @published_tracks = PublishedTrackList.new(
            @version, room_sid: @solution[:room_sid], participant_sid: @solution[:sid], )
    end

 @published_tracks
end

#subscribe_rulesSubscribeRulesList, SubscribeRulesContext

Access the subscribe_rules

Returns:



211
212
213
214
215
216
217
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 211

def subscribe_rules
  unless @subscribe_rules
    @subscribe_rules = SubscribeRulesList.new(
            @version, room_sid: @solution[:room_sid], participant_sid: @solution[:sid], )
  end
  @subscribe_rules
end

#subscribed_tracks(sid = :unset) ⇒ SubscribedTrackList, SubscribedTrackContext

Access the subscribed_tracks

Returns:

Raises:

  • (ArgumentError)


222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 222

def subscribed_tracks(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return SubscribedTrackContext.new(@version, @solution[:room_sid], @solution[:sid],sid )
    end

    unless @subscribed_tracks
        @subscribed_tracks = SubscribedTrackList.new(
            @version, room_sid: @solution[:room_sid], participant_sid: @solution[:sid], )
    end

 @subscribed_tracks
end

#to_sObject

Provide a user friendly representation



270
271
272
273
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 270

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Video.V1.ParticipantContext #{context}>"
end

#update(status: :unset) ⇒ ParticipantInstance

Update the ParticipantInstance

Parameters:

  • status (Status) (defaults to: :unset)

Returns:



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 190

def update(
    status: :unset
)

    data = Twilio::Values.of({
        'Status' => status,
    })

    payload = @version.update('POST', @uri, data: data)
    ParticipantInstance.new(
        @version,
        payload,
        room_sid: @solution[:room_sid],
        sid: @solution[:sid],
    )
end