Class: Twilio::REST::Recording

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/recordings.rb

Instance Method Summary collapse

Methods inherited from InstanceResource

#delete, #inspect, #method_missing, #refresh, #update

Methods included from Utils

#detwilify, #twilify

Constructor Details

#initialize(path, client, params = {}) ⇒ Recording

Returns a new instance of Recording.



6
7
8
9
10
11
12
# File 'lib/twilio-ruby/rest/recordings.rb', line 6

def initialize(path, client, params={})
  path.sub! /\/Calls\/CA[^\/]+/, ''
  super path, client, params
  resource :transcriptions
  # grab a reference to the client's connection object for streaming
  @connection = @client.instance_variable_get :@connection
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Twilio::REST::InstanceResource

Instance Method Details

#mp3Object

Return the mp3 URL for this recording.



26
27
28
# File 'lib/twilio-ruby/rest/recordings.rb', line 26

def mp3
  "https://#{@connection.address}#{@path}.mp3"
end

#mp3!(&block) ⇒ Object



30
31
32
# File 'lib/twilio-ruby/rest/recordings.rb', line 30

def mp3!(&block)
  @connection.request_get "#{@path}.mp3", &block
end

#wavObject

Return the wav URL for this recording.



16
17
18
# File 'lib/twilio-ruby/rest/recordings.rb', line 16

def wav
  "https://#{@connection.address}#{@path}.wav"
end

#wav!(&block) ⇒ Object



20
21
22
# File 'lib/twilio-ruby/rest/recordings.rb', line 20

def wav!(&block)
  @connection.request_get @path, &block
end