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

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/video/v1/room.rb,
lib/twilio-ruby/rest/video/v1/room/participant.rb,
lib/twilio-ruby/rest/video/v1/room/room_recording.rb,
lib/twilio-ruby/rest/video/v1/room/recording_rules.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: ParticipantContext, ParticipantInstance, ParticipantList, ParticipantPage, RecordingRulesInstance, RecordingRulesList, RecordingRulesPage, RoomRecordingContext, RoomRecordingInstance, RoomRecordingList, RoomRecordingPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ RoomContext

Initialize the RoomContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Room resource to update.



227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 227

def initialize(version, sid)
    super(version)

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

    # Dependents
    @recording_rules = nil
    @participants = nil
    @recordings = nil
end

Instance Method Details

#fetchRoomInstance

Fetch the RoomInstance

Returns:



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 242

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    RoomInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



343
344
345
346
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 343

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

#participants(sid = :unset) ⇒ ParticipantList, ParticipantContext

Access the participants

Returns:

Raises:

  • (ArgumentError)


299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 299

def participants(sid=:unset)

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

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

    unless @participants
        @participants = ParticipantList.new(
            @version, room_sid: @solution[:sid], )
    end

 @participants
end

#recording_rulesRecordingRulesList, RecordingRulesContext

Access the recording_rules

Returns:



288
289
290
291
292
293
294
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 288

def recording_rules
  unless @recording_rules
    @recording_rules = RecordingRulesList.new(
            @version, room_sid: @solution[:sid], )
  end
  @recording_rules
end

#recordings(sid = :unset) ⇒ RoomRecordingList, RoomRecordingContext

Access the recordings

Returns:

Raises:

  • (ArgumentError)


318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 318

def recordings(sid=:unset)

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

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

    unless @recordings
        @recordings = RoomRecordingList.new(
            @version, room_sid: @solution[:sid], )
    end

 @recordings
end

#to_sObject

Provide a user friendly representation



336
337
338
339
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 336

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

#update(status: nil) ⇒ RoomInstance

Update the RoomInstance

Parameters:

  • status (RoomStatus) (defaults to: nil)

Returns:



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 262

def update(
    status: nil
)

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

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    RoomInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end