Class: Twilio::REST::Video::V1::RoomContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Video::V1::RoomContext
- Defined in:
- lib/twilio-ruby/rest/video/v1/room.rb,
lib/twilio-ruby/rest/video/v1/room/participant.rb,
lib/twilio-ruby/rest/video/v1/room/room_recording.rb,
lib/twilio-ruby/rest/video/v1/room/recording_rules.rb,
lib/twilio-ruby/rest/video/v1/room/participant/anonymize.rb,
lib/twilio-ruby/rest/video/v1/room/participant/published_track.rb,
lib/twilio-ruby/rest/video/v1/room/participant/subscribe_rules.rb,
lib/twilio-ruby/rest/video/v1/room/participant/subscribed_track.rb
Defined Under Namespace
Classes: ParticipantContext, ParticipantInstance, ParticipantList, ParticipantPage, RecordingRulesInstance, RecordingRulesList, RecordingRulesPage, RoomRecordingContext, RoomRecordingInstance, RoomRecordingList, RoomRecordingPage
Instance Method Summary collapse
-
#fetch ⇒ RoomInstance
Fetch the RoomInstance.
-
#initialize(version, sid) ⇒ RoomContext
constructor
Initialize the RoomContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#participants(sid = :unset) ⇒ ParticipantList, ParticipantContext
Access the participants.
-
#recording_rules ⇒ RecordingRulesList, RecordingRulesContext
Access the recording_rules.
-
#recordings(sid = :unset) ⇒ RoomRecordingList, RoomRecordingContext
Access the recordings.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(status: nil) ⇒ RoomInstance
Update the RoomInstance.
Constructor Details
#initialize(version, sid) ⇒ RoomContext
Initialize the RoomContext
227 228 229 230 231 232 233 234 235 236 237 238 |
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 227 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Rooms/#{@solution[:sid]}" # Dependents @recording_rules = nil @participants = nil @recordings = nil end |
Instance Method Details
#fetch ⇒ RoomInstance
Fetch the RoomInstance
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 242 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) RoomInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
343 344 345 346 |
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 343 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Video.V1.RoomContext #{context}>" end |
#participants(sid = :unset) ⇒ ParticipantList, ParticipantContext
Access the participants
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 299 def participants(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ParticipantContext.new(@version, @solution[:sid],sid ) end unless @participants @participants = ParticipantList.new( @version, room_sid: @solution[:sid], ) end @participants end |
#recording_rules ⇒ RecordingRulesList, RecordingRulesContext
Access the recording_rules
288 289 290 291 292 293 294 |
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 288 def recording_rules unless @recording_rules @recording_rules = RecordingRulesList.new( @version, room_sid: @solution[:sid], ) end @recording_rules end |
#recordings(sid = :unset) ⇒ RoomRecordingList, RoomRecordingContext
Access the recordings
318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 318 def recordings(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return RoomRecordingContext.new(@version, @solution[:sid],sid ) end unless @recordings @recordings = RoomRecordingList.new( @version, room_sid: @solution[:sid], ) end @recordings end |
#to_s ⇒ Object
Provide a user friendly representation
336 337 338 339 |
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 336 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Video.V1.RoomContext #{context}>" end |
#update(status: nil) ⇒ RoomInstance
Update the RoomInstance
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/twilio-ruby/rest/video/v1/room.rb', line 262 def update( status: nil ) data = Twilio::Values.of({ 'Status' => status, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) RoomInstance.new( @version, payload, sid: @solution[:sid], ) end |