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)

    The SID of the participant’s room.

  • sid (String) (defaults to: nil)

    The SID of the RoomParticipant resource to fetch.



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

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 SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource



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

def 
  @properties['account_sid']
end

#anonymizeanonymize

Access the anonymize

Returns:



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

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:



356
357
358
359
360
361
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 356

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



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

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



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

def date_updated
  @properties['date_updated']
end

#durationString

Returns Duration of time in seconds the participant was connected.

Returns:

  • (String)

    Duration of time in seconds the participant was connected



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

def duration
  @properties['duration']
end

#end_timeTime

Returns The time when the participant disconnected from the room in ISO 8601 format.

Returns:

  • (Time)

    The time when the participant disconnected from the room in ISO 8601 format



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

def end_time
  @properties['end_time']
end

#fetchParticipantInstance

Fetch the ParticipantInstance

Returns:



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

def fetch
  context.fetch
end

#identityString

Returns The string that identifies the resource’s User.

Returns:

  • (String)

    The string that identifies the resource’s User



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

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns The URLs of related resources.

Returns:

  • (String)

    The URLs of related resources



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

def links
  @properties['links']
end

#published_trackspublished_tracks

Access the published_tracks

Returns:



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

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



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

def room_sid
  @properties['room_sid']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource



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

def sid
  @properties['sid']
end

#start_timeTime

Returns The time of participant connected to the room in ISO 8601 format.

Returns:

  • (Time)

    The time of participant connected to the room in ISO 8601 format



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

def start_time
  @properties['start_time']
end

#statusparticipant.Status

Returns The status of the Participant.

Returns:

  • (participant.Status)

    The status of the Participant



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

def status
  @properties['status']
end

#subscribe_rulessubscribe_rules

Access the subscribe_rules

Returns:



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

def subscribe_rules
  context.subscribe_rules
end

#subscribed_trackssubscribed_tracks

Access the subscribed_tracks

Returns:



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

def subscribed_tracks
  context.subscribed_tracks
end

#to_sObject

Provide a user friendly representation



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

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)

    The new status of the resource. Can be: ‘connected` or `disconnected`. For `in-progress` Rooms the default Status is `connected`, for `completed` Rooms only `disconnected` Participants are returned.

Returns:



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

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



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

def url
  @properties['url']
end