Class: Expando::EntityUpdater
- Defined in:
- lib/expando/entity_updater.rb
Overview
Responsible for updating entity objects on Api.ai based on the contents of files in ‘/entities`.
Constant Summary
Constants inherited from Updater
Updater::DEFAULT_ENTITIES_PATH, Updater::DEFAULT_INTENTS_PATH
Instance Attribute Summary collapse
-
#entities_path ⇒ Object
!@attribute entities_path @return [String] the path to the directory containing the entities text files.
-
#name ⇒ Object
!@attribute name @return [String] the name of the entity to be updated.
Instance Method Summary collapse
-
#initialize ⇒ EntityUpdater
constructor
Initialize a new ‘EntityUpdater`.
-
#update! ⇒ Hash, ApiAiRuby::RequestError
Update the named entity on Api.ai.
Constructor Details
#initialize ⇒ EntityUpdater
Initialize a new ‘EntityUpdater`.
16 17 18 |
# File 'lib/expando/entity_updater.rb', line 16 def initialize( * ) super end |
Instance Attribute Details
#entities_path ⇒ Object
!@attribute entities_path
@return [String] the path to the directory containing the entities text files
11 12 13 |
# File 'lib/expando/entity_updater.rb', line 11 def entities_path @entities_path end |
#name ⇒ Object
!@attribute name
@return [String] the name of the entity to be updated
7 8 9 |
# File 'lib/expando/entity_updater.rb', line 7 def name @name end |
Instance Method Details
#update! ⇒ Hash, ApiAiRuby::RequestError
Update the named entity on Api.ai.
24 25 26 27 28 29 30 |
# File 'lib/expando/entity_updater.rb', line 24 def update! entity = [{ name: @name.to_s, entries: }] response = @client.update_entities_request( entity ) handle_response( response, :entity ) end |