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)

    The sid



302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 302

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.



351
352
353
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 351

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:



330
331
332
333
334
335
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 330

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.



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

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.



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

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.



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

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.



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

def end_time
  @properties['end_time']
end

#fetchParticipantInstance

Fetch a ParticipantInstance

Returns:



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

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.



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

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

Returns The links.

Returns:

  • (String)

    The links



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

def links
  @properties['links']
end

#published_trackspublished_tracks

Access the published_tracks

Returns:



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

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.



345
346
347
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 345

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.



339
340
341
# File 'lib/twilio-ruby/rest/video/v1/room/room_participant.rb', line 339

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.



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

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.



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

def status
  @properties['status']
end

#subscribed_trackssubscribed_tracks

Access the subscribed_tracks

Returns:



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

def subscribed_tracks
  context.subscribed_tracks
end

#to_sObject

Provide a user friendly representation



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

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:



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

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.



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

def url
  @properties['url']
end