wordnik 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/wordnik.rb +5 -4
- data/wordnik.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
data/lib/wordnik.rb
CHANGED
@@ -3,6 +3,9 @@ require 'httparty'
|
|
3
3
|
class Wordnik
|
4
4
|
include HTTParty
|
5
5
|
|
6
|
+
PARTS_OF_SPEECH = [:noun, :verb, :adjective, :adverb, :idiom, :article, :abbreviation,
|
7
|
+
:preposition, :prefix, :interjection, :suffix, :"verb-transitive", :"verb-intransitive"]
|
8
|
+
|
6
9
|
attr_reader :api_key
|
7
10
|
|
8
11
|
base_uri 'http://api.wordnik.com/api'
|
@@ -79,11 +82,9 @@ class Wordnik
|
|
79
82
|
options[:hasDictionaryDef] = !!opts[:hasDictionaryDef] if opts.key?(:hasDictionaryDef)
|
80
83
|
|
81
84
|
if opts.key?(:partOfSpeech)
|
82
|
-
options[:partOfSpeech] = opts[:partOfSpeech].reject
|
83
|
-
![:noun, :verb, :adjective, :adverb, :idiom, :article, :abbreviation, :preposition, :prefix, :interjection, :suffix].include?(pos.to_sym)
|
84
|
-
end
|
85
|
+
options[:partOfSpeech] = opts[:partOfSpeech].to_a.reject { |pos| !PARTS_OF_SPEECH.include?(pos.to_sym) }.join(',')
|
85
86
|
end
|
86
87
|
|
87
|
-
options
|
88
|
+
{ :query => options }
|
88
89
|
end
|
89
90
|
end
|
data/wordnik.gemspec
CHANGED