Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

support for getting recording urls in different formats and streaming…

… the binary data
  • Loading branch information...
commit fce44fab9af3937eb9f6e4619a82946f43288731 1 parent 55ca9cf
@andrewmbenton andrewmbenton authored
Showing with 20 additions and 0 deletions.
  1. +20 −0 lib/twilio-ruby/rest/recordings.rb
View
20 lib/twilio-ruby/rest/recordings.rb
@@ -6,6 +6,26 @@ class Recording < InstanceResource
def initialize(uri, client, params={})
super uri, client, params
resource :transcriptions
+ # grab a reference to the client's connection object for streaming
+ @connection = @client.instance_variable_get :@connection
+ end
+
+ def wav
+ scheme = @connection.use_ssl ? 'https' : 'http'
+ "#{scheme}://#{@connection.address}#{@uri}.wav"
+ end
+
+ def wav!(&block)
+ @connection.request_get @uri, &block
+ end
+
+ def mp3
+ scheme = @connection.use_ssl ? 'https' : 'http'
+ "#{scheme}://#{@connection.address}#{@uri}.mp3"
+ end
+
+ def mp3!(&block)
+ @connection.request_get "#{@uri}.mp3", &block
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.