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

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/video/v1/room/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

  • room_sid (String) (defaults to: nil)

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

  • sid (String) (defaults to: nil)

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



335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 335

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, '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.



384
385
386
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 384

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



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

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



402
403
404
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 402

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.



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

def date_updated
  @properties['date_updated']
end

#durationString

Returns Duration of time in seconds this Participant was connected.

Returns:

  • (String)

    Duration of time in seconds this Participant was connected.



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

def duration
  @properties['duration']
end

#end_timeTime

Returns The time of Participant disconnected from the Room, given as a UTC ISO 8601 Timestamp.

Returns:

  • (Time)

    The time of Participant disconnected from the Room, given as a UTC ISO 8601 Timestamp.



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

def end_time
  @properties['end_time']
end

#fetchParticipantInstance

Fetch a ParticipantInstance

Returns:



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

def fetch
  context.fetch
end

#identityString

Returns The unique name identifier that is assigned to this Participant.

Returns:

  • (String)

    The unique name identifier that is assigned to this Participant.



396
397
398
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 396

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns The links.

Returns:

  • (String)

    The links



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

def links
  @properties['links']
end

#published_trackspublished_tracks

Access the published_tracks

Returns:



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

def published_tracks
  context.published_tracks
end

#room_sidString

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

Returns:

  • (String)

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



378
379
380
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 378

def room_sid
  @properties['room_sid']
end

#sidString

Returns A 34 character string that uniquely identifies this resource.

Returns:

  • (String)

    A 34 character string that uniquely identifies this resource.



372
373
374
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 372

def sid
  @properties['sid']
end

#start_timeTime

Returns The time of Participant connected to the Room, given as a UTC ISO 8601 Timestamp.

Returns:

  • (Time)

    The time of Participant connected to the Room, given as a UTC ISO 8601 Timestamp.



414
415
416
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 414

def start_time
  @properties['start_time']
end

#statusparticipant.Status

Returns A string representing the status of the Participant.

Returns:

  • (participant.Status)

    A string representing the status of the Participant.



390
391
392
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 390

def status
  @properties['status']
end

#subscribe_rulessubscribe_rules

Access the subscribe_rules

Returns:



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

def subscribe_rules
  context.subscribe_rules
end

#subscribed_trackssubscribed_tracks

Access the subscribed_tracks

Returns:



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

def subscribed_tracks
  context.subscribed_tracks
end

#to_sObject

Provide a user friendly representation



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

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 (participant.Status) (defaults to: :unset)

    Set to ‘disconnected` to remove participant.

Returns:



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

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

#urlString

Returns The absolute URL for this resource.

Returns:

  • (String)

    The absolute URL for this resource.



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

def url
  @properties['url']
end