wordnik 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -22
- data/Gemfile +4 -0
- data/Gemfile.lock +51 -0
- data/README.md +82 -0
- data/Rakefile +23 -47
- data/api_docs/account.json +1 -0
- data/api_docs/corpus.json +1 -0
- data/api_docs/document.json +1 -0
- data/api_docs/partners.json +1 -0
- data/api_docs/system.json +1 -0
- data/api_docs/tag.json +1 -0
- data/api_docs/user.json +1 -0
- data/api_docs/users.json +1 -0
- data/api_docs/word.json +1 -0
- data/api_docs/wordList.json +1 -0
- data/api_docs/wordLists.json +1 -0
- data/api_docs/wordoftheday.json +1 -0
- data/api_docs/words.json +1 -0
- data/lib/wordnik.rb +57 -84
- data/lib/wordnik/configuration.rb +24 -0
- data/lib/wordnik/endpoint.rb +33 -0
- data/lib/wordnik/monkey_patches.rb +26 -0
- data/lib/wordnik/operation.rb +45 -0
- data/lib/wordnik/operation_parameter.rb +39 -0
- data/lib/wordnik/request.rb +168 -0
- data/lib/wordnik/resource.rb +101 -0
- data/lib/wordnik/response.rb +74 -0
- data/lib/wordnik/version.rb +3 -0
- data/spec/endpoint_spec.rb +26 -0
- data/spec/operation_parameter_spec.rb +26 -0
- data/spec/operation_spec.rb +37 -0
- data/spec/request_spec.rb +157 -0
- data/spec/resource_spec.rb +31 -0
- data/spec/response_spec.rb +49 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/wordnik_spec.rb +76 -0
- data/wordnik.gemspec +25 -51
- metadata +146 -43
- data/.document +0 -5
- data/CHANGELOG +0 -8
- data/LICENSE +0 -12
- data/README.rdoc +0 -23
- data/VERSION +0 -1
- data/test/helper.rb +0 -10
- data/test/test_wordnik.rb +0 -89
data/wordnik.gemspec
CHANGED
@@ -1,58 +1,32 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "wordnik/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name
|
8
|
-
s.version
|
6
|
+
s.name = "wordnik"
|
7
|
+
s.version = Wordnik::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Zeke Sikelianos", "John McGrath"]
|
10
|
+
s.email = ["zeke@wordnik.com", "john@wordnik.com"]
|
11
|
+
s.homepage = "http://developer.wordnik.com"
|
12
|
+
s.summary = %q{A ruby wrapper for the Wordnik API}
|
13
|
+
s.description = %q{This gem provides a simple interface to the entire Wordnik API. Its methods are defined by the documentation that comes from the API itself, so it's guaranteed to be up to date.}
|
9
14
|
|
10
|
-
s.
|
11
|
-
s.authors = ["Jason Adams"]
|
12
|
-
s.date = %q{2010-03-12}
|
13
|
-
s.description = %q{Ruby interface to the Wordnik API. Details at http://docs.wordnik.com/api/methods.}
|
14
|
-
s.email = %q{jasonmadams@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"CHANGELOG",
|
23
|
-
"LICENSE",
|
24
|
-
"README.rdoc",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"lib/wordnik.rb",
|
28
|
-
"test/helper.rb",
|
29
|
-
"test/test_wordnik.rb",
|
30
|
-
"wordnik.gemspec"
|
31
|
-
]
|
32
|
-
s.homepage = %q{http://github.com/ealdent/wordnik}
|
33
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
-
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.3.6}
|
36
|
-
s.summary = %q{Ruby interface to the Wordnik API}
|
37
|
-
s.test_files = [
|
38
|
-
"test/helper.rb",
|
39
|
-
"test/test_wordnik.rb"
|
40
|
-
]
|
15
|
+
s.rubyforge_project = "wordnik"
|
41
16
|
|
42
|
-
|
43
|
-
|
44
|
-
|
17
|
+
s.add_dependency 'typhoeus', '>=0.2.1'
|
18
|
+
s.add_dependency 'htmlentities', '>=4.2.4'
|
19
|
+
s.add_dependency 'addressable', '>=2.2.4'
|
20
|
+
s.add_dependency 'nokogiri', '>=1.4.4'
|
21
|
+
s.add_dependency 'activemodel', '>=3.0.3'
|
22
|
+
s.add_dependency 'json', '>=1.4.6'
|
45
23
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
else
|
50
|
-
s.add_dependency(%q<httparty>, [">= 0.4.5"])
|
51
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
52
|
-
end
|
53
|
-
else
|
54
|
-
s.add_dependency(%q<httparty>, [">= 0.4.5"])
|
55
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
56
|
-
end
|
57
|
-
end
|
24
|
+
s.add_development_dependency 'rspec', '>=2.4.0'
|
25
|
+
s.add_development_dependency 'vcr', '>=1.5.1'
|
26
|
+
s.add_development_dependency 'webmock', '>=1.6.2'
|
58
27
|
|
28
|
+
s.files = `git ls-files`.split("\n")
|
29
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
30
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
31
|
+
s.require_paths = ["lib"]
|
32
|
+
end
|
metadata
CHANGED
@@ -1,99 +1,202 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wordnik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 2
|
8
|
-
- 1
|
9
|
-
version: 0.2.1
|
4
|
+
prerelease:
|
5
|
+
version: 0.3.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
|
-
-
|
8
|
+
- Zeke Sikelianos
|
9
|
+
- John McGrath
|
13
10
|
autorequire:
|
14
11
|
bindir: bin
|
15
12
|
cert_chain: []
|
16
13
|
|
17
|
-
date:
|
14
|
+
date: 2011-03-04 00:00:00 -08:00
|
18
15
|
default_executable:
|
19
16
|
dependencies:
|
20
17
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
18
|
+
name: typhoeus
|
22
19
|
prerelease: false
|
23
20
|
requirement: &id001 !ruby/object:Gem::Requirement
|
21
|
+
none: false
|
24
22
|
requirements:
|
25
23
|
- - ">="
|
26
24
|
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 0
|
29
|
-
- 4
|
30
|
-
- 5
|
31
|
-
version: 0.4.5
|
25
|
+
version: 0.2.1
|
32
26
|
type: :runtime
|
33
27
|
version_requirements: *id001
|
34
28
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
29
|
+
name: htmlentities
|
36
30
|
prerelease: false
|
37
31
|
requirement: &id002 !ruby/object:Gem::Requirement
|
32
|
+
none: false
|
38
33
|
requirements:
|
39
34
|
- - ">="
|
40
35
|
- !ruby/object:Gem::Version
|
41
|
-
|
42
|
-
|
43
|
-
version: "0"
|
44
|
-
type: :development
|
36
|
+
version: 4.2.4
|
37
|
+
type: :runtime
|
45
38
|
version_requirements: *id002
|
46
|
-
|
47
|
-
|
39
|
+
- !ruby/object:Gem::Dependency
|
40
|
+
name: addressable
|
41
|
+
prerelease: false
|
42
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 2.2.4
|
48
|
+
type: :runtime
|
49
|
+
version_requirements: *id003
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: nokogiri
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: 1.4.4
|
59
|
+
type: :runtime
|
60
|
+
version_requirements: *id004
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: activemodel
|
63
|
+
prerelease: false
|
64
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 3.0.3
|
70
|
+
type: :runtime
|
71
|
+
version_requirements: *id005
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: json
|
74
|
+
prerelease: false
|
75
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
76
|
+
none: false
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 1.4.6
|
81
|
+
type: :runtime
|
82
|
+
version_requirements: *id006
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
prerelease: false
|
86
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 2.4.0
|
92
|
+
type: :development
|
93
|
+
version_requirements: *id007
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: vcr
|
96
|
+
prerelease: false
|
97
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.5.1
|
103
|
+
type: :development
|
104
|
+
version_requirements: *id008
|
105
|
+
- !ruby/object:Gem::Dependency
|
106
|
+
name: webmock
|
107
|
+
prerelease: false
|
108
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
109
|
+
none: false
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 1.6.2
|
114
|
+
type: :development
|
115
|
+
version_requirements: *id009
|
116
|
+
description: This gem provides a simple interface to the entire Wordnik API. Its methods are defined by the documentation that comes from the API itself, so it's guaranteed to be up to date.
|
117
|
+
email:
|
118
|
+
- zeke@wordnik.com
|
119
|
+
- john@wordnik.com
|
48
120
|
executables: []
|
49
121
|
|
50
122
|
extensions: []
|
51
123
|
|
52
|
-
extra_rdoc_files:
|
53
|
-
|
54
|
-
- README.rdoc
|
124
|
+
extra_rdoc_files: []
|
125
|
+
|
55
126
|
files:
|
56
|
-
- .document
|
57
127
|
- .gitignore
|
58
|
-
-
|
59
|
-
-
|
60
|
-
- README.
|
128
|
+
- Gemfile
|
129
|
+
- Gemfile.lock
|
130
|
+
- README.md
|
61
131
|
- Rakefile
|
62
|
-
-
|
132
|
+
- api_docs/account.json
|
133
|
+
- api_docs/corpus.json
|
134
|
+
- api_docs/document.json
|
135
|
+
- api_docs/partners.json
|
136
|
+
- api_docs/system.json
|
137
|
+
- api_docs/tag.json
|
138
|
+
- api_docs/user.json
|
139
|
+
- api_docs/users.json
|
140
|
+
- api_docs/word.json
|
141
|
+
- api_docs/wordList.json
|
142
|
+
- api_docs/wordLists.json
|
143
|
+
- api_docs/wordoftheday.json
|
144
|
+
- api_docs/words.json
|
63
145
|
- lib/wordnik.rb
|
64
|
-
-
|
65
|
-
-
|
146
|
+
- lib/wordnik/configuration.rb
|
147
|
+
- lib/wordnik/endpoint.rb
|
148
|
+
- lib/wordnik/monkey_patches.rb
|
149
|
+
- lib/wordnik/operation.rb
|
150
|
+
- lib/wordnik/operation_parameter.rb
|
151
|
+
- lib/wordnik/request.rb
|
152
|
+
- lib/wordnik/resource.rb
|
153
|
+
- lib/wordnik/response.rb
|
154
|
+
- lib/wordnik/version.rb
|
155
|
+
- spec/endpoint_spec.rb
|
156
|
+
- spec/operation_parameter_spec.rb
|
157
|
+
- spec/operation_spec.rb
|
158
|
+
- spec/request_spec.rb
|
159
|
+
- spec/resource_spec.rb
|
160
|
+
- spec/response_spec.rb
|
161
|
+
- spec/spec.opts
|
162
|
+
- spec/spec_helper.rb
|
163
|
+
- spec/wordnik_spec.rb
|
66
164
|
- wordnik.gemspec
|
67
165
|
has_rdoc: true
|
68
|
-
homepage: http://
|
166
|
+
homepage: http://developer.wordnik.com
|
69
167
|
licenses: []
|
70
168
|
|
71
169
|
post_install_message:
|
72
|
-
rdoc_options:
|
73
|
-
|
170
|
+
rdoc_options: []
|
171
|
+
|
74
172
|
require_paths:
|
75
173
|
- lib
|
76
174
|
required_ruby_version: !ruby/object:Gem::Requirement
|
175
|
+
none: false
|
77
176
|
requirements:
|
78
177
|
- - ">="
|
79
178
|
- !ruby/object:Gem::Version
|
80
|
-
segments:
|
81
|
-
- 0
|
82
179
|
version: "0"
|
83
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
181
|
+
none: false
|
84
182
|
requirements:
|
85
183
|
- - ">="
|
86
184
|
- !ruby/object:Gem::Version
|
87
|
-
segments:
|
88
|
-
- 0
|
89
185
|
version: "0"
|
90
186
|
requirements: []
|
91
187
|
|
92
|
-
rubyforge_project:
|
93
|
-
rubygems_version: 1.
|
188
|
+
rubyforge_project: wordnik
|
189
|
+
rubygems_version: 1.5.2
|
94
190
|
signing_key:
|
95
191
|
specification_version: 3
|
96
|
-
summary:
|
192
|
+
summary: A ruby wrapper for the Wordnik API
|
97
193
|
test_files:
|
98
|
-
-
|
99
|
-
-
|
194
|
+
- spec/endpoint_spec.rb
|
195
|
+
- spec/operation_parameter_spec.rb
|
196
|
+
- spec/operation_spec.rb
|
197
|
+
- spec/request_spec.rb
|
198
|
+
- spec/resource_spec.rb
|
199
|
+
- spec/response_spec.rb
|
200
|
+
- spec/spec.opts
|
201
|
+
- spec/spec_helper.rb
|
202
|
+
- spec/wordnik_spec.rb
|
data/.document
DELETED
data/CHANGELOG
DELETED
data/LICENSE
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
Copyright (c) 2009, Jason M. Adams
|
2
|
-
All rights reserved.
|
3
|
-
|
4
|
-
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
5
|
-
|
6
|
-
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7
|
-
|
8
|
-
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
9
|
-
|
10
|
-
- Neither the name of Jason M. Adams nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
11
|
-
|
12
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.rdoc
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
= Wordnik
|
2
|
-
|
3
|
-
Wordnik wants to be a place for all the words, and everything known about them. They have provided a RESTful API accessible after applying for a key. Visit http://docs.wordnik.com/api for more information and to apply for a key.
|
4
|
-
|
5
|
-
== Installation
|
6
|
-
|
7
|
-
Install gem via gemcutter.
|
8
|
-
|
9
|
-
gem install wordnik
|
10
|
-
|
11
|
-
== Note on Patches/Pull Requests
|
12
|
-
|
13
|
-
* Fork the project.
|
14
|
-
* Make your feature addition or bug fix.
|
15
|
-
* Add tests for it. This is important so I don't break it in a
|
16
|
-
future version unintentionally.
|
17
|
-
* Commit, do not mess with rakefile, version, or history.
|
18
|
-
If you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull
|
19
|
-
* Send me a pull request. Bonus points for topic branches.
|
20
|
-
|
21
|
-
== Copyright
|
22
|
-
|
23
|
-
Copyright (c) 2009 Jason Adams under the BSD license. See LICENSE for details.
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.2.1
|
data/test/helper.rb
DELETED
data/test/test_wordnik.rb
DELETED
@@ -1,89 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
# In order to run any tests, you must copy your API key into a file in the
|
4
|
-
# same directory that you run your tests from, or else set the environment
|
5
|
-
# variable WORDNIK_API_KEY to the api key you wish to use.
|
6
|
-
class TestWordnik < Test::Unit::TestCase
|
7
|
-
context "initializing a Wordnik object" do
|
8
|
-
should "instantiate given an API key" do
|
9
|
-
assert_equal Wordnik.new('TESTTESTETESTTESTSETESTTESTTETST').nil?, false
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
context "a single Wordnik instance" do
|
14
|
-
setup do
|
15
|
-
@api_key = (File.exists?('.api-key') ? File.read('.api-key') : ENV['WORDNIK_API_KEY']).strip
|
16
|
-
raise "No API key available." unless @api_key
|
17
|
-
|
18
|
-
@wordnik = Wordnik.new(@api_key)
|
19
|
-
@test_word = 'test'
|
20
|
-
@test_word_fragment = 'invas'
|
21
|
-
end
|
22
|
-
|
23
|
-
should "make its api-key accessible" do
|
24
|
-
assert_equal @wordnik.api_key, @api_key
|
25
|
-
end
|
26
|
-
|
27
|
-
should "lookup the id for a word" do
|
28
|
-
word = @wordnik.lookup(@test_word)
|
29
|
-
|
30
|
-
assert_equal word.is_a?(Hash), true
|
31
|
-
assert_equal word.empty?, false
|
32
|
-
assert_equal word.member?('id'), true
|
33
|
-
assert_equal word['id'].to_i > 0, true
|
34
|
-
end
|
35
|
-
|
36
|
-
should "lookup definitions for a word" do
|
37
|
-
definitions = @wordnik.define(@test_word)
|
38
|
-
|
39
|
-
assert_equal definitions.is_a?(Array), true
|
40
|
-
assert_equal definitions.empty?, false
|
41
|
-
assert_equal definitions.first.is_a?(Hash), true
|
42
|
-
assert_equal definitions.first.member?('id'), true
|
43
|
-
end
|
44
|
-
|
45
|
-
should "find frequency counts for a word" do
|
46
|
-
frequency = @wordnik.frequency(@test_word)
|
47
|
-
|
48
|
-
assert_equal frequency.is_a?(Hash), true
|
49
|
-
assert_equal frequency.member?('frequency'), true
|
50
|
-
end
|
51
|
-
|
52
|
-
should "find examples for a word" do
|
53
|
-
examples = @wordnik.examples(@test_word)
|
54
|
-
|
55
|
-
assert_equal examples.is_a?(Array), true
|
56
|
-
assert_equal examples.empty?, false
|
57
|
-
end
|
58
|
-
|
59
|
-
should "autocomplete a word fragment" do
|
60
|
-
suggestions = @wordnik.autocomplete(@test_word_fragment)
|
61
|
-
|
62
|
-
assert_equal suggestions.is_a?(Hash), true
|
63
|
-
assert_equal suggestions['match'].is_a?(Array), true
|
64
|
-
assert_equal suggestions['match'].empty?, false
|
65
|
-
end
|
66
|
-
|
67
|
-
should "get the word of the day" do
|
68
|
-
word = @wordnik.word_of_the_day
|
69
|
-
|
70
|
-
assert_equal word.is_a?(Hash), true
|
71
|
-
assert_equal word.member?('wordstring'), true
|
72
|
-
end
|
73
|
-
|
74
|
-
should "get a random word" do
|
75
|
-
word = @wordnik.random
|
76
|
-
|
77
|
-
assert_equal word.is_a?(Hash), true
|
78
|
-
assert_equal word.member?('wordstring'), true
|
79
|
-
end
|
80
|
-
|
81
|
-
should "get punctuation info for a word" do
|
82
|
-
punctuation = @wordnik.punctuation(@test_word)
|
83
|
-
|
84
|
-
assert_equal punctuation.is_a?(Hash), true
|
85
|
-
assert_equal punctuation.key?('wordId'), true
|
86
|
-
assert_equal punctuation.key?('periodCount'), true
|
87
|
-
end
|
88
|
-
end
|
89
|
-
end
|