wit_ruby 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5534ada2f3ea5d5ebcfdb9b9b99490593d72ea3b
4
- data.tar.gz: cf4ad6b74d4c9b4b5a4b2ba2cf993c3474f377de
3
+ metadata.gz: 35527605a33f51d07c685e9973074d80adc2a342
4
+ data.tar.gz: 5f98a7b4f5549d06e5380fcc2a55d22496d9f1b3
5
5
  SHA512:
6
- metadata.gz: 3f0c8772cfd22460b81bc6434361f9b3d750472d72d45878083f78a360660611957075d6c2ffcd257f6b7948fb28fba69278edb9cbb006f34505a0e2ed66b2fb
7
- data.tar.gz: ce28e95eb5caa6ce91017ae0e22a632a061f025aec8e8cc4575ec982b67b19458ec69749436a478b32ab128ab22c7ebccb662498c6d864733fe09dfd465c924f
6
+ metadata.gz: 7c8663cf2937717cd9179db12645e7848d44649bc8f93c3d1725e4fcb25ff6ffd048e88c3427a194dd7ebfdb88179d93be76598d82fea6f092bf9e80b8ca008c
7
+ data.tar.gz: a2f6aad050b9e0dd33ec0a86813ed8eae1d7037057fb2147244755116bd84641f9605f9530eff92fc034a2fac5c253b7ceea06ef27d7e336c6f12ec419f52acf
data/CHANGELOG CHANGED
@@ -1,3 +1,6 @@
1
+ == 1.0.1
2
+ * Added fix to raise an error if a sent message has a length that is not between 0 to 256.
3
+
1
4
  == 1.0.0
2
5
  * Yay! 1.0.0 for no reason! (Kinda.)
3
6
  * Added error checking to make sure input parameters to the session are correct.
data/README.md CHANGED
@@ -2,15 +2,19 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/gching/wit_ruby.svg?branch=master)](https://travis-ci.org/gching/wit_ruby)
4
4
  [![Gem Version](https://badge.fury.io/rb/wit_ruby.png)](http://badge.fury.io/rb/wit_ruby)
5
+ [![Dependency Status](https://gemnasium.com/gching/wit_ruby.svg)](https://gemnasium.com/gching/wit_ruby)
5
6
  [![Coverage Status](https://coveralls.io/repos/gching/wit_ruby/badge.png?branch=master)](https://coveralls.io/r/gching/wit_ruby?branch=master)
6
7
 
7
- Provides a unofficial and (seemingly) pleasant Ruby API Wrapper for the Wit.ai API. As of 1.0.0, most functionalities have been implemented. Go over to https://rubygems.org/gems/wit_ruby for more information.
8
+
9
+ Provides a unofficial and (seemingly) pleasant Ruby API Wrapper for the Wit.AI API (Natural Language Interface) As of 1.0.0, most functionalities have been implemented. Go over to https://rubygems.org/gems/wit_ruby for more information.
10
+
11
+ I want to first off mention big props to the Wit.AI team. They are the true wizards here in making this beauty and by no means did I contribute anything magical. Do go check them out at http://wit.ai/! THANK YOU Wit.AI!
8
12
 
9
13
  Documentation that you will definitely need : http://rubydoc.info/gems/wit_ruby/
10
14
 
11
- Do also reference the Wit.ai API documentation : https://wit.ai/docs/api
15
+ Do also reference the Wit.AI API documentation : https://wit.ai/docs/api
12
16
 
13
- There are other gems that are also Ruby wrappers for Wit.ai, but this was more of learning experience for me! If you don't find this pleasing, do check the others out!
17
+ There are other gems that are also Ruby wrappers for Wit.AI, but this was more of learning experience for me! If you don't find this pleasing, do check the others out!
14
18
 
15
19
  https://github.com/modeset/wit-ruby
16
20
 
@@ -20,6 +20,11 @@ module Wit
20
20
  ## @return [Wit::REST::Message] message results from API.
21
21
  ## @todo allow for JSON pass in.
22
22
  def send_message(message)
23
+ ## Check to see if message length is between 0 and 256
24
+ length = message.length
25
+ if length <= 0 || length > 256
26
+ raise NotCorrectSchema.new("The given message, \"#{message}\" is either too short or too long. Message length needs to be between 0 and 256.")
27
+ end
23
28
  ## Recieve unwrapped results
24
29
  results = @client.get("/message?q=#{message}")
25
30
  return return_with_class(Wit::REST::Message, results)
@@ -194,7 +199,7 @@ module Wit
194
199
  ##
195
200
  class NotRefreshable < Exception; end
196
201
 
197
- ## Raised when the given result object does not have required parameters.
202
+ ## Raised when the given paremeters do not fit the required schema.
198
203
  ##
199
204
  class NotCorrectSchema < Exception; end
200
205
 
@@ -1,3 +1,3 @@
1
1
  module Wit
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
@@ -121,6 +121,20 @@ describe Wit::REST::Session do
121
121
 
122
122
  end
123
123
 
124
+ describe "error" do
125
+ before do
126
+ @over_length = "".ljust(257,"derp")
127
+ @zero_length = ""
128
+ end
129
+ it "should raise an error for being over 256 length" do
130
+ expect{session.send_message(@over_length)}.to raise_error(Wit::REST::NotCorrectSchema)
131
+ end
132
+
133
+ it "should raise an error for having zero length" do
134
+ expect{session.send_message(@zero_length)}.to raise_error(Wit::REST::NotCorrectSchema)
135
+ end
136
+ end
137
+
124
138
  end
125
139
 
126
140
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wit_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
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-06-03 00:00:00.000000000 Z
11
+ date: 2014-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json