wit_ruby 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3328ab2cd43c12812263d053b76ff837a49e417
4
- data.tar.gz: 59e650ebf3617db50c71ea5fbc84667e6ecc4be3
3
+ metadata.gz: 971419a9504d3b3f6a033650f424daaba39f6a3b
4
+ data.tar.gz: f81c794354b97acf237ee363474b7dfb9513dff3
5
5
  SHA512:
6
- metadata.gz: 1e93dc0243f06bad3cfe1df8029c8794db0967bc16da4af4ab96b95e96f69c5a2e96a34d9bf76ee65386fe5262e053d46bc7b8121b8412b3332de4edcb4f008b
7
- data.tar.gz: 04c4971cf7229343f7230f1138039c67324b711f9c15d95553ee265601995a21dfe7b416307c4860b71bda3e8427f889bf63fa733bfca92eae2cb173b1666334
6
+ metadata.gz: ab3c0ab3b94f1c6b02d82ab2e4fe717d3a88641117fe4f2e1f45b21c7ef2e124995dcca013d3b38dee36176aae6051b38444aefa6ba957259ee5a9aa7d0b59ff
7
+ data.tar.gz: ec22891627f70d3d99e49abfe580c973819db15d8d6e2e052f42dc425a0fe8b9e31b13bf7b6cc05e55de23282e3a6e802030c5de20b03ae835ef4f1f5dc77ab2
data/CHANGELOG ADDED
@@ -0,0 +1,11 @@
1
+ == 0.0.2
2
+ * Implemented API call to get specific information from a sent message from it's given ID (GET).
3
+ * Intent specific API calls functional (GET).
4
+ * Changed description in gemspec.
5
+ * Change results to be returned as specific objects that inherit from the original class Result.
6
+ Message, Intent, Entity, Expression are the specific wrappers for results.
7
+ * Made error check so that only specific results can be refreshed. Refreshable objects are ones that
8
+ are directly returned from session calls.
9
+
10
+ == 0.0.1
11
+ * Implemented connection with wit.ai API and sending a text message (GET).
data/README.md CHANGED
@@ -1,8 +1,12 @@
1
- [![Build Status](https://travis-ci.org/gching/wit_ruby.svg?branch=master)](https://travis-ci.org/gching/wit_ruby)[travis]
1
+
2
2
 
3
3
  # WitRuby
4
4
 
5
- Provides a Ruby interface with the Wit.ai API.
5
+ Provides a unofficial Ruby API Wrapper for the Wit.ai API. Still implementing most functionalities. Go over to https://rubygems.org/gems/wit_ruby for specific information and documentation.
6
+
7
+ [![Build Status](https://travis-ci.org/gching/wit_ruby.svg?branch=master)](https://travis-ci.org/gching/wit_ruby)
8
+ [![Gem Version](https://badge.fury.io/rb/wit_ruby.png)](http://badge.fury.io/rb/wit_ruby)
9
+ [![Coverage Status](https://coveralls.io/repos/gching/wit_ruby/badge.png?branch=master)](https://coveralls.io/r/gching/wit_ruby?branch=master)
6
10
 
7
11
  ## Installation
8
12
 
@@ -20,10 +24,58 @@ Or install it yourself as:
20
24
 
21
25
  ## Usage
22
26
 
23
- TODO: Write usage instructions here
27
+ Remember to put this up to access it!
28
+
29
+ $ require 'wit_ruby'
30
+
31
+ To start using the wrapper, create a client with an authorization token given from Wit.ai. Set this either in ENV["WIT_AI_TOKEN"] or pass it on it the parameters as a hash. Default settings can be overridden by this hash as well.
32
+
33
+ $ ## Default to ENV["WIT_AI_TOKEN"]
34
+ $ client = Wit::REST::Client.new()
35
+ $ ## Override token when created
36
+ $ client = Wit::REST::Client.new(token: "Insert Token Here")
37
+
38
+ The client provides also a session for you to mainly do API calls. I suggest you save the session somewhere for easy access.
39
+
40
+ $ session = client.session
41
+
42
+ As of 0.0.2, only sending a message, getting message information and intent specific calls are implemented.
43
+
44
+ ## Message
45
+
46
+ To send a specific message, use the saved session to send a given string as a parameter.
47
+
48
+ $ results = session.send_message("Your Message")
49
+
50
+ To get a specific messages information from the wit.ai, pass in the message's ID and use the method below.
51
+
52
+ $ results = session.get_message("Message ID")
53
+
54
+ ## Intent
55
+
56
+ To get a list of intents in the specific instance over at wit.ai.
57
+
58
+ $ ## Array of all intents used.
59
+ $ results = session.get_intents
60
+
61
+ To get a specific intent information, pass in it's ID or name.
62
+
63
+ $ ## Specific intent information.
64
+ $ results = session.get_intents("Intent ID or Name")
65
+
66
+ ## Result
67
+
68
+ Every method returns a class wrapper corresponding specifically to that result. The superclass that is inherited (Wit::REST::Result) allows for you to easily access the results of the API call. The results is converted to a hash and is saved in this result class.
69
+ You can call methods on it and if it matches the result's hash, it will return it's value. For example,
70
+
71
+ $ ## results.hash = {"a" => "b"}
72
+ $ results.a
73
+ $ => "b"
24
74
 
25
75
  ## Contributing
26
76
 
77
+ I am a beginner developer so do contribute or help as much as possible! I definitely need to learn a lot :).
78
+
27
79
  1. Fork it
28
80
  2. Create your feature branch (`git checkout -b my-new-feature`)
29
81
  3. Commit your changes (`git commit -am 'Add some feature'`)
@@ -8,7 +8,6 @@ module Wit
8
8
  ## Wit::Session::Client class holds the authentication parameters and
9
9
  ## handles making the HTTP requests to the Wit API. These methods should be
10
10
  ## internally called and never called directly from the user.
11
-
12
11
  ## An example call to instantiate client is done like this with defaults:
13
12
  ##
14
13
  ## => @client = Wit::Session:Client.new
@@ -31,14 +30,15 @@ module Wit
31
30
  :retry_limit => 1,
32
31
  }
33
32
 
34
- ## Allows for the reading of the last request, last response, and the
35
- ## current session.
33
+ # Allows for the reading of the last request, last response, and the
34
+ # current session.
36
35
  attr_reader :last_req, :last_response, :session, :last_result
37
36
 
38
- ## Initialize the new instance with either the default parameters or
39
- ## given parameters.
40
- ## Token is either the set token in ENV["WIT_AI_TOKEN"] or given in the
41
- ## options.
37
+ ## Initialize the new instance with either the default parameters or given parameters.
38
+ ## Token can either be given in options or defaults to ENV["WIT_AI_TOKEN"]
39
+ ##
40
+ ## @param options [Hash] options to overide the defaults.
41
+ ## @return [Wit::REST::Client] new client connection.
42
42
  def initialize(options = {})
43
43
  ## Token is overidden if given in set params.
44
44
  @params = DEFAULTS.merge options
@@ -49,11 +49,16 @@ module Wit
49
49
 
50
50
 
51
51
  ## Change the given auth token.
52
+ ##
53
+ ## @param new_auth [String] new authorization token for client.
52
54
  def change_auth(new_auth)
53
55
  @auth_token = new_auth.strip
54
56
  end
55
57
 
56
58
  ## Defines each REST method for the given client. GET, PUT, POST and DELETE
59
+ ##
60
+ ## @param path [String] path for API call.
61
+ ## @return [Wit::REST::Result] results from the call.
57
62
  [:get, :put, :post, :delete].each do |rest_method|
58
63
  ## Get the given class for Net::HTTP depending on the current method.
59
64
  method_rest_class = Net::HTTP.const_get rest_method.to_s.capitalize
@@ -66,7 +71,11 @@ module Wit
66
71
  end
67
72
  end
68
73
 
69
- ## Takes in a body and path and creates a net/http class and uses it to call a request to API
74
+ ## Takes in a body and path and creates a net/http class and uses it to call a request to API.
75
+ ##
76
+ ## @param rest [String] rest code for the call.
77
+ ## @param path [String] path for the call.
78
+ ## @param body [Hash] body of the call.
70
79
  def request_from_result(rest, path, body)
71
80
  method_rest_class = Net::HTTP.const_get rest.capitalize
72
81
  refresh_request = method_rest_class.new path, {"Authorization" => "Bearer #{@auth_token}"}
@@ -78,7 +87,7 @@ module Wit
78
87
  #################################
79
88
  private
80
89
 
81
- ## Setup the session that allows for calling of
90
+ ## Setup the session that allows for calling of each method.
82
91
  def setup_session
83
92
  @session = Wit::REST::Session.new(self)
84
93
  end
@@ -111,6 +120,9 @@ module Wit
111
120
  end
112
121
 
113
122
  ## Connect and send the given request to Wit server.
123
+ ##
124
+ ## @param request [Net::HTTP] specific request class from Net::HTTP library.
125
+ ## @return [Wit::REST::Result] result from request.
114
126
  def connect_send(request)
115
127
  ## Set the last request parameter
116
128
  @last_req = request
@@ -125,19 +137,28 @@ module Wit
125
137
  case response.code
126
138
  when "200" then save_result_and_return(request, response)
127
139
  when "401" then raise Unauthorized, "Incorrect token or not set. Set ENV[\"WIT_AI_TOKEN\"] or pass into the options parameter as :token"
128
- #else raise BadResponse, "response code: #{response.status}"
140
+ else raise BadResponse, "response code: #{response.code}"
129
141
  end
130
142
 
131
143
  end
132
144
  end
133
-
145
+
134
146
  ## Save it into the instance last_result and return it.
147
+ ##
148
+ ## @param request [Net::HTTP] specific request class from Net::HTTP library.
149
+ ## @param response [Net::HTTP] response from call to API.
135
150
  def save_result_and_return(request, response)
136
- @last_result = Wit::REST::Result.new(MultiJson.load(response.body), request.method, request.path, request.body)
137
- return @last_result
151
+ ## Parse the data
152
+ parsed_data = MultiJson.load(response.body)
153
+ ## Save the last result as the super class Result
154
+ @last_result = Wit::REST::Result.new(parsed_data, request.method, request.path, request.body)
155
+ ## Return it
156
+ return @last_result
138
157
  end
139
158
 
140
159
 
141
160
  end
161
+
162
+ class BadResponse < Exception; end
142
163
  end
143
164
  end
@@ -0,0 +1,36 @@
1
+ ## entity.rb
2
+ ## Wrapper for entity results.
3
+
4
+ module Wit
5
+ module REST
6
+
7
+ ## Encompasses entity results.
8
+ class Entity < Result
9
+
10
+ end
11
+
12
+ ## Internal wrapper for multiple entities for a given result.
13
+ class MultiEntity
14
+ ## Creates an instance that holds array of intents.
15
+ ##
16
+ ## @param resultData [Array] array of hashes of intents.
17
+ ## @return [Wit::REST::MultiEntity] with instance variable of Array of intents.
18
+ def initialize(resultData)
19
+
20
+ entity_arr = Array.new
21
+ resultData.each do |entity|
22
+ entity_arr << Entity.new(entity)
23
+ end
24
+ @entities = entity_arr
25
+ end
26
+
27
+ ## Allow for index calls to the specific intents in the instance.
28
+ ##
29
+ ## @param num [Integer] index of the specific intent.
30
+ def [](num)
31
+ @entities[num]
32
+ end
33
+
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,12 @@
1
+ ## expression.rb
2
+ ## Internal wrapper for expression hash
3
+
4
+ module Wit
5
+ module REST
6
+ ## Internal wrapper for expressions in an intent.
7
+ class Expression < Result
8
+
9
+
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,93 @@
1
+ ## intent.rb
2
+ ## Wrapper for the superclass Result for intent specific results
3
+
4
+ module Wit
5
+ module REST
6
+
7
+ ## Intent wrapper for intent specific results
8
+ class Intent < Result
9
+
10
+ ## Performs additional instance variable generation for expressions.
11
+ ##
12
+ ## @param resultData [Hash] data from the call.
13
+ ## @param requestRest [String] rest code for the call.
14
+ ## @param requestPath [String] request path for the call.
15
+ ## @param requestBody [Hash] body of the call.
16
+ ## @return [Wit::REST::Expression] object that holds the intent result.
17
+ def initialize(resultData, requestRest=nil, requestPath=nil, requestBody=nil)
18
+ super
19
+ @expressions = @rawdata["expressions"].map do |expression_hash|
20
+ Expression.new(expression_hash)
21
+ end
22
+ end
23
+
24
+ ## Return the list of expressions as array of expression objects
25
+ ##
26
+ ## @return [Array] expressions in this intent.
27
+ def expressions
28
+ return @expressions
29
+ end
30
+
31
+ ## Return the expression bodies as an array of strings.
32
+ ##
33
+ ## @return [Array] body of each expression.
34
+ def expression_bodies
35
+ expression_bodies_arr = Array.new
36
+ @expressions.each do |expression|
37
+ expression_bodies_arr << expression.body
38
+ end
39
+ return expression_bodies_arr
40
+ end
41
+
42
+ ## Return entities used with there id as an array of strings.
43
+ ##
44
+ ## @return [Array] entity names that are used in this intent.
45
+ def entities_used
46
+ entities_arr = Array.new
47
+ @entities.each do |entity|
48
+ entities_arr << entity.id unless entities_arr.include?(entity.id)
49
+ end
50
+ return entities_arr
51
+ end
52
+
53
+
54
+ end
55
+
56
+ ## MultiIntent wraps around results that are an array with intents.
57
+ class MultiIntent < Result
58
+
59
+ ## Generates instance variable that holds intents as Wit::REST::Result.
60
+ ##
61
+ ## @param resultData [Hash] data from the call.
62
+ ## @param requestRest [String] rest code for the call.
63
+ ## @param requestPath [String] request path for the call.
64
+ ## @param requestBody [Hash] body of the call.
65
+ ## @return [Wit::REST::MultiIntent] object that holds the array of intents as result objects.
66
+ def initialize(resultData, requestRest=nil, requestPath=nil, requestBody=nil)
67
+ ## Pass in empty hash to default to method missing for everything not defined here.
68
+ super({}, requestRest, requestPath, requestBody)
69
+ @intents = resultData.map do |intent|
70
+ Result.new(intent)
71
+ end
72
+ end
73
+
74
+ ## Overide that assists in calling the proper index in the array of intent results.
75
+ ##
76
+ ## @param num [Integer] index of the array of Wit::REST::Result.
77
+ ## @return [Wit::REST::Result] specific intent at the index given.
78
+ def [](num)
79
+ @intents[num]
80
+ end
81
+
82
+ ## Assists in going through each intent in the instance variable.
83
+ ##
84
+ ## @return [Wit::REST::Result] lambda that provides each specific intent.
85
+ def each
86
+ @intents.each do |intent|
87
+ lambda{intent}
88
+ end
89
+ end
90
+
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,54 @@
1
+ ## message.rb
2
+ ## Wraps around results, specifically messages.
3
+ module Wit
4
+ module REST
5
+
6
+
7
+ ## Message wrapper for message specific results.
8
+ class Message < Result
9
+
10
+ ## Returns the confidence of the message results.
11
+ ##
12
+ ## @return [Float] confidence in the message for the intent.
13
+ def confidence
14
+ outcome["confidence"]
15
+ end
16
+
17
+ ## Returns the intent that this message corresponded to.
18
+ ##
19
+ ## @return [String] intent name that this message corrsponded to.
20
+ def intent
21
+ outcome["intent"]
22
+ end
23
+
24
+ ## Generates Array of the names of each entity in this message.
25
+ ##
26
+ ## @return [Array] names of each entity
27
+ def entity_names
28
+ entity_arr = Array.new
29
+ outcome["entities"].each_key do |key|
30
+ entity_arr << key
31
+ end
32
+ return entity_arr
33
+ end
34
+
35
+ ## Checks if the method is one of the keys in the hash. Overides the one
36
+ ## in Wit::REST::Result as it might correspond to a given entity.
37
+ ## If it is then we can return the given value.
38
+ ## If not, then go to method_missing in Wit::REST::Result.
39
+ ##
40
+ ## @params [Symbol] possible method or key in the hash or entity.
41
+ ## @return [String] [Integer] [Hash] depending on the given results in the data.
42
+ def method_missing(possible_key, *args, &block)
43
+ if @rawdata["outcome"]["entities"].has_key?(possible_key.to_s)
44
+ entity_value = @rawdata["outcome"]["entities"][possible_key.to_s]
45
+ entity_value.class == Hash ? Entity.new(entity_value) : MultiEntity.new(entity_value)
46
+ else
47
+ super
48
+ end
49
+ end
50
+
51
+
52
+ end
53
+ end
54
+ end
@@ -1,49 +1,119 @@
1
1
  ## result.rb
2
- ## Specifies class that handles the results given from each RESTful API call.
2
+ ## Specifies superclass that handles the results given from each RESTful API call.
3
3
 
4
4
 
5
5
  module Wit
6
6
  module REST
7
+
8
+ ## Wrapper for all results that is returned by the session and API calls.
7
9
  class Result
8
10
 
9
11
 
10
- ## Instantiates with a given hash.
11
- def initialize(resultHash, requestRest=nil, requestPath=nil, requestBody=nil)
12
- @originalHash = resultHash
13
- @requestRest = requestRest
14
- @requestPath = requestPath
15
- @requestBody = requestBody
16
- end
12
+ ## Instantiates with a given hash and its REST parameters.
13
+ ##
14
+ ## @param resultData [Hash] data from the call.
15
+ ## @param requestRest [String] rest code for the call.
16
+ ## @param requestPath [String] request path for the call.
17
+ ## @param requestBody [Hash] body of the call.
18
+ ## @return [Wit::REST::Result] object that holds result information.
19
+ def initialize(resultData, requestRest=nil, requestPath=nil, requestBody=nil)
20
+ @rawdata = resultData
21
+ @requestRest = requestRest
22
+ @requestPath = requestPath
23
+ @requestBody = requestBody
24
+ ## Sets self class to be the last index of the split class name.
25
+ @selfClass = self.class.name.split("::")[-1]
26
+ ## Setup lists / instance variables given the current class that is inheriting
27
+ setup_entities if ["Intent", "Expression"].include?(@selfClass)
28
+ end
17
29
 
18
- ## Returns the orginalHash instance variable.
19
- def hash
20
- return @originalHash
21
- end
30
+ ## Returns the orginalHash instance variable.
31
+ ##
32
+ ## @return [Hash] the raw data from the call.
33
+ def raw_data
34
+ return @rawdata
35
+ end
22
36
 
23
- ## Returns the REST code from the given request
24
- def restCode
25
- return @requestRest
26
- end
27
- ## Returns the request's body
28
- def body
29
- return @requestBody
30
- end
37
+ ## Returns the REST code from the given request.
38
+ ##
39
+ ## @return [String] request code from the call.
40
+ def restCode
41
+ return @requestRest
42
+ end
31
43
 
32
- ## Returns the request's path
33
- def path
34
- return @requestPath
35
- end
44
+ ## Returns the request's body.
45
+ ##
46
+ ## @return [String] request body from the call.
47
+ def restBody
48
+ return @requestBody
49
+ end
36
50
 
51
+ ## Returns the request's path.
52
+ ##
53
+ ## @return [String] request path from the call.
54
+ def restPath
55
+ return @requestPath
56
+ end
37
57
 
38
- ## Checks if the method is one of the keys in the hash.
39
- ## If it is then we can return the given value.
40
- ## If not, then raise a NoMethodError.
41
- def method_missing(possible_key, *args, &block)
42
- @originalHash.has_key?(possible_key.to_s) ? @originalHash[possible_key.to_s] : super
43
- end
44
58
 
59
+ ## Returns the list of entities from the given results. Only applicable
60
+ ## to a few objects. If the current class is not applicable, then raise an
61
+ ## error.
62
+ ##
63
+ ## @return [Array] array of entities.
64
+ def entities
65
+ unless ["Intent", "Expression"].include?(@selfClass)
66
+ raise NoMethodError.new(%(The current class "#{@selfClass}' does not incorporate the '#{__method__}' method.))
67
+ end
68
+
69
+ ## Included so return it.
70
+ return @entities
71
+ end
45
72
 
73
+ ## Checks if the method is one of the keys in the hash.
74
+ ## If it is then we can return the given value.
75
+ ## If not, then raise a NoMethodError.
76
+ ##
77
+ ## @params [Symbol] possible method or key in the hash
78
+ ## @return [String] [Integer] [Hash] depending on the given results in the data.
79
+ def method_missing(possible_key, *args, &block)
80
+ @rawdata.has_key?(possible_key.to_s) ? @rawdata[possible_key.to_s] : super
81
+ end
82
+
83
+ ## Method to check if this current object is refreshable.
84
+ ## It is refresahble if the request parameters for checking is not nil;
85
+ ##
86
+ ## @return [Boolean] indicating if the current object is refreshable.
87
+ def refreshable?
88
+ !@requestRest.nil?
89
+ end
90
+
91
+
92
+
93
+ private
94
+
95
+ ## Setups entities list if the current class demands it.
96
+ ##
97
+ ## @return [Array] entities in this current result object.
98
+ def setup_entities
99
+ ## Get the current entities hash
100
+ entities_raw = @rawdata["entities"] || @rawdata["outcome"]["entities"]
101
+ ## Set the intance variable to be an array containing these entities.
102
+ ## If its empty, then set the instance variable to nil
103
+ unless entities_raw.empty?
104
+ entities_arr = Array.new
105
+ entities_raw.each do |entity_value|
106
+ entities_arr << Entity.new(entity_value)
107
+ end
108
+ @entities = entities_arr
109
+ else
110
+ @entities = nil
111
+ end
112
+ return @entities
113
+
114
+ end
46
115
 
47
116
  end
117
+
48
118
  end
49
119
  end
@@ -6,29 +6,56 @@ module Wit
6
6
  module REST
7
7
  class Session
8
8
  ## Initialize with the given client.
9
+ ##
10
+ ## @param client [Wit::REST::Client] client of the connection
9
11
  def initialize(client)
10
12
  @client = client
11
13
  end
12
- ## GET - extracted meaning form a sentence
14
+ ## GET - extracted meaning from a sentence.
15
+ ##
16
+ ## @param message [String] sentence being examined from API.
17
+ ## @return [Wit::REST::Message] message results from API.
13
18
  def send_message(message)
14
- return @client.get("/message?q=#{message}")
19
+ ## Recieve unwrapped results
20
+ results = @client.get("/message?q=#{message}")
21
+ return Message.new(results.raw_data, results.restCode, results.restPath, results.restBody)
15
22
  end
16
23
 
17
24
  ## POST - extract meaning from a audio file
18
25
  ## Do check the certain documentation of what the specific audio file
19
26
  ## should be.
27
+ ##
28
+ ## @param sound [String] path to sound file.
20
29
  def send_sound_message(sound)
21
30
  end
22
31
 
23
32
  ## GET - returns stored message for specific id.
24
33
  ## TODO - possibly renaming as it is ambigious compared to send_message.
34
+ ## TODO - Notify Wit.ai as there documentation does not include the stats parameter
35
+ ##
36
+ ## @param message_id [String] message id of message in API servers.
37
+ ## @return [Wit::REST::Message] message results from the given id.
25
38
  def get_message(message_id)
39
+ results = @client.get("/messages/#{message_id}")
26
40
 
41
+ return Message.new(results.raw_data, results.restCode, results.restPath, results.restBody)
27
42
  end
28
43
 
29
44
  ## GET - returns either a list of intents if no id is given.
30
45
  ## - returns the specific intent of the id given.
31
- def get_intent(intent_id = nil)
46
+ ##
47
+ ## @param intent_indicator [String] the id or name of the intent
48
+ ## @return [Wit:REST::Intent] [Wit::REST::MultiIntent] results of intent call to API.
49
+ def get_intents(intent_indicator = nil)
50
+ ## TODO - Raise error if no intents
51
+
52
+ ## No spefic id, so get list of intents or specific id, return it as Intent object
53
+ results = intent_indicator.nil? ? @client.get("/intents") : @client.get("/intents/#{intent_indicator}")
54
+
55
+ ## Same concept but wrap it around proper object
56
+ returnObject = intent_indicator.nil? ? MultiIntent : Intent
57
+ return returnObject.new(results.raw_data, results.restCode, results.restPath, results.restBody)
58
+
32
59
  end
33
60
 
34
61
  ## TODO - look into corpus
@@ -76,19 +103,35 @@ module Wit
76
103
 
77
104
  end
78
105
 
79
- ## Used to refresh the results from the given results.
106
+ ## Used to refresh the results from the given results. Only applicable to result objects that directly
107
+ ## came from the session.
108
+ ##
109
+ ## @param result [Wit::REST::Result] result from a call that is going to be refreshed.
110
+ ## @return [Wit::REST::Result] result back that will be wrapped around it's specific wrapper object
80
111
  def refresh_results(result)
81
112
  ## Call client with refresh results method
82
- return @client.request_from_result(result.restCode, result.path, result.body)
113
+ ## Checks to see if its part of the specified objects in the Wit module
114
+ ## Checks to see if the object is refreshable
115
+ ## If it isn't part of one of these two, then raise error for not being refreshable.
116
+ result_class = result.class
117
+ unless result_class.name.split("::")[0] == "Wit" && result.refreshable?
118
+ raise NotRefreshable.new(%(The inputted object with class "#{result.class}" is not refreshable.))
119
+ end
120
+ refreshed_result = @client.request_from_result(result.restCode, result.restPath, result.restBody)
121
+ return result_class.new(refreshed_result.raw_data, refreshed_result.restCode, refreshed_result.restPath, refreshed_result.restBody)
83
122
  end
84
123
 
85
124
  ## Used to refresh the last response given from the last request.
125
+ ## TODO - fix wrapper
126
+ ##
127
+ ## @return [Wit::REST::Result] refreshed result from last result
86
128
  def refresh_last
87
129
  last_result = @client.last_result
88
- return @client.request_from_result(last_result.restCode, last_result.path, last_result.body)
130
+ return @client.request_from_result(last_result.restCode, last_result.restPath, last_result.restBody)
89
131
  end
90
132
 
91
-
92
133
  end
134
+
135
+ class NotRefreshable < Exception; end
93
136
  end
94
137
  end
@@ -1,3 +1,3 @@
1
1
  module Wit
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/wit_ruby.rb CHANGED
@@ -7,3 +7,7 @@ require "wit_ruby/version"
7
7
  require "wit_ruby/rest/client"
8
8
  require "wit_ruby/rest/session"
9
9
  require "wit_ruby/rest/result"
10
+ require "wit_ruby/rest/message"
11
+ require "wit_ruby/rest/intent"
12
+ require "wit_ruby/rest/entity"
13
+ require "wit_ruby/rest/expression"
data/spec/spec_helper.rb CHANGED
@@ -7,9 +7,23 @@ require 'pry'
7
7
 
8
8
  require 'webmock/rspec'
9
9
  require 'vcr'
10
+ require 'timeout'
10
11
 
11
12
  #VCR config
12
13
  VCR.configure do |c|
13
14
  c.cassette_library_dir = 'spec/fixtures/wit_cassettes'
14
15
  c.hook_into :webmock
16
+ allow_next_request_at = nil
17
+ filters = [:real?, lambda { |r| URI(r.uri).host == 'api.wit.ai' }]
18
+
19
+ c.after_http_request(*filters) do |request, response|
20
+ allow_next_request_at = Time.now + 1
21
+ end
22
+
23
+ c.before_http_request(*filters) do |request|
24
+ if allow_next_request_at && Time.now < allow_next_request_at
25
+ sleep(allow_next_request_at - Time.now)
26
+ end
27
+ end
28
+
15
29
  end
@@ -0,0 +1,49 @@
1
+ ## entity_spec.rb
2
+ ## Used to test functionalities of the entity wrapper for results.
3
+
4
+ require 'spec_helper'
5
+
6
+ describe Wit::REST::Entity do
7
+ let(:json) {%({
8
+ "builtin": true,
9
+ "doc": "Temperature in degrees Celcius or Fahrenheit",
10
+ "id": "temperature",
11
+ "name": "535856ea-db8b-492b-a159-fc78cd016a4b"
12
+ })}
13
+ let(:rand_path) {"rand_path"}
14
+ let(:rand_body) {"rand_body"}
15
+ let(:rest_code) {"get"}
16
+ let(:entity_results) {Wit::REST::Entity.new(MultiJson.load(json), rand_path, rand_body, rest_code)}
17
+
18
+ it "should have builtin as true" do
19
+ expect(entity_results.builtin).to eql(true)
20
+ end
21
+
22
+ end
23
+
24
+ describe Wit::REST::MultiEntity do
25
+ let(:json_two) {%([
26
+ {
27
+ "value": {
28
+ "from": "2013-10-21T00:00:00.000Z",
29
+ "to": "2013-10-22T00:00:00.000Z"
30
+ },
31
+ "body": "Tuesday"
32
+ },
33
+ {
34
+ "value": {
35
+ "from": "2013-10-24T00:00:00.000Z",
36
+ "to": "2013-10-25T00:00:00.000Z"
37
+ },
38
+ "body": "Friday"
39
+ }
40
+ ])}
41
+ let(:entity_coll) {Wit::REST::MultiEntity.new(MultiJson.load(json_two))}
42
+
43
+
44
+ it "should be an array with entities" do
45
+ expect(entity_coll[0].class).to eql(Wit::REST::Entity)
46
+ expect(entity_coll[0].body).to eql("Tuesday")
47
+ end
48
+
49
+ end
@@ -0,0 +1,38 @@
1
+ ## expression_spec.rb
2
+ ## Used to test functionalities of internal result wrappers for expressions.
3
+ require 'spec_helper'
4
+
5
+ describe Wit::REST::Expression do
6
+ let(:json) {%(
7
+ {
8
+ "id" : "-2385b07a3900bd-8393b722-6d4e-4185-bb18-410136cdb794",
9
+ "body" : "fly from incheon to sfo",
10
+ "entities" : [ {
11
+ "wisp" : "wit$location",
12
+ "start" : 20,
13
+ "end" : 23,
14
+ "role" : "dest",
15
+ "body" : "sfo",
16
+ "value" : "sfo"
17
+ }, {
18
+ "wisp" : "wit$location",
19
+ "start" : 9,
20
+ "end" : 16,
21
+ "role" : "orig",
22
+ "body" : "incheon ",
23
+ "value" : "incheon"
24
+ } ]
25
+ })}
26
+ let(:express_results) {Wit::REST::Expression.new(MultiJson.load(json))}
27
+
28
+ it "should have a list of entities" do
29
+ expect(express_results.entities.class).to eql(Array)
30
+ expect(express_results.entities[0].class).to eql(Wit::REST::Entity)
31
+ end
32
+
33
+ it "should have the correct indexes and values" do
34
+ expect(express_results.entities[0].start).to eql(20)
35
+ expect(express_results.entities[1].start).to eql(9)
36
+ end
37
+
38
+ end
@@ -0,0 +1,116 @@
1
+ ## intent_spec.rb
2
+ ## Used to test functionalities of intent wrapper in wit_ruby/rest/intent.rb
3
+
4
+ require 'spec_helper'
5
+
6
+ describe Wit::REST::Intent do
7
+ let(:json) {%({
8
+ "expressions" : [ {
9
+ "id" : "-2385b07a3900bd-8393b722-6d4e-4185-bb18-410136cdb794",
10
+ "body" : "fly from incheon to sfo",
11
+ "entities" : [ {
12
+ "wisp" : "wit$location",
13
+ "start" : 20,
14
+ "end" : 23,
15
+ "role" : "dest",
16
+ "body" : "sfo",
17
+ "value" : "sfo"
18
+ }, {
19
+ "wisp" : "wit$location",
20
+ "start" : 9,
21
+ "end" : 16,
22
+ "role" : "orig",
23
+ "body" : "incheon ",
24
+ "value" : "incheon"
25
+ } ]
26
+ }, {
27
+ "id" : "-2385b07e09b74a-d95db384-fac2-4e41-85ca-3072778aa99c",
28
+ "body" : "i wanna fly from JFK to SFO",
29
+ "entities" : [ {
30
+ "wisp" : "wit$location",
31
+ "start" : 24,
32
+ "end" : 27,
33
+ "role" : "dest",
34
+ "body" : "SFO",
35
+ "value" : "SFO"
36
+ }, {
37
+ "wisp" : "wit$location",
38
+ "start" : 17,
39
+ "end" : 20,
40
+ "role" : "orig",
41
+ "body" : "JFK ",
42
+ "value" : "JFK"
43
+ } ]
44
+ } ],
45
+ "entities" : [ {
46
+ "role" : "dest",
47
+ "id" : "wit$location"
48
+ }, {
49
+ "role" : "orig",
50
+ "id" : "wit$location"
51
+ } ],
52
+ "id" : "52bab83b-fbef-40db-b19d-a0dccd38cfdc",
53
+ "name" : "book_flight",
54
+ "doc" : "book flight"
55
+ })}
56
+ let(:rand_path) {"rand_path"}
57
+ let(:rand_body) {"rand_body"}
58
+ let(:rest_code) {"get"}
59
+ let(:intent_results) {Wit::REST::Intent.new(MultiJson.load(json), rand_path, rand_body, rest_code)}
60
+
61
+
62
+ it "should have a list of entities" do
63
+ expect(intent_results.entities.class).to eql(Array)
64
+ expect(intent_results.entities[0].class).to eql(Wit::REST::Entity)
65
+ end
66
+ it "should have a list of expressions" do
67
+ expect(intent_results.expressions.class).to eql(Array)
68
+ expect(intent_results.expressions[0].class).to eql(Wit::REST::Expression)
69
+ end
70
+
71
+ it "should have the right values in the entities" do
72
+ expect(intent_results.entities[0].role).to eql("dest")
73
+ expect(intent_results.entities[1].role).to eql("orig")
74
+ end
75
+
76
+ it "should have the right values for expressions" do
77
+ expect(intent_results.expressions[0].body).to eql("fly from incheon to sfo")
78
+ expect(intent_results.expressions[1].body).to eql("i wanna fly from JFK to SFO")
79
+ end
80
+ it "should return the body names for each expressions as an array of strings" do
81
+ expect(intent_results.expression_bodies).to eql(["fly from incheon to sfo", "i wanna fly from JFK to SFO"])
82
+ end
83
+ it "should return used entities as an array of strings" do
84
+ expect(intent_results.entities_used).to eql(["wit$location"])
85
+ end
86
+
87
+
88
+ end
89
+
90
+ describe Wit::REST::MultiIntent do
91
+ let(:json_two) {%([ {
92
+ "id" : "52bab833-e024-4f15-b927-8e0772d1540c",
93
+ "name" : "recover_password",
94
+ "doc" : "Recover password (which is different from Reset password).",
95
+ "metadata" : "password_23433253254"
96
+ }, {
97
+ "id" : "52bab833-9a1e-4bff-b659-99ee95e6c1f9",
98
+ "name" : "transfer",
99
+ "doc" : "Transfer some amount of money between two accounts."
100
+ }, {
101
+ "id" : "52bab833-3e23-4c67-9cfc-a0fed605bd77",
102
+ "name" : "show_movie",
103
+ "doc" : "Show a given movie."
104
+ } ])}
105
+ let(:rand_path) {"rand_path"}
106
+ let(:rand_body) {"rand_body"}
107
+ let(:rest_code) {"get"}
108
+ let(:multi_intent_results) {Wit::REST::MultiIntent.new(MultiJson.load(json_two), rand_path, rand_body, rest_code)}
109
+
110
+ it "should each be saved as a result object" do
111
+ multi_intent_results.each do |intent|
112
+ expect(intent.class).to eql Result
113
+ end
114
+ end
115
+
116
+ end
@@ -0,0 +1,63 @@
1
+ ## message_spec.rb
2
+ ## Used to test wrapper for message results
3
+
4
+
5
+ require 'spec_helper'
6
+
7
+ describe Wit::REST::Message do
8
+ let(:json) {%({
9
+ "msg_id": "ba0fcf60-44d3-4499-877e-c8d65c239730",
10
+ "msg_body": "how many people between Tuesday and Friday",
11
+ "outcome": {
12
+ "intent": "query_metrics",
13
+ "entities": {
14
+ "metric": {
15
+ "value": "metric_visitors",
16
+ "body": "people",
17
+ "metadata": "{'code' : 324}"
18
+ },
19
+ "datetime": [
20
+ {
21
+ "value": {
22
+ "from": "2013-10-21T00:00:00.000Z",
23
+ "to": "2013-10-22T00:00:00.000Z"
24
+ },
25
+ "body": "Tuesday"
26
+ },
27
+ {
28
+ "value": {
29
+ "from": "2013-10-24T00:00:00.000Z",
30
+ "to": "2013-10-25T00:00:00.000Z"
31
+ },
32
+ "body": "Friday"
33
+ }
34
+ ]
35
+ },
36
+ "confidence": 0.979
37
+ }
38
+ })}
39
+ let(:rand_path) {"rand_path"}
40
+ let(:rand_body) {"rand_body"}
41
+ let(:rest_code) {"get"}
42
+ let(:message_results) {Wit::REST::Message.new(MultiJson.load(json), rand_path, rand_body, rest_code)}
43
+
44
+
45
+ it "should have the following parameters, confidence and intent and entities" do
46
+ expect(message_results.confidence).to eql(0.979)
47
+ expect(message_results.intent).to eql("query_metrics")
48
+ expect(message_results.metric.class).to eql(Wit::REST::Entity)
49
+ expect(message_results.datetime.class).to eql(Wit::REST::MultiEntity)
50
+ end
51
+
52
+ it "should have the right values in the entities" do
53
+ expect(message_results.metric.value).to eql("metric_visitors")
54
+ expect(message_results.datetime[0].body).to eql("Tuesday")
55
+ end
56
+
57
+ it "should be able to return back an array of strings of the names of each entity" do
58
+ expect(message_results.entity_names).to eql(["metric", "datetime"])
59
+ end
60
+
61
+
62
+
63
+ end
@@ -8,10 +8,10 @@ describe Wit::REST::Result do
8
8
  let(:rand_body) {"rand_body"}
9
9
  let(:rest_code) {"post"}
10
10
  let(:result) {Wit::REST::Result.new(randHash, rest_code, rand_path, rand_body)}
11
-
11
+ let(:not_refresh_result) {Wit::REST::Result.new(randHash)}
12
12
 
13
13
  it "should have an instance of the original hash" do
14
- expect(result.hash).to eql(randHash)
14
+ expect(result.raw_data).to eql(randHash)
15
15
  end
16
16
 
17
17
  it "should raise an error for a method that is not in the attributes of the hash" do
@@ -31,8 +31,13 @@ describe Wit::REST::Result do
31
31
 
32
32
  it "should have an optional parameters to store the original request's body and pth" do
33
33
  expect(result.restCode).to eql(rest_code)
34
- expect(result.path).to eql(rand_path)
35
- expect(result.body).to eql(rand_body)
34
+ expect(result.restPath).to eql(rand_path)
35
+ expect(result.restBody).to eql(rand_body)
36
+ end
37
+
38
+ it "should be refereshable if rest parameters and path/body are given and not if it isn't given" do
39
+ expect(result.refreshable?).to be_true
40
+ expect(not_refresh_result.refreshable?).to be_false
36
41
  end
37
42
 
38
43
  end
@@ -7,6 +7,7 @@ describe Wit::REST::Session do
7
7
  let(:auth) {"randomAuth"}
8
8
  let(:randClient) {"randomClient"}
9
9
  let(:message) {"Hi"}
10
+ let(:rand_hash) {{"a" => "a", "b" => "b"}}
10
11
  let(:randSession) {Wit::REST::Session.new(randClient)}
11
12
  let(:session) {Wit::REST::Client.new.session}
12
13
 
@@ -29,8 +30,8 @@ describe Wit::REST::Session do
29
30
  randSession.should respond_to(:get_message)
30
31
  end
31
32
 
32
- it "get_intent(intent_id = nil)" do
33
- randSession.should respond_to(:get_intent)
33
+ it "get_intents(intent_id = nil)" do
34
+ randSession.should respond_to(:get_intents)
34
35
  end
35
36
 
36
37
  it ".entities(entity_id = nil)" do
@@ -72,7 +73,7 @@ describe Wit::REST::Session do
72
73
 
73
74
  describe "Sending message" do
74
75
  let(:result) {session.send_message(message)}
75
- let(:result_hash){result.hash}
76
+ let(:result_data){result.raw_data}
76
77
 
77
78
  before do
78
79
  VCR.insert_cassette 'message', record: :new_episodes
@@ -81,12 +82,12 @@ describe Wit::REST::Session do
81
82
  VCR.eject_cassette
82
83
  end
83
84
 
84
- it "should return an object of class Result" do
85
- expect(result.class).to eql(Wit::REST::Result)
85
+ it "should return an object of class Message" do
86
+ expect(result.class).to eql(Wit::REST::Message)
86
87
  end
87
88
 
88
89
  it "should have a message id method" do
89
- expect(result.msg_id).to eql(result.hash["msg_id"])
90
+ expect(result.msg_id).to eql(result_data["msg_id"])
90
91
  end
91
92
 
92
93
 
@@ -99,7 +100,7 @@ describe Wit::REST::Session do
99
100
  @results = session.send_message(message)
100
101
  stub_request(:any, /api.wit.ai/).to_timeout
101
102
  end
102
-
103
+ let(:random_result) {Wit::REST::Result.new(rand_hash)}
103
104
 
104
105
 
105
106
  it "must be able refresh and resend the call to the API given the result class" do
@@ -110,6 +111,11 @@ describe Wit::REST::Session do
110
111
  expect{session.refresh_last}.to raise_error(Timeout::Error)
111
112
  end
112
113
 
114
+ it "should not be able to refresh a not refreshable object" do
115
+ expect{session.refresh_results("random_class")}.to raise_error(Wit::REST::NotRefreshable)
116
+ expect{session.refresh_results(random_result)}.to raise_error(Wit::REST::NotRefreshable)
117
+ end
118
+
113
119
 
114
120
 
115
121
  end
@@ -117,4 +123,64 @@ describe Wit::REST::Session do
117
123
  end
118
124
 
119
125
 
126
+ describe "Geting message info" do
127
+ let(:sent_message_result) {session.send_message(message)}
128
+ let(:sent_message_id) {sent_message_result.msg_id}
129
+ before do
130
+ VCR.insert_cassette 'get_message', record: :once
131
+ end
132
+ after do
133
+ VCR.eject_cassette
134
+ end
135
+ describe "Getting back message info " do
136
+
137
+ before do
138
+ @resulting_message = session.get_message(sent_message_id)
139
+ end
140
+
141
+ it "should get back the same message and have the same has as the sent message results" do
142
+ expect(@resulting_message.msg_id).to eql(sent_message_id)
143
+ expect(@resulting_message.msg_body).to eql(sent_message_result.msg_body)
144
+ end
145
+ end
146
+ end
147
+
148
+ describe "Get intents" do
149
+ let(:get_intent_arr) {session.get_intents}
150
+
151
+
152
+ before do
153
+ VCR.insert_cassette 'get_intents', record: :new_episodes
154
+ end
155
+ after do
156
+ VCR.eject_cassette
157
+ end
158
+ it "should have returned an array of intents in class MultiIntent if not given an id" do
159
+ expect(get_intent_arr.class).to eql(Wit::REST::MultiIntent)
160
+ expect(get_intent_arr[0].class).to eql(Wit::REST::Result)
161
+ end
162
+
163
+ end
164
+
165
+ describe "Get specific intent" do
166
+ let(:get_intent_arr) {session.get_intents}
167
+ let(:intent_id) {get_intent_arr[0].id}
168
+ let(:intent_name) {get_intent_arr[0].name}
169
+ let(:get_intent_id) {session.get_intents(intent_id)}
170
+ let(:get_intent_name) {session.get_intents(intent_name)}
171
+ before do
172
+ VCR.insert_cassette 'get_intent_specific', record: :new_episodes
173
+ end
174
+ after do
175
+ VCR.eject_cassette
176
+ end
177
+
178
+ it "should return an intent result if given an id or name and must be same results" do
179
+ expect(get_intent_id.class).to eql(Wit::REST::Intent)
180
+ expect(get_intent_name.class).to eql(Wit::REST::Intent)
181
+ expect(get_intent_id.id).to eql(get_intent_name.id)
182
+ end
183
+
184
+ end
185
+
120
186
  end
data/wit_ruby.gemspec CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Wit::VERSION
9
9
  spec.authors = ["Gavin Ching"]
10
10
  spec.email = ["gavinchingy@gmail.com"]
11
- spec.description = %q{Provides a Ruby interface with the Wit.ai API.}
12
- spec.summary = %q{Provides a Ruby interface with the Wit.ai API.}
11
+ spec.description = %q{Provides a Ruby API wrapper with the Wit.ai API.}
12
+ spec.summary = %q{Provides a Ruby API wrapper with the Wit.ai API.}
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
@@ -19,8 +19,9 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.required_ruby_version = ">= 1.8.7"
22
- spec.add_development_dependency "bundler", "~> 1.3"
23
22
  spec.add_dependency('multi_json', '>= 1.3.0')
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
24
25
  spec.add_development_dependency "rake"
25
26
  spec.add_development_dependency "rspec"
26
27
  spec.add_development_dependency "rspec-nc"
metadata CHANGED
@@ -1,43 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wit_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Ching
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-08 00:00:00.000000000 Z
11
+ date: 2014-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: bundler
14
+ name: multi_json
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
20
- type: :development
19
+ version: 1.3.0
20
+ type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: 1.3.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: multi_json
28
+ name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 1.3.0
34
- type: :runtime
33
+ version: '1.3'
34
+ type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 1.3.0
40
+ version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -192,7 +192,7 @@ dependencies:
192
192
  - - ">="
193
193
  - !ruby/object:Gem::Version
194
194
  version: '0'
195
- description: Provides a Ruby interface with the Wit.ai API.
195
+ description: Provides a Ruby API wrapper with the Wit.ai API.
196
196
  email:
197
197
  - gavinchingy@gmail.com
198
198
  executables: []
@@ -202,6 +202,7 @@ files:
202
202
  - ".coveralls.yml"
203
203
  - ".gitignore"
204
204
  - ".travis.yml"
205
+ - CHANGELOG
205
206
  - Gemfile
206
207
  - Guardfile
207
208
  - LICENSE.txt
@@ -210,11 +211,19 @@ files:
210
211
  - conf/cacert.pem
211
212
  - lib/wit_ruby.rb
212
213
  - lib/wit_ruby/rest/client.rb
214
+ - lib/wit_ruby/rest/entity.rb
215
+ - lib/wit_ruby/rest/expression.rb
216
+ - lib/wit_ruby/rest/intent.rb
217
+ - lib/wit_ruby/rest/message.rb
213
218
  - lib/wit_ruby/rest/result.rb
214
219
  - lib/wit_ruby/rest/session.rb
215
220
  - lib/wit_ruby/version.rb
216
221
  - spec/spec_helper.rb
217
222
  - spec/wit_ruby/rest/client_spec.rb
223
+ - spec/wit_ruby/rest/entity_spec.rb
224
+ - spec/wit_ruby/rest/expression_spec.rb
225
+ - spec/wit_ruby/rest/intent_spec.rb
226
+ - spec/wit_ruby/rest/message_spec.rb
218
227
  - spec/wit_ruby/rest/result_spec.rb
219
228
  - spec/wit_ruby/rest/session_spec.rb
220
229
  - wit_ruby.gemspec
@@ -241,9 +250,13 @@ rubyforge_project:
241
250
  rubygems_version: 2.1.10
242
251
  signing_key:
243
252
  specification_version: 4
244
- summary: Provides a Ruby interface with the Wit.ai API.
253
+ summary: Provides a Ruby API wrapper with the Wit.ai API.
245
254
  test_files:
246
255
  - spec/spec_helper.rb
247
256
  - spec/wit_ruby/rest/client_spec.rb
257
+ - spec/wit_ruby/rest/entity_spec.rb
258
+ - spec/wit_ruby/rest/expression_spec.rb
259
+ - spec/wit_ruby/rest/intent_spec.rb
260
+ - spec/wit_ruby/rest/message_spec.rb
248
261
  - spec/wit_ruby/rest/result_spec.rb
249
262
  - spec/wit_ruby/rest/session_spec.rb