Class: Twilio::REST::Insights::V1::RoomContext::ParticipantInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/insights/v1/room/participant.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, room_sid: nil, participant_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)

    Unique identifier for the room.

  • participant_sid (String) (defaults to: nil)

    The SID of the Participant resource.


204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 204

def initialize(version, payload, room_sid: nil, participant_sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'participant_sid' => payload['participant_sid'],
      'participant_identity' => payload['participant_identity'],
      'join_time' => Twilio.deserialize_iso8601_datetime(payload['join_time']),
      'leave_time' => Twilio.deserialize_iso8601_datetime(payload['leave_time']),
      'duration_sec' => payload['duration_sec'].to_i,
      'account_sid' => payload['account_sid'],
      'room_sid' => payload['room_sid'],
      'status' => payload['status'],
      'codecs' => payload['codecs'],
      'end_reason' => payload['end_reason'],
      'error_code' => payload['error_code'] == nil ? payload['error_code'] : payload['error_code'].to_i,
      'error_code_url' => payload['error_code_url'],
      'media_region' => payload['media_region'],
      'properties' => payload['properties'],
      'edge_location' => payload['edge_location'],
      'publisher_info' => payload['publisher_info'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {
      'room_sid' => room_sid,
      'participant_sid' => participant_sid || @properties['participant_sid'],
  }
end

Instance Method Details

#account_sidString

Returns Account SID associated with the room.

Returns:

  • (String)

    Account SID associated with the room.


283
284
285
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 283

def 
  @properties['account_sid']
end

#codecsArray[participant.Codec]

Returns Codecs detected from the participant.

Returns:

  • (Array[participant.Codec])

    Codecs detected from the participant.


301
302
303
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 301

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


240
241
242
243
244
245
246
247
248
249
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 240

def context
  unless @instance_context
    @instance_context = ParticipantContext.new(
        @version,
        @params['room_sid'],
        @params['participant_sid'],
    )
  end
  @instance_context
end

#duration_secString

Returns Amount of time in seconds the participant was in the room.

Returns:

  • (String)

    Amount of time in seconds the participant was in the room.


277
278
279
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 277

def duration_sec
  @properties['duration_sec']
end

#edge_locationparticipant.EdgeLocation

Returns Name of the edge location the participant connected to.

Returns:

  • (participant.EdgeLocation)

    Name of the edge location the participant connected to.


337
338
339
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 337

def edge_location
  @properties['edge_location']
end

#end_reasonString

Returns Reason the participant left the room.

Returns:

  • (String)

    Reason the participant left the room.


307
308
309
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 307

def end_reason
  @properties['end_reason']
end

#error_codeString

Returns Errors encountered by the participant.

Returns:

  • (String)

    Errors encountered by the participant.


313
314
315
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 313

def error_code
  @properties['error_code']
end

#error_code_urlString

Returns Twilio error code dictionary link.

Returns:

  • (String)

    Twilio error code dictionary link.


319
320
321
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 319

def error_code_url
  @properties['error_code_url']
end

#fetchParticipantInstance

Fetch the ParticipantInstance

Returns:


356
357
358
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 356

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


369
370
371
372
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 369

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

#join_timeTime

Returns When the participant joined the room.

Returns:

  • (Time)

    When the participant joined the room.


265
266
267
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 265

def join_time
  @properties['join_time']
end

#leave_timeTime

Returns When the participant left the room.

Returns:

  • (Time)

    When the participant left the room


271
272
273
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 271

def leave_time
  @properties['leave_time']
end

#media_regionparticipant.TwilioRealm

Returns Twilio media region the participant connected to.

Returns:

  • (participant.TwilioRealm)

    Twilio media region the participant connected to.


325
326
327
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 325

def media_region
  @properties['media_region']
end

#participant_identityString

Returns The application-defined string that uniquely identifies the participant within a Room.

Returns:

  • (String)

    The application-defined string that uniquely identifies the participant within a Room.


259
260
261
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 259

def participant_identity
  @properties['participant_identity']
end

#participant_sidString

Returns Unique identifier for the participant.

Returns:

  • (String)

    Unique identifier for the participant.


253
254
255
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 253

def participant_sid
  @properties['participant_sid']
end

#propertiesHash

Returns Object containing information about the participant's data from the room.

Returns:

  • (Hash)

    Object containing information about the participant's data from the room.


331
332
333
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 331

def properties
  @properties['properties']
end

#publisher_infoHash

Returns Object containing information about the SDK name and version.

Returns:

  • (Hash)

    Object containing information about the SDK name and version.


343
344
345
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 343

def publisher_info
  @properties['publisher_info']
end

#room_sidString

Returns Unique identifier for the room.

Returns:

  • (String)

    Unique identifier for the room.


289
290
291
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 289

def room_sid
  @properties['room_sid']
end

#statusparticipant.RoomStatus

Returns Status of the room.

Returns:

  • (participant.RoomStatus)

    Status of the room.


295
296
297
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 295

def status
  @properties['status']
end

#to_sObject

Provide a user friendly representation


362
363
364
365
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 362

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

#urlString

Returns URL of the participant resource.

Returns:

  • (String)

    URL of the participant resource.


349
350
351
# File 'lib/twilio-ruby/rest/insights/v1/room/participant.rb', line 349

def url
  @properties['url']
end