Class: Wit::REST::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/wit_ruby/rest/session.rb

Instance Method Summary collapse

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 get_message(message_id)

end

#refresh_lastObject

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 send_message(message)
   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 send_sound_message(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