module VoiceBase::V2::Response

Constants

TRANSCRIPT_READY_STATUS

Public Instance Methods

keyword_groups() click to toggle source
# File lib/voicebase/v2/response.rb, line 34
def keyword_groups
  voicebase_response['media']['keywords']['latest']['groups']
end
keywords() click to toggle source
# File lib/voicebase/v2/response.rb, line 30
def keywords
  voicebase_response['media']['keywords']['latest']['words']
end
media_id() click to toggle source
# File lib/voicebase/v2/response.rb, line 16
def media_id
  voicebase_response['mediaId']
end
success?() click to toggle source
# File lib/voicebase/v2/response.rb, line 7
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
topics() click to toggle source
# File lib/voicebase/v2/response.rb, line 38
def topics
  voicebase_response['media']['topics']['latest']['topics']
end
transcript() click to toggle source
# File lib/voicebase/v2/response.rb, line 24
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
transcript_ready?() click to toggle source
# File lib/voicebase/v2/response.rb, line 20
def transcript_ready?
  voicebase_response['media']['status'].casecmp(TRANSCRIPT_READY_STATUS) == 0
end

Private Instance Methods

voicebase_response() click to toggle source
# File lib/voicebase/v2/response.rb, line 44
def voicebase_response
  http_response.parsed_response
end