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

Inherits:
Twilio::REST::InstanceContext show all
Defined in:
lib/twilio-ruby/rest/insights/v1/room.rb,
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.

Defined Under Namespace

Classes: ParticipantContext, ParticipantInstance, ParticipantList, ParticipantPage

Instance Method Summary collapse

Constructor Details

#initialize(version, room_sid) ⇒ RoomContext

Initialize the RoomContext

Parameters:

  • version (Version)

    Version that contains the resource

  • room_sid (String)

    The SID of the Room resource.


201
202
203
204
205
206
207
208
209
210
# File 'lib/twilio-ruby/rest/insights/v1/room.rb', line 201

def initialize(version, room_sid)
  super(version)

  # Path Solution
  @solution = {room_sid: room_sid, }
  @uri = "/Video/Rooms/#{@solution[:room_sid]}"

  # Dependents
  @participants = nil
end

Instance Method Details

#fetchRoomInstance

Fetch the RoomInstance

Returns:


215
216
217
218
219
# File 'lib/twilio-ruby/rest/insights/v1/room.rb', line 215

def fetch
  payload = @version.fetch('GET', @uri)

  RoomInstance.new(@version, payload, room_sid: @solution[:room_sid], )
end

#inspectObject

Provide a detailed, user friendly representation


248
249
250
251
# File 'lib/twilio-ruby/rest/insights/v1/room.rb', line 248

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Insights.V1.RoomContext #{context}>"
end

#participants(participant_sid = :unset) ⇒ ParticipantList, ParticipantContext

Access the participants

Returns:

Raises:

  • (ArgumentError)

225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/twilio-ruby/rest/insights/v1/room.rb', line 225

def participants(participant_sid=:unset)
  raise ArgumentError, 'participant_sid cannot be nil' if participant_sid.nil?

  if participant_sid != :unset
    return ParticipantContext.new(@version, @solution[:room_sid], participant_sid, )
  end

  unless @participants
    @participants = ParticipantList.new(@version, room_sid: @solution[:room_sid], )
  end

  @participants
end

#to_sObject

Provide a user friendly representation


241
242
243
244
# File 'lib/twilio-ruby/rest/insights/v1/room.rb', line 241

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Insights.V1.RoomContext #{context}>"
end