class Twilio::REST::Insights::V1::RoomList
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
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/insights/v1/room.rb 20 def initialize(version) 21 super(version) 22 23 # Path Solution 24 @solution = {} 25 @uri = "/Video/Rooms" 26 end
Public Instance Methods
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/insights/v1/room.rb 99 def each 100 limits = @version.read_limits 101 102 page = self.page(page_size: limits[:page_size], ) 103 104 @version.stream(page, 105 limit: limits[:limit], 106 page_limit: limits[:page_limit]).each {|x| yield x} 107 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/insights/v1/room.rb 147 def get_page(target_url) 148 response = @version.domain.request( 149 'GET', 150 target_url 151 ) 152 RoomPage.new(@version, response, @solution) 153 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 [Array] room_type Type of room. Can be `go`,
`peer_to_peer`, `group`, or `group_small`.
@param [Array] codec Codecs used by participants in the room. Can be
`VP8`, `H264`, or `VP9`.
@param [String] room_name Room friendly name. @param [Time] created_after Only read rooms that started on or after this ISO
8601 timestamp.
@param [Time] created_before Only read rooms that started before this ISO 8601
timestamp.
@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/insights/v1/room.rb 48 def list(room_type: :unset, codec: :unset, room_name: :unset, created_after: :unset, created_before: :unset, limit: nil, page_size: nil) 49 self.stream( 50 room_type: room_type, 51 codec: codec, 52 room_name: room_name, 53 created_after: created_after, 54 created_before: created_before, 55 limit: limit, 56 page_size: page_size 57 ).entries 58 end
Retrieve a single page of RoomInstance
records from the API. Request
is executed immediately. @param [Array] room_type Type of room. Can be `go`,
`peer_to_peer`, `group`, or `group_small`.
@param [Array] codec Codecs used by participants in the room. Can be
`VP8`, `H264`, or `VP9`.
@param [String] room_name Room friendly name. @param [Time] created_after Only read rooms that started on or after this ISO
8601 timestamp.
@param [Time] created_before Only read rooms that started before this ISO 8601
timestamp.
@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/insights/v1/room.rb 125 def page(room_type: :unset, codec: :unset, room_name: :unset, created_after: :unset, created_before: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 126 params = Twilio::Values.of({ 127 'RoomType' => Twilio.serialize_list(room_type) { |e| e }, 128 'Codec' => Twilio.serialize_list(codec) { |e| e }, 129 'RoomName' => room_name, 130 'CreatedAfter' => Twilio.serialize_iso8601_datetime(created_after), 131 'CreatedBefore' => Twilio.serialize_iso8601_datetime(created_before), 132 'PageToken' => page_token, 133 'Page' => page_number, 134 'PageSize' => page_size, 135 }) 136 137 response = @version.page('GET', @uri, params: params) 138 139 RoomPage.new(@version, response, @solution) 140 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 [Array] room_type Type of room. Can be `go`,
`peer_to_peer`, `group`, or `group_small`.
@param [Array] codec Codecs used by participants in the room. Can be
`VP8`, `H264`, or `VP9`.
@param [String] room_name Room friendly name. @param [Time] created_after Only read rooms that started on or after this ISO
8601 timestamp.
@param [Time] created_before Only read rooms that started before this ISO 8601
timestamp.
@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/insights/v1/room.rb 80 def stream(room_type: :unset, codec: :unset, room_name: :unset, created_after: :unset, created_before: :unset, limit: nil, page_size: nil) 81 limits = @version.read_limits(limit, page_size) 82 83 page = self.page( 84 room_type: room_type, 85 codec: codec, 86 room_name: room_name, 87 created_after: created_after, 88 created_before: created_before, 89 page_size: limits[:page_size], 90 ) 91 92 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 93 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/insights/v1/room.rb 157 def to_s 158 '#<Twilio.Insights.V1.RoomList>' 159 end