class Twilio::REST::Video::V1::RoomList
Public Class Methods
Initialize the RoomList
@param [Version] version Version
that contains the resource @return [RoomList] RoomList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/video/v1/room.rb 18 def initialize(version) 19 super(version) 20 21 # Path Solution 22 @solution = {} 23 @uri = "/Rooms" 24 end
Public Instance Methods
Create the RoomInstance
@param [Boolean] enable_turn Deprecated, now always considered to be true. @param [room.RoomType] type The type of room. Can be: `go`, `peer-to-peer`,
`group-small`, or `group`. The default value is `group`.
@param [String] unique_name An application-defined string that uniquely
identifies the resource. It can be used as a `room_sid` in place of the resource's `sid` in the URL to address the resource. This value is unique for `in-progress` rooms. SDK clients can use this name to connect to the room. REST API clients can use this name in place of the Room SID to interact with the room as long as the room is `in-progress`.
@param [String] status_callback The URL we should call using the
`status_callback_method` to send status information to your application on every room event. See {Status Callbacks}[https://www.twilio.com/docs/video/api/status-callbacks] for more info.
@param [String] status_callback_method The HTTP
method we should use to call
`status_callback`. Can be `POST` or `GET`.
@param [String] max_participants The maximum number of concurrent Participants
allowed in the room. Peer-to-peer rooms can have up to 10 Participants. Small Group rooms can have up to 4 Participants. Group rooms can have up to 50 Participants.
@param [Boolean] record_participants_on_connect Whether to start recording when
Participants connect. ***This feature is not available in `peer-to-peer` rooms.***
@param [Array] video_codecs An array of the video codecs that
are supported when publishing a track in the room. Can be: `VP8` and `H264`. ***This feature is not available in `peer-to-peer` rooms***
@param [String] media_region The region for the media server in Group Rooms.
Can be: one of the {available Media Regions}[https://www.twilio.com/docs/video/ip-address-whitelisting#group-rooms-media-servers]. ***This feature is not available in `peer-to-peer` rooms.***
@param [Hash] recording_rules A collection of Recording Rules that describe how
to include or exclude matching tracks for recording
@return [RoomInstance] Created RoomInstance
# File lib/twilio-ruby/rest/video/v1/room.rb 61 def create(enable_turn: :unset, type: :unset, unique_name: :unset, status_callback: :unset, status_callback_method: :unset, max_participants: :unset, record_participants_on_connect: :unset, video_codecs: :unset, media_region: :unset, recording_rules: :unset) 62 data = Twilio::Values.of({ 63 'EnableTurn' => enable_turn, 64 'Type' => type, 65 'UniqueName' => unique_name, 66 'StatusCallback' => status_callback, 67 'StatusCallbackMethod' => status_callback_method, 68 'MaxParticipants' => max_participants, 69 'RecordParticipantsOnConnect' => record_participants_on_connect, 70 'VideoCodecs' => Twilio.serialize_list(video_codecs) { |e| e }, 71 'MediaRegion' => media_region, 72 'RecordingRules' => Twilio.serialize_object(recording_rules), 73 }) 74 75 payload = @version.create('POST', @uri, data: data) 76 77 RoomInstance.new(@version, payload, ) 78 end
When passed a block, yields RoomInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/video/v1/room.rb 145 def each 146 limits = @version.read_limits 147 148 page = self.page(page_size: limits[:page_size], ) 149 150 @version.stream(page, 151 limit: limits[:limit], 152 page_limit: limits[:page_limit]).each {|x| yield x} 153 end
Retrieve a single page of RoomInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of RoomInstance
# File lib/twilio-ruby/rest/video/v1/room.rb 190 def get_page(target_url) 191 response = @version.domain.request( 192 'GET', 193 target_url 194 ) 195 RoomPage.new(@version, response, @solution) 196 end
Lists RoomInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [room.RoomStatus] status Read only the rooms with this status. Can be:
`in-progress` (default) or `completed`
@param [String] unique_name Read only rooms with the this `unique_name`. @param [Time] date_created_after Read only rooms that started on or after this
date, given as `YYYY-MM-DD`.
@param [Time] date_created_before Read only rooms that started before this date,
given as `YYYY-MM-DD`.
@param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Array] Array of up to limit results
# File lib/twilio-ruby/rest/video/v1/room.rb 98 def list(status: :unset, unique_name: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil) 99 self.stream( 100 status: status, 101 unique_name: unique_name, 102 date_created_after: date_created_after, 103 date_created_before: date_created_before, 104 limit: limit, 105 page_size: page_size 106 ).entries 107 end
Retrieve a single page of RoomInstance
records from the API. Request
is executed immediately. @param [room.RoomStatus] status Read only the rooms with this status. Can be:
`in-progress` (default) or `completed`
@param [String] unique_name Read only rooms with the this `unique_name`. @param [Time] date_created_after Read only rooms that started on or after this
date, given as `YYYY-MM-DD`.
@param [Time] date_created_before Read only rooms that started before this date,
given as `YYYY-MM-DD`.
@param [String] page_token PageToken provided by the API @param [Integer] page_number Page
Number, this value is simply for client state @param [Integer] page_size Number of records to return, defaults to 50 @return [Page] Page
of RoomInstance
# File lib/twilio-ruby/rest/video/v1/room.rb 169 def page(status: :unset, unique_name: :unset, date_created_after: :unset, date_created_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 170 params = Twilio::Values.of({ 171 'Status' => status, 172 'UniqueName' => unique_name, 173 'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after), 174 'DateCreatedBefore' => Twilio.serialize_iso8601_datetime(date_created_before), 175 'PageToken' => page_token, 176 'Page' => page_number, 177 'PageSize' => page_size, 178 }) 179 180 response = @version.page('GET', @uri, params: params) 181 182 RoomPage.new(@version, response, @solution) 183 end
Streams RoomInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [room.RoomStatus] status Read only the rooms with this status. Can be:
`in-progress` (default) or `completed`
@param [String] unique_name Read only rooms with the this `unique_name`. @param [Time] date_created_after Read only rooms that started on or after this
date, given as `YYYY-MM-DD`.
@param [Time] date_created_before Read only rooms that started before this date,
given as `YYYY-MM-DD`.
@param [Integer] limit Upper limit for the number of records to return. stream()
guarantees to never return more than limit. Default is no limit.
@param [Integer] page_size Number of records to fetch per request, when
not set will use the default value of 50 records. If no page_size is defined but a limit is defined, stream() will attempt to read the limit with the most efficient page size, i.e. min(limit, 1000)
@return [Enumerable] Enumerable that will yield up to limit results
# File lib/twilio-ruby/rest/video/v1/room.rb 127 def stream(status: :unset, unique_name: :unset, date_created_after: :unset, date_created_before: :unset, limit: nil, page_size: nil) 128 limits = @version.read_limits(limit, page_size) 129 130 page = self.page( 131 status: status, 132 unique_name: unique_name, 133 date_created_after: date_created_after, 134 date_created_before: date_created_before, 135 page_size: limits[:page_size], 136 ) 137 138 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 139 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/video/v1/room.rb 200 def to_s 201 '#<Twilio.Video.V1.RoomList>' 202 end