Class: Wit::REST::Session
- Inherits:
-
Object
- Object
- Wit::REST::Session
- Defined in:
- lib/wit_ruby/rest/session.rb
Instance Method Summary collapse
-
#add_expression(entity_id, value, new_expression) ⇒ Object
POST - adds a new expression to the value of the entity.
-
#add_value(entity_id, new_value) ⇒ Object
POST - adds the possible value into the list of values for the given - entity with the id.
-
#create_entity(new_entity) ⇒ Object
POST - creates a new entity with the given attributes.
-
#delete_entity(entity_id) ⇒ Object
DELETE - deletes the given entity with the entity id.
-
#delete_expression(entity_id, value, expression) ⇒ Object
DELETE - deleetes the expression in the value of the entity.
-
#delete_value(entity_id, delete_value) ⇒ Object
DELETE - deletes the value from the list of values in the entity with - with the given value.
-
#entities(entity_id = nil) ⇒ Object
GET - returns a list of available entities given this instance with the given token if no id is given.
-
#get_intent(intent_id = nil) ⇒ Object
GET - returns either a list of intents if no id is given.
-
#get_message(message_id) ⇒ Object
GET - returns stored message for specific id.
-
#initialize(client) ⇒ Session
constructor
Initialize with the given client.
-
#refresh_last ⇒ Object
Used to refresh the last response given from the last request.
-
#refresh_results(result) ⇒ Object
Used to refresh the results from the given results.
-
#send_message(message) ⇒ Object
GET - extracted meaning form a sentence.
-
#send_sound_message(sound) ⇒ Object
POST - extract meaning from a audio file Do check the certain documentation of what the specific audio file should be.
-
#update_entity(entity_id) ⇒ Object
PUT - updates a given entity with the specific entity id.
Constructor Details
#initialize(client) ⇒ Session
Initialize with the given client.
9 10 11 |
# File 'lib/wit_ruby/rest/session.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#add_expression(entity_id, value, new_expression) ⇒ Object
POST - adds a new expression to the value of the entity.
70 71 72 |
# File 'lib/wit_ruby/rest/session.rb', line 70 def add_expression(entity_id, value, new_expression) end |
#add_value(entity_id, new_value) ⇒ Object
POST - adds the possible value into the list of values for the given
- entity with the id.
59 60 61 |
# File 'lib/wit_ruby/rest/session.rb', line 59 def add_value(entity_id, new_value) end |
#create_entity(new_entity) ⇒ Object
POST - creates a new entity with the given attributes.
46 47 |
# File 'lib/wit_ruby/rest/session.rb', line 46 def create_entity(new_entity) end |
#delete_entity(entity_id) ⇒ Object
DELETE - deletes the given entity with the entity id.
54 55 |
# File 'lib/wit_ruby/rest/session.rb', line 54 def delete_entity(entity_id) end |
#delete_expression(entity_id, value, expression) ⇒ Object
DELETE - deleetes the expression in the value of the entity.
75 76 77 |
# File 'lib/wit_ruby/rest/session.rb', line 75 def delete_expression(entity_id, value, expression) end |
#delete_value(entity_id, delete_value) ⇒ Object
DELETE - deletes the value from the list of values in the entity with
- with the given value.
65 66 67 |
# File 'lib/wit_ruby/rest/session.rb', line 65 def delete_value(entity_id, delete_value) end |
#entities(entity_id = nil) ⇒ Object
GET - returns a list of available entities given this instance with the
given token if no id is given.
- returns the specific entity and its parameters with a given id.
TODO - notify Wit.ai to fix their documentations as there is a wrong
- description.
41 42 43 |
# File 'lib/wit_ruby/rest/session.rb', line 41 def entities(entity_id = nil) end |
#get_intent(intent_id = nil) ⇒ Object
GET - returns either a list of intents if no id is given.
- returns the specific intent of the id given.
31 32 |
# File 'lib/wit_ruby/rest/session.rb', line 31 def get_intent(intent_id = nil) end |
#get_message(message_id) ⇒ Object
GET - returns stored message for specific id. TODO - possibly renaming as it is ambigious compared to send_message.
25 26 27 |
# File 'lib/wit_ruby/rest/session.rb', line 25 def () end |
#refresh_last ⇒ Object
Used to refresh the last response given from the last request.
86 87 88 89 |
# File 'lib/wit_ruby/rest/session.rb', line 86 def refresh_last last_result = @client.last_result return @client.request_from_result(last_result.restCode, last_result.path, last_result.body) end |
#refresh_results(result) ⇒ Object
Used to refresh the results from the given results.
80 81 82 83 |
# File 'lib/wit_ruby/rest/session.rb', line 80 def refresh_results(result) ## Call client with refresh results method return @client.request_from_result(result.restCode, result.path, result.body) end |
#send_message(message) ⇒ Object
GET - extracted meaning form a sentence
13 14 15 |
# File 'lib/wit_ruby/rest/session.rb', line 13 def () return @client.get("/message?q=#{message}") end |
#send_sound_message(sound) ⇒ Object
POST - extract meaning from a audio file Do check the certain documentation of what the specific audio file should be.
20 21 |
# File 'lib/wit_ruby/rest/session.rb', line 20 def (sound) end |
#update_entity(entity_id) ⇒ Object
PUT - updates a given entity with the specific entity id.
50 51 |
# File 'lib/wit_ruby/rest/session.rb', line 50 def update_entity(entity_id) end |