Class: ApiAiWrapper::Trainers::IntentTrainer
- Inherits:
-
Components::TrainerComponent
- Object
- Components::Component
- Components::TrainerComponent
- ApiAiWrapper::Trainers::IntentTrainer
- Defined in:
- lib/api_ai_wrapper/trainers/intent_trainer.rb
Overview
Instance Attribute Summary
Attributes inherited from Components::Component
Instance Method Summary collapse
-
#delete_intent(iid) ⇒ Object
api.ai/docs/reference/agent/entities#delete_entitieseid Delete an intent.
-
#get_intent(iid) ⇒ Object
api.ai/docs/reference/agent/intents#get_intentsiid Retrieves intent info.
-
#get_intents ⇒ Object
api.ai/docs/reference/agent/intents#get_intents Fetches all intents for a given token.
-
#post_intent(name, user_says_data, options = {}) ⇒ Object
api.ai/docs/reference/agent/intents#post_intents Creates an intent options can contain (in accordance with API reference) : - contexts - templates - responses.
-
#put_intent(iid, options = {}) ⇒ Object
api.ai/docs/reference/agent/intents#put_intentsiid Update an intent.
Methods inherited from Components::TrainerComponent
#raise_if_unauthorized, #set_headers
Instance Method Details
#delete_intent(iid) ⇒ Object
api.ai/docs/reference/agent/entities#delete_entitieseid Delete an intent
50 51 52 53 54 |
# File 'lib/api_ai_wrapper/trainers/intent_trainer.rb', line 50 def delete_intent(iid) endpoint_url = URI.join(self.engine.base_url, "intents/#{iid}?v=#{self.engine.version}") self.delete(endpoint_url, {}) end |
#get_intent(iid) ⇒ Object
api.ai/docs/reference/agent/intents#get_intentsiid Retrieves intent info
17 18 19 20 21 |
# File 'lib/api_ai_wrapper/trainers/intent_trainer.rb', line 17 def get_intent(iid) endpoint_url = URI.join(self.engine.base_url, "intents/#{iid}?v=#{self.engine.version}") self.get(endpoint_url, {}) end |
#get_intents ⇒ Object
api.ai/docs/reference/agent/intents#get_intents Fetches all intents for a given token
9 10 11 12 13 |
# File 'lib/api_ai_wrapper/trainers/intent_trainer.rb', line 9 def get_intents endpoint_url = URI.join(self.engine.base_url, "intents?v=#{self.engine.version}") self.get(endpoint_url, {}) end |
#post_intent(name, user_says_data, options = {}) ⇒ Object
api.ai/docs/reference/agent/intents#post_intents Creates an intent options can contain (in accordance with API reference) :
-
contexts
-
templates
-
responses
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/api_ai_wrapper/trainers/intent_trainer.rb', line 29 def post_intent(name, user_says_data, = {}) body = .merge({ name: name, auto: true, # ML activated userSays: user_says_data }) endpoint_url = URI.join(self.engine.base_url, "intents?v=#{self.engine.version}") self.post(endpoint_url, body.to_json) end |
#put_intent(iid, options = {}) ⇒ Object
api.ai/docs/reference/agent/intents#put_intentsiid Update an intent
42 43 44 45 46 |
# File 'lib/api_ai_wrapper/trainers/intent_trainer.rb', line 42 def put_intent(iid, = {}) endpoint_url = URI.join(self.engine.base_url, "intents/#{iid}?v=#{self.engine.version}") self.put(endpoint_url, .to_json) end |