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

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, room_sid: nil, sid: nil) ⇒ ParticipantInstance

Initialize the ParticipantInstance

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 Participant resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 544

def initialize(version, payload , room_sid: nil, sid: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'room_sid' => payload['room_sid'],
        'account_sid' => payload['account_sid'],
        'status' => payload['status'],
        'identity' => payload['identity'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'start_time' => Twilio.deserialize_iso8601_datetime(payload['start_time']),
        'end_time' => Twilio.deserialize_iso8601_datetime(payload['end_time']),
        'duration' => payload['duration'] == nil ? payload['duration'] : payload['duration'].to_i,
        'url' => payload['url'],
        'links' => payload['links'],
    }

    # Context
    @instance_context = nil
    @params = { 'room_sid' => room_sid  || @properties['room_sid']  ,'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 RoomParticipant resource.

Returns:



594
595
596
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 594

def 
    @properties['account_sid']
end

#anonymizeanonymize

Access the anonymize

Returns:



690
691
692
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 690

def anonymize
    context.anonymize
end

#contextParticipantContext

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

Returns:



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

def context
    unless @instance_context
        @instance_context = ParticipantContext.new(@version , @params['room_sid'], @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:



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

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:



618
619
620
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 618

def date_updated
    @properties['date_updated']
end

#durationString

Returns The duration in seconds that the participant was ‘connected`. Populated only after the participant is `disconnected`.

Returns:

  • (String)

    The duration in seconds that the participant was ‘connected`. Populated only after the participant is `disconnected`.



636
637
638
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 636

def duration
    @properties['duration']
end

#end_timeTime

Returns The time when the participant disconnected from the room in [ISO 8601](en.wikipedia.org/wiki/ISO_8601#UTC) format.

Returns:



630
631
632
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 630

def end_time
    @properties['end_time']
end

#fetchParticipantInstance

Fetch the ParticipantInstance

Returns:



655
656
657
658
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 655

def fetch

    context.fetch
end

#identityString

Returns The application-defined string that uniquely identifies the resource’s User within a Room. If a client joins with an existing Identity, the existing client is disconnected. See [access tokens](www.twilio.com/docs/video/tutorials/user-identity-access-tokens) and [limits](www.twilio.com/docs/video/programmable-video-limits) for more info.

Returns:



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

def identity
    @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



710
711
712
713
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 710

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

Returns The URLs of related resources.

Returns:

  • (Hash)

    The URLs of related resources.



648
649
650
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 648

def links
    @properties['links']
end

#published_trackspublished_tracks

Access the published_tracks

Returns:



697
698
699
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 697

def published_tracks
    context.published_tracks
end

#room_sidString

Returns The SID of the participant’s room.

Returns:

  • (String)

    The SID of the participant’s room.



588
589
590
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 588

def room_sid
    @properties['room_sid']
end

#sidString

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

Returns:

  • (String)

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



582
583
584
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 582

def sid
    @properties['sid']
end

#start_timeTime

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

Returns:



624
625
626
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 624

def start_time
    @properties['start_time']
end

#statusStatus

Returns:

  • (Status)


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

def status
    @properties['status']
end

#subscribe_rulessubscribe_rules

Access the subscribe_rules

Returns:



676
677
678
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 676

def subscribe_rules
    context.subscribe_rules
end

#subscribed_trackssubscribed_tracks

Access the subscribed_tracks

Returns:



683
684
685
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 683

def subscribed_tracks
    context.subscribed_tracks
end

#to_sObject

Provide a user friendly representation



703
704
705
706
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 703

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

#update(status: :unset) ⇒ ParticipantInstance

Update the ParticipantInstance

Parameters:

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

Returns:



664
665
666
667
668
669
670
671
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 664

def update(
  status: :unset
)

    context.update(
        status: status, 
    )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource.



642
643
644
# File 'lib/twilio-ruby/rest/video/v1/room/participant.rb', line 642

def url
    @properties['url']
end