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 SID of the Room resource to fetch.


367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 367

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,
      'max_participant_duration' => payload['max_participant_duration'].to_i,
      'max_concurrent_published_tracks' => payload['max_concurrent_published_tracks'] == nil ? payload['max_concurrent_published_tracks'] : payload['max_concurrent_published_tracks'].to_i,
      'record_participants_on_connect' => payload['record_participants_on_connect'],
      'video_codecs' => payload['video_codecs'],
      'media_region' => payload['media_region'],
      'audio_only' => payload['audio_only'],
      'empty_room_timeout' => payload['empty_room_timeout'].to_i,
      'unused_room_timeout' => payload['unused_room_timeout'].to_i,
      'large_room' => payload['large_room'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

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

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


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

def 
  @properties['account_sid']
end

#audio_onlyBoolean

Returns Indicates whether the room will only contain audio track participants for group rooms.

Returns:

  • (Boolean)

    Indicates whether the room will only contain audio track participants for group rooms.


524
525
526
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 524

def audio_only
  @properties['audio_only']
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:


407
408
409
410
411
412
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 407

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

#date_createdTime

Returns The ISO 8601 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was created


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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The ISO 8601 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The ISO 8601 date and time in GMT when the resource was last updated


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

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


476
477
478
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 476

def duration
  @properties['duration']
end

#empty_room_timeoutString

Returns The time a room will remain active after last participant leaves.

Returns:

  • (String)

    The time a room will remain active after last participant leaves.


530
531
532
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 530

def empty_room_timeout
  @properties['empty_room_timeout']
end

#enable_turnBoolean

Returns Enable Twilio's Network Traversal TURN service.

Returns:

  • (Boolean)

    Enable Twilio's Network Traversal TURN service


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

def enable_turn
  @properties['enable_turn']
end

#end_timeTime

Returns The UTC end time of the room in UTC ISO 8601 format.

Returns:

  • (Time)

    The UTC end time of the room in UTC ISO 8601 format


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

def end_time
  @properties['end_time']
end

#fetchRoomInstance

Fetch the RoomInstance

Returns:


561
562
563
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 561

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


604
605
606
607
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 604

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

#large_roomBoolean

Returns Indicates if this is a large room.

Returns:

  • (Boolean)

    Indicates if this is a large room.


542
543
544
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 542

def large_room
  @properties['large_room']
end

Returns The URLs of related resources.

Returns:

  • (String)

    The URLs of related resources


554
555
556
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 554

def links
  @properties['links']
end

#max_concurrent_published_tracksString

Returns The maximum number of published tracks allowed in the room at the same time.

Returns:

  • (String)

    The maximum number of published tracks allowed in the room at the same time


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

def max_concurrent_published_tracks
  @properties['max_concurrent_published_tracks']
end

#max_participant_durationString

Returns The maximum number of seconds a Participant can be connected to the room.

Returns:

  • (String)

    The maximum number of seconds a Participant can be connected to the room


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

def max_participant_duration
  @properties['max_participant_duration']
end

#max_participantsString

Returns The maximum number of concurrent Participants allowed in the room.

Returns:

  • (String)

    The maximum number of concurrent Participants allowed in the room


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

def max_participants
  @properties['max_participants']
end

#media_regionString

Returns The region for the media server in Group Rooms.

Returns:

  • (String)

    The region for the media server in Group Rooms


518
519
520
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 518

def media_region
  @properties['media_region']
end

#participantsparticipants

Access the participants

Returns:


584
585
586
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 584

def participants
  context.participants
end

#record_participants_on_connectBoolean

Returns Whether to start recording when Participants connect.

Returns:

  • (Boolean)

    Whether to start recording when Participants connect


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

def record_participants_on_connect
  @properties['record_participants_on_connect']
end

#recording_rulesrecording_rules

Access the recording_rules

Returns:


591
592
593
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 591

def recording_rules
  context.recording_rules
end

#recordingsrecordings

Access the recordings

Returns:


577
578
579
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 577

def recordings
  context.recordings
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


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

def sid
  @properties['sid']
end

#statusroom.RoomStatus

Returns The status of the room.

Returns:

  • (room.RoomStatus)

    The status of the room


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

def status
  @properties['status']
end

#status_callbackString

Returns The URL to send status information to your application.

Returns:

  • (String)

    The URL to send status information to your application


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

def status_callback
  @properties['status_callback']
end

#status_callback_methodString

Returns The HTTP method we use to call status_callback.

Returns:

  • (String)

    The HTTP method we use to call status_callback


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

def status_callback_method
  @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation


597
598
599
600
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 597

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

#typeroom.RoomType

Returns The type of room.

Returns:

  • (room.RoomType)

    The type of room


482
483
484
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 482

def type
  @properties['type']
end

#unique_nameString

Returns An application-defined string that uniquely identifies the resource.

Returns:

  • (String)

    An application-defined string that uniquely identifies the resource


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

def unique_name
  @properties['unique_name']
end

#unused_room_timeoutString

Returns The time a room will remain active when no one joins.

Returns:

  • (String)

    The time a room will remain active when no one joins.


536
537
538
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 536

def unused_room_timeout
  @properties['unused_room_timeout']
end

#update(status: nil) ⇒ RoomInstance

Update the RoomInstance

Parameters:

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

    The new status of the resource. Set to `completed` to end the room.

Returns:


570
571
572
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 570

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

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource


548
549
550
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 548

def url
  @properties['url']
end

#video_codecsArray[room.VideoCodec]

Returns An array of the video codecs that are supported when publishing a track in the room.

Returns:

  • (Array[room.VideoCodec])

    An array of the video codecs that are supported when publishing a track in the room


512
513
514
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 512

def video_codecs
  @properties['video_codecs']
end