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 +4 -4
- data/CHANGELOG +3 -0
- data/README.md +7 -3
- data/lib/wit_ruby/rest/session.rb +6 -1
- data/lib/wit_ruby/version.rb +1 -1
- data/spec/wit_ruby/rest/session_spec.rb +14 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35527605a33f51d07c685e9973074d80adc2a342
|
4
|
+
data.tar.gz: 5f98a7b4f5549d06e5380fcc2a55d22496d9f1b3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c8663cf2937717cd9179db12645e7848d44649bc8f93c3d1725e4fcb25ff6ffd048e88c3427a194dd7ebfdb88179d93be76598d82fea6f092bf9e80b8ca008c
|
7
|
+
data.tar.gz: a2f6aad050b9e0dd33ec0a86813ed8eae1d7037057fb2147244755116bd84641f9605f9530eff92fc034a2fac5c253b7ceea06ef27d7e336c6f12ec419f52acf
|
data/CHANGELOG
CHANGED
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
|
-
|
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.
|
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.
|
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
|
202
|
+
## Raised when the given paremeters do not fit the required schema.
|
198
203
|
##
|
199
204
|
class NotCorrectSchema < Exception; end
|
200
205
|
|
data/lib/wit_ruby/version.rb
CHANGED
@@ -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.
|
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-
|
11
|
+
date: 2014-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: multi_json
|