Class: Telapi::Transcription

Inherits:
Resource
  • Object
show all
Defined in:
lib/telapi/transcription.rb

Overview

Wraps TelAPI Transcription functionality

Class Method Summary collapse

Methods inherited from Resource

#attributes, #initialize

Methods included from Network

api_uri, default_options, delete, post, response_format

Constructor Details

This class inherits a constructor from Telapi::Resource

Class Method Details

.get(id) ⇒ Object

Returns a Telapi::Transcription object given its id See www.telapi.com/docs/api/rest/transcriptions/view/



23
24
25
26
# File 'lib/telapi/transcription.rb', line 23

def get(id)
  response = Network.get(['Transcriptions', id])
  Transcription.new(response)
end

.list(optional_params = {}) ⇒ Object

Returns a resource collection containing Telapi::Transcription objects See www.telapi.com/docs/api/rest/transcriptions/list/

Also, Transcriptions can be scoped to a recording, see Telapi::Recording::transcriptions

Optional params is a hash containing:

Status

in-progress, completed, or failed

DateTranscribed

YYYY-MM-DD format

Page

integer greater than 0

PageSize

integer greater than 0



16
17
18
19
# File 'lib/telapi/transcription.rb', line 16

def list(optional_params = {})
  response = Network.get(['Transcriptions'], optional_params)
  ResourceCollection.new(response, 'transcriptions', self)
end

.transcribe_audio(audio_url, optional_params = {}) ⇒ Object

Transcribes any audio url, returning a Telapi::Transcription object See www.telapi.com/docs/api/rest/transcriptions/transcribe-audio-url/

Required params:

audio_url

valid url

Optional params is a hash containing:

TranscribeCallback

valid URL

CallbackMethod

(POST) or GET

Quality

(auto), silver, gold, or platinum



38
39
40
41
42
# File 'lib/telapi/transcription.rb', line 38

def transcribe_audio(audio_url, optional_params = {})
  opts = { :AudioUrl => audio_url }.merge(optional_params)
  response = Network.post(['Transcriptions'], opts)
  Transcription.new(response)
end