Sha256: 270ed411cf2d1ef33b285c89477f1a6add78a98186ed2eb7fe9cadbd72543b0d

Contents?: true

Size: 872 Bytes

Versions: 2

Compression:

Stored size: 872 Bytes

Contents

module Restcomm
  module REST
    class Recordings < ListResource; end

    class Recording < InstanceResource
      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

      ##
      # Return the wav URL for this recording.
      def wav
        "https://#{@connection.address}#{@path}.wav"
      end

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

      ##
      # Return the mp3 URL for this recording.
      def mp3
        "https://#{@connection.address}#{@path}.mp3"
      end

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
restcomm-ruby-1.2.1 lib/restcomm-ruby/rest/recordings.rb
restcomm-ruby-1.2.0 lib/restcomm-ruby/rest/recordings.rb