Module: VoiceBase::V3::Response

Defined in:
lib/voicebase/v3/response.rb

Constant Summary collapse

TRANSCRIPT_READY_STATUS =
"finished".freeze

Instance Method Summary collapse

Instance Method Details

#keywordsObject



25
26
27
# File 'lib/voicebase/v3/response.rb', line 25

def keywords
  knowledge["keywords"]
end

#media_idObject



11
12
13
# File 'lib/voicebase/v3/response.rb', line 11

def media_id
  voicebase_response['mediaId']
end

#success?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/voicebase/v3/response.rb', line 7

def success?
  ok?
end

#topicsObject



29
30
31
# File 'lib/voicebase/v3/response.rb', line 29

def topics
  knowledge['topics']
end

#transcriptObject



19
20
21
22
23
# File 'lib/voicebase/v3/response.rb', line 19

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

#transcript_ready?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/voicebase/v3/response.rb', line 15

def transcript_ready?
  voicebase_response['status'].downcase == TRANSCRIPT_READY_STATUS
end