Class: Twilio::REST::Video::V1::RoomInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/video/v1/room.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ RoomInstance

Initialize the RoomInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The Room Sid or name that uniquely identifies this resource.



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 327

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'status' => payload['status'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'account_sid' => payload['account_sid'],
      'enable_turn' => payload['enable_turn'],
      'unique_name' => payload['unique_name'],
      'status_callback' => payload['status_callback'],
      'status_callback_method' => payload['status_callback_method'],
      'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
      'duration' => payload['duration'] == nil ? payload['duration'] : payload['duration'].to_i,
      'type' => payload['type'],
      'max_participants' => payload['max_participants'].to_i,
      'record_participants_on_connect' => payload['record_participants_on_connect'],
      'video_codecs' => payload['video_codecs'],
      'media_region' => payload['media_region'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The unique ID of the Account associated with this Room.

Returns:

  • (String)

    The unique ID of the Account associated with this Room.



394
395
396
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 394

def 
  @properties['account_sid']
end

#contextRoomContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



361
362
363
364
365
366
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 361

def context
  unless @instance_context
    @instance_context = RoomContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The date that this resource was created, given as a UTC ISO 8601 Timestamp.

Returns:

  • (Time)

    The date that this resource was created, given as a UTC ISO 8601 Timestamp.



382
383
384
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 382

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date that this resource was last updated, given as a UTC ISO 8601 Timestamp.

Returns:

  • (Time)

    The date that this resource was last updated, given as a UTC ISO 8601 Timestamp.



388
389
390
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 388

def date_updated
  @properties['date_updated']
end

#durationString

Returns The duration of the Room in seconds.

Returns:

  • (String)

    The duration of the Room in seconds.



430
431
432
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 430

def duration
  @properties['duration']
end

#enable_turnBoolean

Returns Enable Twilio’s Network Traversal TURN service.

Returns:

  • (Boolean)

    Enable Twilio’s Network Traversal TURN service.



400
401
402
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 400

def enable_turn
  @properties['enable_turn']
end

#end_timeTime

Returns The end time of the Room, given as a UTC ISO 8601 Timestamp.

Returns:

  • (Time)

    The end time of the Room, given as a UTC ISO 8601 Timestamp.



424
425
426
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 424

def end_time
  @properties['end_time']
end

#fetchRoomInstance

Fetch a RoomInstance

Returns:



479
480
481
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 479

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



514
515
516
517
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 514

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Video.V1.RoomInstance #{values}>"
end

Returns The links.

Returns:

  • (String)

    The links



472
473
474
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 472

def links
  @properties['links']
end

#max_participantsString

Returns Maximum number of concurrent Participants allowed in the Room.

Returns:

  • (String)

    Maximum number of concurrent Participants allowed in the Room.



442
443
444
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 442

def max_participants
  @properties['max_participants']
end

#media_regionString

Returns Region for the media server in Group Rooms.

Returns:

  • (String)

    Region for the media server in Group Rooms.



460
461
462
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 460

def media_region
  @properties['media_region']
end

#participantsparticipants

Access the participants

Returns:



501
502
503
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 501

def participants
  context.participants
end

#record_participants_on_connectBoolean

Returns Start recording when Participants connect.

Returns:

  • (Boolean)

    Start recording when Participants connect.



448
449
450
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 448

def record_participants_on_connect
  @properties['record_participants_on_connect']
end

#recordingsrecordings

Access the recordings

Returns:



494
495
496
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 494

def recordings
  context.recordings
end

#sidString

Returns A system-generated 34-character string that uniquely identifies this resource.

Returns:

  • (String)

    A system-generated 34-character string that uniquely identifies this resource.



370
371
372
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 370

def sid
  @properties['sid']
end

#statusroom.RoomStatus

Returns A string representing the status of the Room.

Returns:

  • (room.RoomStatus)

    A string representing the status of the Room.



376
377
378
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 376

def status
  @properties['status']
end

#status_callbackString

Returns A URL that Twilio sends asynchronous webhook requests to on every Room event.

Returns:

  • (String)

    A URL that Twilio sends asynchronous webhook requests to on every Room event.



412
413
414
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 412

def status_callback
  @properties['status_callback']
end

#status_callback_methodString

Returns HTTP method Twilio should use when requesting the above URL.

Returns:

  • (String)

    HTTP method Twilio should use when requesting the above URL.



418
419
420
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 418

def status_callback_method
  @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation



507
508
509
510
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 507

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Video.V1.RoomInstance #{values}>"
end

#typeroom.RoomType

Returns Type of Room, either peer-to-peer, group-small or group.

Returns:

  • (room.RoomType)

    Type of Room, either peer-to-peer, group-small or group.



436
437
438
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 436

def type
  @properties['type']
end

#unique_nameString

Returns A developer-supplied Name of the Room.

Returns:

  • (String)

    A developer-supplied Name of the Room.



406
407
408
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 406

def unique_name
  @properties['unique_name']
end

#update(status: nil) ⇒ RoomInstance

Update the RoomInstance

Parameters:

  • status (room.RoomStatus) (defaults to: nil)

    Set to ‘completed` to end the Room.

Returns:



487
488
489
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 487

def update(status: nil)
  context.update(status: status, )
end

#urlString

Returns The absolute URL for this resource.

Returns:

  • (String)

    The absolute URL for this resource.



466
467
468
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 466

def url
  @properties['url']
end

#video_codecsroom.VideoCodec

Returns The video_codecs.

Returns:

  • (room.VideoCodec)

    The video_codecs



454
455
456
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 454

def video_codecs
  @properties['video_codecs']
end