class Twilio::REST::Api::V2010::AccountContext::CallContext::RecordingList
Public Class Methods
Initialize the RecordingList
@param [Version] version Version
that contains the resource @param [String] account_sid The SID of the
{Account}[https://www.twilio.com/docs/iam/api/account] that created the Recording resource.
@param [String] call_sid The SID of the
{Call}[https://www.twilio.com/docs/voice/api/call-resource] the Recording resource is associated with.
@return [RecordingList] RecordingList
Twilio::REST::ListResource::new
# File lib/twilio-ruby/rest/api/v2010/account/call/recording.rb 26 def initialize(version, account_sid: nil, call_sid: nil) 27 super(version) 28 29 # Path Solution 30 @solution = {account_sid: account_sid, call_sid: call_sid} 31 @uri = "/Accounts/#{@solution[:account_sid]}/Calls/#{@solution[:call_sid]}/Recordings.json" 32 end
Public Instance Methods
Create the RecordingInstance
@param [Array] recording_status_callback_event The recording status
events on which we should call the `recording_status_callback` URL. Can be: `in-progress`, `completed` and `absent` and the default is `completed`. Separate multiple event values with a space.
@param [String] recording_status_callback The URL we should call using the
`recording_status_callback_method` on each recording event specified in `recording_status_callback_event`. For more information, see {RecordingStatusCallback parameters}[https://www.twilio.com/docs/voice/api/recording#recordingstatuscallback].
@param [String] recording_status_callback_method The HTTP
method we should use
to call `recording_status_callback`. Can be: `GET` or `POST` and the default is `POST`.
@param [String] trim Whether to trim any leading and trailing silence in the
recording. Can be: `trim-silence` or `do-not-trim` and the default is `do-not-trim`. `trim-silence` trims the silence from the beginning and end of the recording and `do-not-trim` does not.
@param [String] recording_channels The number of channels used in the recording.
Can be: `mono` or `dual` and the default is `mono`. `mono` records all parties of the call into one channel. `dual` records each party of a 2-party call into separate channels.
@param [String] recording_track The audio track to record for the call. Can be:
`inbound`, `outbound` or `both`. The default is `both`. `inbound` records the audio that is received by Twilio. `outbound` records the audio that is generated from Twilio. `both` records the audio that is received and generated by Twilio.
@return [RecordingInstance] Created RecordingInstance
# File lib/twilio-ruby/rest/api/v2010/account/call/recording.rb 61 def create(recording_status_callback_event: :unset, recording_status_callback: :unset, recording_status_callback_method: :unset, trim: :unset, recording_channels: :unset, recording_track: :unset) 62 data = Twilio::Values.of({ 63 'RecordingStatusCallbackEvent' => Twilio.serialize_list(recording_status_callback_event) { |e| e }, 64 'RecordingStatusCallback' => recording_status_callback, 65 'RecordingStatusCallbackMethod' => recording_status_callback_method, 66 'Trim' => trim, 67 'RecordingChannels' => recording_channels, 68 'RecordingTrack' => recording_track, 69 }) 70 71 payload = @version.create('POST', @uri, data: data) 72 73 RecordingInstance.new( 74 @version, 75 payload, 76 account_sid: @solution[:account_sid], 77 call_sid: @solution[:call_sid], 78 ) 79 end
When passed a block, yields RecordingInstance
records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
# File lib/twilio-ruby/rest/api/v2010/account/call/recording.rb 136 def each 137 limits = @version.read_limits 138 139 page = self.page(page_size: limits[:page_size], ) 140 141 @version.stream(page, 142 limit: limits[:limit], 143 page_limit: limits[:page_limit]).each {|x| yield x} 144 end
Retrieve a single page of RecordingInstance
records from the API. Request
is executed immediately. @param [String] target_url API-generated URL for the requested results page @return [Page] Page
of RecordingInstance
# File lib/twilio-ruby/rest/api/v2010/account/call/recording.rb 176 def get_page(target_url) 177 response = @version.domain.request( 178 'GET', 179 target_url 180 ) 181 RecordingPage.new(@version, response, @solution) 182 end
Lists RecordingInstance
records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning. @param [Time] date_created_before The `YYYY-MM-DD` value of the resources to read @param [Time] date_created The `YYYY-MM-DD` value of the resources to read @param [Time] date_created_after The `YYYY-MM-DD` value of the resources to read @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/api/v2010/account/call/recording.rb 95 def list(date_created_before: :unset, date_created: :unset, date_created_after: :unset, limit: nil, page_size: nil) 96 self.stream( 97 date_created_before: date_created_before, 98 date_created: date_created, 99 date_created_after: date_created_after, 100 limit: limit, 101 page_size: page_size 102 ).entries 103 end
Retrieve a single page of RecordingInstance
records from the API. Request
is executed immediately. @param [Time] date_created_before The `YYYY-MM-DD` value of the resources to read @param [Time] date_created The `YYYY-MM-DD` value of the resources to read @param [Time] date_created_after The `YYYY-MM-DD` value of the resources to read @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 RecordingInstance
# File lib/twilio-ruby/rest/api/v2010/account/call/recording.rb 156 def page(date_created_before: :unset, date_created: :unset, date_created_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset) 157 params = Twilio::Values.of({ 158 'DateCreated<' => Twilio.serialize_iso8601_date(date_created_before), 159 'DateCreated' => Twilio.serialize_iso8601_date(date_created), 160 'DateCreated>' => Twilio.serialize_iso8601_date(date_created_after), 161 'PageToken' => page_token, 162 'Page' => page_number, 163 'PageSize' => page_size, 164 }) 165 166 response = @version.page('GET', @uri, params: params) 167 168 RecordingPage.new(@version, response, @solution) 169 end
Streams RecordingInstance
records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached. @param [Time] date_created_before The `YYYY-MM-DD` value of the resources to read @param [Time] date_created The `YYYY-MM-DD` value of the resources to read @param [Time] date_created_after The `YYYY-MM-DD` value of the resources to read @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/api/v2010/account/call/recording.rb 119 def stream(date_created_before: :unset, date_created: :unset, date_created_after: :unset, limit: nil, page_size: nil) 120 limits = @version.read_limits(limit, page_size) 121 122 page = self.page( 123 date_created_before: date_created_before, 124 date_created: date_created, 125 date_created_after: date_created_after, 126 page_size: limits[:page_size], 127 ) 128 129 @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) 130 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/api/v2010/account/call/recording.rb 186 def to_s 187 '#<Twilio.Api.V2010.RecordingList>' 188 end