Class: Twilio::REST::Voice::V3::TranscriptionList
- Inherits:
-
ListResource
- Object
- ListResource
- Twilio::REST::Voice::V3::TranscriptionList
- Defined in:
- lib/twilio-ruby/rest/voice/v3/transcription.rb
Defined Under Namespace
Classes: CreateV3TranscriptionsRequest, VoiceV3TranscriptionResolvedConfigurationParticipantDefaults, VoiceV3TranscriptionTranscriptionStatusCallback
Instance Method Summary collapse
-
#create(idempotency_key: :unset, create_v3_transcriptions_request: nil) ⇒ TranscriptionInstance
Create the TranscriptionInstance.
-
#create_with_metadata(idempotency_key: :unset, create_v3_transcriptions_request: nil) ⇒ TranscriptionInstance
Create the TranscriptionInstanceMetadata.
-
#each ⇒ Object
When passed a block, yields TranscriptionInstance records from the API.
-
#get_page(target_url) ⇒ Page
Retrieve a single page of TranscriptionInstance records from the API.
-
#initialize(version) ⇒ TranscriptionList
constructor
Initialize the TranscriptionList.
-
#list(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Lists TranscriptionInstance records from the API as a list.
-
#list_with_metadata(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Array of up to limit results.
-
#page(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, page_size: :unset) ⇒ Page
Page of TranscriptionInstance.
-
#stream(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, limit: nil, page_size: nil) ⇒ Enumerable
Streams Instance records from the API as an Enumerable.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version) ⇒ TranscriptionList
Initialize the TranscriptionList
90 91 92 93 94 95 96 97 98 |
# File 'lib/twilio-ruby/rest/voice/v3/transcription.rb', line 90 def initialize(version) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Path Solution @solution = { } @uri = "/Transcriptions" end |
Instance Method Details
#create(idempotency_key: :unset, create_v3_transcriptions_request: nil) ⇒ TranscriptionInstance
Create the TranscriptionInstance
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/twilio-ruby/rest/voice/v3/transcription.rb', line 104 def create( idempotency_key: :unset, create_v3_transcriptions_request: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, }) headers['Content-Type'] = 'application/json' payload = @version.create('POST', @uri, headers: headers, data: create_v3_transcriptions_request.to_json) TranscriptionInstance.new( @version, payload, ) end |
#create_with_metadata(idempotency_key: :unset, create_v3_transcriptions_request: nil) ⇒ TranscriptionInstance
Create the TranscriptionInstanceMetadata
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/twilio-ruby/rest/voice/v3/transcription.rb', line 127 def ( idempotency_key: :unset, create_v3_transcriptions_request: nil ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'Idempotency-Key' => idempotency_key, }) headers['Content-Type'] = 'application/json' response = @version.('POST', @uri, headers: headers, data: create_v3_transcriptions_request.to_json) transcription_instance = TranscriptionInstance.new( @version, response.body, ) TranscriptionInstanceMetadata.new( @version, transcription_instance, response.headers, response.status_code ) end |
#each ⇒ Object
When passed a block, yields TranscriptionInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/twilio-ruby/rest/voice/v3/transcription.rb', line 256 def each limits = @version.read_limits page = self.page(page_size: limits[:page_size], ) return [].each if page.nil? result = @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) return [].each if result.nil? result.each {|x| yield x} end |
#get_page(target_url) ⇒ Page
Retrieve a single page of TranscriptionInstance records from the API. Request is executed immediately.
305 306 307 308 309 310 311 |
# File 'lib/twilio-ruby/rest/voice/v3/transcription.rb', line 305 def get_page(target_url) response = @version.domain.request( 'GET', target_url ) TranscriptionPage.new(@version, response, @solution) end |
#list(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Lists TranscriptionInstance records from the API as a list.
Unlike stream(), this operation is eager and will load limit records into
memory before returning.
169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/twilio-ruby/rest/voice/v3/transcription.rb', line 169 def list(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, limit: nil, page_size: nil) self.stream( created_after: created_after, created_before: created_before, language_code: language_code, source_id: source_id, status: status, page_token: page_token, limit: limit, page_size: page_size ).entries end |
#list_with_metadata(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, limit: nil, page_size: nil) ⇒ Array
Returns Array of up to limit results.
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/twilio-ruby/rest/voice/v3/transcription.rb', line 233 def (created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) params = Twilio::Values.of({ 'createdAfter' => Twilio.serialize_iso8601_datetime(created_after), 'createdBefore' => Twilio.serialize_iso8601_datetime(created_before), 'languageCode' => language_code, 'sourceId' => source_id, 'status' => status, 'pageToken' => page_token, 'PageSize' => limits[:page_size], }); headers = Twilio::Values.of({}) response = @version.page('GET', @uri, params: params, headers: headers) TranscriptionPageMetadata.new(@version, response, @solution, limits[:limit]) end |
#page(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, page_size: :unset) ⇒ Page
Returns Page of TranscriptionInstance.
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
# File 'lib/twilio-ruby/rest/voice/v3/transcription.rb', line 281 def page(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, page_size: :unset) params = Twilio::Values.of({ 'createdAfter' => Twilio.serialize_iso8601_datetime(created_after), 'createdBefore' => Twilio.serialize_iso8601_datetime(created_before), 'languageCode' => language_code, 'sourceId' => source_id, 'status' => status, 'pageToken' => page_token, 'PageSize' => page_size, }) headers = Twilio::Values.of({}) response = @version.page('GET', @uri, params: params, headers: headers) TranscriptionPage.new(@version, response, @solution) end |
#stream(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, limit: nil, page_size: nil) ⇒ Enumerable
Streams Instance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
# File 'lib/twilio-ruby/rest/voice/v3/transcription.rb', line 199 def stream(created_after: :unset, created_before: :unset, language_code: :unset, source_id: :unset, status: :unset, page_token: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( created_after: created_after, created_before: created_before, language_code: language_code, source_id: source_id, status: status, page_token: page_token, page_size: limits[:page_size], ) return [].each if page.nil? result = @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) return [].each if result.nil? result end |
#to_s ⇒ Object
Provide a user friendly representation
316 317 318 |
# File 'lib/twilio-ruby/rest/voice/v3/transcription.rb', line 316 def to_s '#<Twilio.Voice.V3.TranscriptionList>' end |