Sha256: 972e97c5990b01f873f18109f7b8fddc116e656325a315c5fff7f0aae584585a

Contents?: true

Size: 924 Bytes

Versions: 4

Compression:

Stored size: 924 Bytes

Contents

module VoiceBase
  module V2
    module Response

      TRANSCRIPT_READY_STATUS = "finished".freeze

      def success?

        # for the V1 API this indicates both a successful HTTP status code and a values of "SUCCESS" in the
        # returned JSON. with V2, there is no "SUCCESS" value. The combined use was split, adding
        # #transcript_ready? to both interfaces.

        ok?
      end

      def media_id
        voicebase_response['mediaId']
      end

      def transcript_ready?
        voicebase_response['media']['status'].casecmp(TRANSCRIPT_READY_STATUS) == 0
      end

      def transcript
        # this retrieves the JSON transcript only
        # the plain text transcript is a plain text non-JSON response
        voicebase_response['media']['transcripts']['latest']['words']
      end

      private

      def voicebase_response
        http_response.parsed_response
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
voicebase-client-ruby-1.0.17 lib/voicebase/v2/response.rb
voicebase-client-ruby-1.0.16 lib/voicebase/v2/response.rb
voicebase-client-ruby-1.0.15 lib/voicebase/v2/response.rb
voicebase-client-ruby-1.0.14 lib/voicebase/v2/response.rb