Module: VoiceBase::V2::Response
- Defined in:
- lib/voicebase/v2/response.rb
Constant Summary collapse
- TRANSCRIPT_READY_STATUS =
"finished".freeze
Instance Method Summary collapse
- #keyword_groups ⇒ Object
- #keywords ⇒ Object
- #media_id ⇒ Object
- #success? ⇒ Boolean
- #topics ⇒ Object
- #transcript ⇒ Object
- #transcript_ready? ⇒ Boolean
Instance Method Details
#keyword_groups ⇒ Object
34 35 36 |
# File 'lib/voicebase/v2/response.rb', line 34 def keyword_groups voicebase_response['media']['keywords']['latest']['groups'] end |
#keywords ⇒ Object
30 31 32 |
# File 'lib/voicebase/v2/response.rb', line 30 def keywords voicebase_response['media']['keywords']['latest']['words'] end |
#media_id ⇒ Object
16 17 18 |
# File 'lib/voicebase/v2/response.rb', line 16 def media_id voicebase_response['mediaId'] end |
#success? ⇒ Boolean
7 8 9 10 11 12 13 14 |
# 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 ⇒ Object
38 39 40 |
# File 'lib/voicebase/v2/response.rb', line 38 def topics voicebase_response['media']['topics']['latest']['topics'] end |
#transcript ⇒ Object
24 25 26 27 28 |
# 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? ⇒ Boolean
20 21 22 |
# File 'lib/voicebase/v2/response.rb', line 20 def transcript_ready? voicebase_response['media']['status'].casecmp(TRANSCRIPT_READY_STATUS) == 0 end |