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

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.



168
169
170
171
172
173
174
175
176
177
# File 'lib/twilio-ruby/rest/insights/v1/room.rb', line 168

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:



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
# File 'lib/twilio-ruby/rest/insights/v1/room.rb', line 181

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    RoomInstance.new(
        @version,
        payload,
        room_sid: @solution[:room_sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



226
227
228
229
# File 'lib/twilio-ruby/rest/insights/v1/room.rb', line 226

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)


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

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



219
220
221
222
# File 'lib/twilio-ruby/rest/insights/v1/room.rb', line 219

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