Class: ApiAiWrapper::MeaningExtractor
- Inherits:
-
Components::ExtractorComponent
- Object
- Components::Component
- Components::ExtractorComponent
- ApiAiWrapper::MeaningExtractor
- Defined in:
- lib/api_ai_wrapper/meaning_extractor.rb
Overview
Instance Attribute Summary
Attributes inherited from Components::Component
Instance Method Summary collapse
-
#post_query(query, options = {}) ⇒ Object
api.ai/docs/reference/agent/query#post_query Retrieves the meaning of a utterance options can contain (in accordance with API reference) : - contexts - location - timezone - lang - sessionId.
Methods inherited from Components::ExtractorComponent
#raise_if_unauthorized, #set_headers
Instance Method Details
#post_query(query, options = {}) ⇒ Object
api.ai/docs/reference/agent/query#post_query Retrieves the meaning of a utterance options can contain (in accordance with API reference) :
-
contexts
-
location
-
timezone
-
lang
-
sessionId
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/api_ai_wrapper/meaning_extractor.rb', line 14 def post_query(query, = {}) set_headers body = { query: query, lang: self.engine.locale, sessionId: SecureRandom.hex }.merge() endpoint_url = URI.join(self.engine.base_url, "query?v=#{self.engine.version}") res = self.post(endpoint_url, body.to_json) end |