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

  • account_sid (String)

    The SID of the Account that created this Room resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



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
402
403
404
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 370

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'] == nil ? payload['max_participants'] : payload['max_participants'].to_i,
        'max_participant_duration' => payload['max_participant_duration'] == nil ? payload['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'] == nil ? payload['empty_room_timeout'] : payload['empty_room_timeout'].to_i,
        'unused_room_timeout' => payload['unused_room_timeout'] == nil ? payload['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](www.twilio.com/docs/iam/api/account) that created the Room resource.

Returns:



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

def 
    @properties['account_sid']
end

#audio_onlyBoolean

Returns When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only.

Returns:

  • (Boolean)

    When set to true, indicates that the participants in the room will only publish audio. No video tracks will be allowed. Group rooms only.



527
528
529
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 527

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:



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

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

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



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

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



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

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.



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

def duration
    @properties['duration']
end

#empty_room_timeoutString

Returns Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed.

Returns:

  • (String)

    Specifies how long (in minutes) a room will remain active after last participant leaves. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed.



533
534
535
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 533

def empty_room_timeout
    @properties['empty_room_timeout']
end

#enable_turnBoolean

Returns Deprecated, now always considered to be true.

Returns:

  • (Boolean)

    Deprecated, now always considered to be true.



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

def enable_turn
    @properties['enable_turn']
end

#end_timeTime

Returns The UTC end time of the room in [ISO 8601](en.wikipedia.org/wiki/ISO_8601#UTC) format.

Returns:



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

def end_time
    @properties['end_time']
end

#fetchRoomInstance

Fetch the RoomInstance

Returns:



564
565
566
567
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 564

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



612
613
614
615
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 612

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.



545
546
547
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 545

def large_room
    @properties['large_room']
end

Returns The URLs of related resources.

Returns:

  • (Hash)

    The URLs of related resources.



557
558
559
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 557

def links
    @properties['links']
end

#max_concurrent_published_tracksString

Returns The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained.

Returns:

  • (String)

    The maximum number of published audio, video, and data tracks all participants combined are allowed to publish in the room at the same time. Check [Programmable Video Limits](www.twilio.com/docs/video/programmable-video-limits) for more details. If it is set to 0 it means unconstrained.



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

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. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours).

Returns:

  • (String)

    The maximum number of seconds a Participant can be connected to the room. The maximum possible value is 86400 seconds (24 hours). The default is 14400 seconds (4 hours).



497
498
499
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 497

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.



491
492
493
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 491

def max_participants
    @properties['max_participants']
end

#media_regionString

Returns The region for the media server in Group Rooms. Can be: one of the [available Media Regions](www.twilio.com/docs/video/ip-address-whitelisting#media-servers). ***This feature is not available in ‘peer-to-peer` rooms.***.

Returns:



521
522
523
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 521

def media_region
    @properties['media_region']
end

#participantsparticipants

Access the participants

Returns:



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

def participants
    context.participants
end

#record_participants_on_connectBoolean

Returns Whether to start recording when Participants connect. ***This feature is not available in ‘peer-to-peer` rooms.***.

Returns:

  • (Boolean)

    Whether to start recording when Participants connect. ***This feature is not available in ‘peer-to-peer` rooms.***



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

def record_participants_on_connect
    @properties['record_participants_on_connect']
end

#recording_rulesrecording_rules

Access the recording_rules

Returns:



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

def recording_rules
    context.recording_rules
end

#recordingsrecordings

Access the recordings

Returns:



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

def recordings
    context.recordings
end

#sidString

Returns The unique string that we created to identify the Room resource.

Returns:

  • (String)

    The unique string that we created to identify the Room resource.



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

def sid
    @properties['sid']
end

#statusRoomStatus

Returns:

  • (RoomStatus)


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

def status
    @properties['status']
end

#status_callbackString

Returns The URL we call using the ‘status_callback_method` to send status information to your application on every room event. See [Status Callbacks](www.twilio.com/docs/video/api/status-callbacks) for more info.

Returns:



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

def status_callback
    @properties['status_callback']
end

#status_callback_methodString

Returns The HTTP method we use to call ‘status_callback`. Can be `POST` or `GET` and defaults to `POST`.

Returns:

  • (String)

    The HTTP method we use to call ‘status_callback`. Can be `POST` or `GET` and defaults to `POST`.



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

def status_callback_method
    @properties['status_callback_method']
end

#to_sObject

Provide a user friendly representation



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

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

#typeRoomType

Returns:

  • (RoomType)


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

def type
    @properties['type']
end

#unique_nameString

Returns An application-defined string that uniquely identifies the resource. It can be used as a ‘room_sid` in place of the resource’s ‘sid` in the URL to address the resource, assuming it does not contain any [reserved characters](tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`.

Returns:

  • (String)

    An application-defined string that uniquely identifies the resource. It can be used as a ‘room_sid` in place of the resource’s ‘sid` in the URL to address the resource, assuming it does not contain any [reserved characters](tools.ietf.org/html/rfc3986#section-2.2) that would need to be URL encoded. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`.



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

def unique_name
    @properties['unique_name']
end

#unused_room_timeoutString

Returns Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed.

Returns:

  • (String)

    Specifies how long (in minutes) a room will remain active if no one joins. Can be configured when creating a room via REST API. For Ad-Hoc rooms this value cannot be changed.



539
540
541
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 539

def unused_room_timeout
    @properties['unused_room_timeout']
end

#update(status: nil) ⇒ RoomInstance

Update the RoomInstance

Parameters:

  • status (RoomStatus) (defaults to: nil)

Returns:



573
574
575
576
577
578
579
580
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 573

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.



551
552
553
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 551

def url
    @properties['url']
end

#video_codecsArray<VideoCodec>

Returns An array of the video codecs that are supported when publishing a track in the room. Can be: ‘VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms***.

Returns:

  • (Array<VideoCodec>)

    An array of the video codecs that are supported when publishing a track in the room. Can be: ‘VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms***



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

def video_codecs
    @properties['video_codecs']
end