wordnik 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -2
- data/README.md +16 -1
- data/Rakefile +37 -0
- data/USAGE.md +176 -0
- data/api_docs/account.json +1 -1
- data/api_docs/word.json +1 -1
- data/api_docs/wordList.json +1 -1
- data/api_docs/wordLists.json +1 -1
- data/api_docs/words.json +1 -1
- data/lib/wordnik.rb +1 -1
- data/lib/wordnik/endpoint.rb +5 -3
- data/lib/wordnik/operation.rb +45 -4
- data/lib/wordnik/operation_parameter.rb +12 -1
- data/lib/wordnik/resource.rb +30 -18
- data/lib/wordnik/version.rb +1 -1
- data/spec/endpoint_spec.rb +2 -2
- data/spec/operation_spec.rb +3 -2
- data/spec/wordnik_spec.rb +2 -0
- metadata +3 -2
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
wordnik (0.
|
4
|
+
wordnik (0.4.1)
|
5
5
|
activemodel (>= 3.0.3)
|
6
6
|
addressable (>= 2.2.4)
|
7
7
|
htmlentities (>= 4.2.4)
|
@@ -34,7 +34,8 @@ GEM
|
|
34
34
|
rspec-expectations (2.4.0)
|
35
35
|
diff-lcs (~> 1.1.2)
|
36
36
|
rspec-mocks (2.4.0)
|
37
|
-
typhoeus (0.2.
|
37
|
+
typhoeus (0.2.4)
|
38
|
+
mime-types
|
38
39
|
mime-types
|
39
40
|
vcr (1.5.1)
|
40
41
|
webmock (1.6.2)
|
data/README.md
CHANGED
@@ -6,7 +6,7 @@ This is the official Wordnik rubygem. It fully wraps Wordnik's v4 API. Refer to
|
|
6
6
|
in the live API sandbox. All the methods you see there are implemented in this
|
7
7
|
ruby gem.
|
8
8
|
|
9
|
-
Installation
|
9
|
+
Installation
|
10
10
|
------------
|
11
11
|
|
12
12
|
### Rails 3.x
|
@@ -56,6 +56,20 @@ Put this somewhere in your app's initialization process:
|
|
56
56
|
config.api_key = '12345abcde'
|
57
57
|
config.response_format = :json # defaults to json, but xml is also supported
|
58
58
|
end
|
59
|
+
|
60
|
+
|
61
|
+
Usage
|
62
|
+
-----
|
63
|
+
|
64
|
+
# The simple version..
|
65
|
+
examples = Wordnik.word.get_examples('monkey', :limit => 50, :part_of_speech => 'verb')
|
66
|
+
examples = Wordnik.word.get_examples('monkey', :limit => 50, :part_of_speech => 'verb')
|
67
|
+
|
68
|
+
# ..and its low-level equivalent
|
69
|
+
request = Wordnik::Request.new(:get, '/word/{word}/examples', :params => {:word => 'monkey', :limit => 50, :part_of_speech => 'verb'})
|
70
|
+
examples = request.response.body
|
71
|
+
|
72
|
+
For a full list of convenience methods, checkout [USAGE.md](https://github.com/wordnik/wordnik-ruby/blob/master/USAGE.md). The wordnik gem automatically generates its convenience methods by parsing the [Wordnik API documentation](http://developer.wordnik.com/docs).
|
59
73
|
|
60
74
|
Specs
|
61
75
|
-----
|
@@ -79,6 +93,7 @@ Wishlist
|
|
79
93
|
--------
|
80
94
|
|
81
95
|
* Allow boolean params to really party like booleans (instead of 'true')
|
96
|
+
* Remove the now-antiquated method_missing approach
|
82
97
|
|
83
98
|
Props
|
84
99
|
-----
|
data/Rakefile
CHANGED
@@ -27,4 +27,41 @@ task :fetch_api_docs do
|
|
27
27
|
puts filename
|
28
28
|
end
|
29
29
|
|
30
|
+
end
|
31
|
+
|
32
|
+
desc 'Iterate over resource>endpoint>operation nicknames, generating markdown documentation.'
|
33
|
+
task :generate_usage_docs do
|
34
|
+
Wordnik.configure
|
35
|
+
filename = "USAGE.md"
|
36
|
+
file = File.new(filename, "w")
|
37
|
+
|
38
|
+
Wordnik.resources.each_pair do |resource_name, resource|
|
39
|
+
|
40
|
+
next unless resource.endpoints.present?
|
41
|
+
file.write "\n#{resource_name}\n#{"=" * resource_name.size}\n\n"
|
42
|
+
|
43
|
+
resource.endpoints.each do |endpoint|
|
44
|
+
endpoint.operations.each do |operation|
|
45
|
+
|
46
|
+
docs_url = "http://developer.wordnik.com/docs/#!/#{resource.name}/#{operation.nickname}"
|
47
|
+
|
48
|
+
# Method name
|
49
|
+
file.write "[Wordnik.#{resource_name}.#{operation.nickname}(#{operation.positional_parameter_names.join(', ')})](#{docs_url})\n"
|
50
|
+
|
51
|
+
# Required kwargs
|
52
|
+
operation.required_kwargs.each do |parameter|
|
53
|
+
file.write " :#{parameter.name}* #{' ' * (29-parameter.name.size)} #{parameter.description}\n"
|
54
|
+
end
|
55
|
+
|
56
|
+
# Optional kwargs
|
57
|
+
operation.optional_kwargs.each do |parameter|
|
58
|
+
file.write " :#{parameter.name} #{' ' * (30-parameter.name.size)} #{parameter.description}\n"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
file.write "\n"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
file.close
|
30
67
|
end
|
data/USAGE.md
ADDED
@@ -0,0 +1,176 @@
|
|
1
|
+
|
2
|
+
account
|
3
|
+
=======
|
4
|
+
|
5
|
+
[Wordnik.account.get_authenticate(username)](http://developer.wordnik.com/docs/#!/account/get_authenticate)
|
6
|
+
:password* The user's password
|
7
|
+
|
8
|
+
[Wordnik.account.get_api_token_status()](http://developer.wordnik.com/docs/#!/account/get_api_token_status)
|
9
|
+
:api_key* Wordnik authentication token
|
10
|
+
|
11
|
+
[Wordnik.account.post_authenticate(username)](http://developer.wordnik.com/docs/#!/account/post_authenticate)
|
12
|
+
:body* The user's password
|
13
|
+
|
14
|
+
[Wordnik.account.get_user()](http://developer.wordnik.com/docs/#!/account/get_user)
|
15
|
+
:api_key* API Key
|
16
|
+
:auth_token* The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)
|
17
|
+
|
18
|
+
[Wordnik.account.get_word_lists()](http://developer.wordnik.com/docs/#!/account/get_word_lists)
|
19
|
+
:api_key* API Key
|
20
|
+
:auth_token* auth_token of logged-in user
|
21
|
+
:skip Results to skip
|
22
|
+
:limit Maximum number of results to return
|
23
|
+
|
24
|
+
|
25
|
+
word
|
26
|
+
====
|
27
|
+
|
28
|
+
[Wordnik.word.get(word)](http://developer.wordnik.com/docs/#!/word/get)
|
29
|
+
:use_canonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
30
|
+
:include_suggestions Return suggestions (for correct spelling, case variants, etc.)
|
31
|
+
|
32
|
+
[Wordnik.word.get_examples(word)](http://developer.wordnik.com/docs/#!/word/get_examples)
|
33
|
+
:limit Maximum number of results to return
|
34
|
+
:include_duplicates Show duplicate examples from different sources
|
35
|
+
:content_provider Return results from a specific ContentProvider
|
36
|
+
:use_canonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
37
|
+
:skip Results to skip
|
38
|
+
:limit Maximum number of results to return
|
39
|
+
|
40
|
+
[Wordnik.word.get_definitions(word)](http://developer.wordnik.com/docs/#!/word/get_definitions)
|
41
|
+
:limit Maximum number of results to return
|
42
|
+
:part_of_speech CSV list of part-of-speech types
|
43
|
+
:include_related Return related words with definitions
|
44
|
+
:source_dictionaries Gets from dictionaries in the supplied order of precedence
|
45
|
+
:use_canonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
46
|
+
:include_tags Return a closed set of XML tags in response
|
47
|
+
|
48
|
+
[Wordnik.word.get_frequency(word)](http://developer.wordnik.com/docs/#!/word/get_frequency)
|
49
|
+
:use_canonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
50
|
+
:start_year Starting Year
|
51
|
+
:end_year Ending Year
|
52
|
+
|
53
|
+
[Wordnik.word.get_top_example(word)](http://developer.wordnik.com/docs/#!/word/get_top_example)
|
54
|
+
:content_provider Return results from a specific ContentProvider
|
55
|
+
:use_canonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
56
|
+
|
57
|
+
[Wordnik.word.get_related(word)](http://developer.wordnik.com/docs/#!/word/get_related)
|
58
|
+
:part_of_speech CSV list of part-of-speech types
|
59
|
+
:source_dictionary Get data from a single dictionary. Valid options are ahd, century, wiktionary, webster, and wordnet.
|
60
|
+
:limit Maximum number of results to return
|
61
|
+
:use_canonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
62
|
+
:type Relationship type
|
63
|
+
|
64
|
+
[Wordnik.word.get_phrases(word)](http://developer.wordnik.com/docs/#!/word/get_phrases)
|
65
|
+
:limit Maximum number of results to return
|
66
|
+
:wlmi Minimum WLMI for the phrase
|
67
|
+
:use_canonical If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
68
|
+
|
69
|
+
[Wordnik.word.get_hyphenation(word)](http://developer.wordnik.com/docs/#!/word/get_hyphenation)
|
70
|
+
:use_canonical If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
71
|
+
:source_dictionary Get from a single dictionary. Valid options: ahd, century, wiktionary, webster, and wordnet.
|
72
|
+
:limit Maximum number of results to return
|
73
|
+
|
74
|
+
[Wordnik.word.get_pronunciations(word)](http://developer.wordnik.com/docs/#!/word/get_pronunciations)
|
75
|
+
:use_canonical If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.
|
76
|
+
:source_dictionary Get from a single dictionary.
|
77
|
+
:type_format Text pronunciation type
|
78
|
+
:limit Maximum number of results to return
|
79
|
+
|
80
|
+
[Wordnik.word.get_audio(word)](http://developer.wordnik.com/docs/#!/word/get_audio)
|
81
|
+
:use_canonical Use the canonical form of the word.
|
82
|
+
:limit Maximum number of results to return
|
83
|
+
|
84
|
+
|
85
|
+
words
|
86
|
+
=====
|
87
|
+
|
88
|
+
[Wordnik.words.get_random_word()](http://developer.wordnik.com/docs/#!/words/get_random_word)
|
89
|
+
:has_dictionary_def Only return words with dictionary definitions
|
90
|
+
:include_part_of_speech CSV part-of-speech values to include
|
91
|
+
:exclude_part_of_speech CSV part-of-speech values to exclude
|
92
|
+
:min_corpus_count Minimum corpus frequency for terms
|
93
|
+
:max_corpus_count Maximum corpus frequency for terms
|
94
|
+
:min_dictionary_count Minimum dictionary count
|
95
|
+
:max_dictionary_count Maximum dictionary count
|
96
|
+
:min_length Minimum word length
|
97
|
+
:max_length Maximum word length
|
98
|
+
|
99
|
+
[Wordnik.words.get_random()](http://developer.wordnik.com/docs/#!/words/get_random)
|
100
|
+
:has_dictionary_def Only return words with dictionary definitions
|
101
|
+
:include_part_of_speech CSV part-of-speech values to include
|
102
|
+
:exclude_part_of_speech CSV part-of-speech values to exclude
|
103
|
+
:min_corpus_count Minimum corpus frequency for terms (integer)
|
104
|
+
:max_corpus_count Maximum corpus frequency for terms (integer)
|
105
|
+
:min_dictionary_count Minimum dictionary count (integer)
|
106
|
+
:max_dictionary_count Maximum dictionary count (integer)
|
107
|
+
:min_length Minimum word length (characters)
|
108
|
+
:max_length Maximum word length (characters)
|
109
|
+
:sort_by Attribute to sort by
|
110
|
+
:sort_order Sort direction
|
111
|
+
:limit Maximum number of results to return (integer)
|
112
|
+
|
113
|
+
[Wordnik.words.get_search()](http://developer.wordnik.com/docs/#!/words/get_search)
|
114
|
+
:query* Search term
|
115
|
+
:case_sensitive Search case sensitive
|
116
|
+
:include_part_of_speech Only include these comma-delimited parts of speech
|
117
|
+
:exclude_part_of_speech Exclude these comma-delimited parts of speech
|
118
|
+
:min_corpus_count Minimum corpus frequency for terms
|
119
|
+
:max_corpus_count Maximum corpus frequency for terms
|
120
|
+
:min_dictionary_count Minimum number of dictionary entries
|
121
|
+
:max_dictionary_count Maximum dictionary count
|
122
|
+
:min_length Minimum word length
|
123
|
+
:max_length Maximum word length
|
124
|
+
:skip Results to skip
|
125
|
+
:limit Maximum number of results to return
|
126
|
+
|
127
|
+
[Wordnik.words.get_word_of_the_day()](http://developer.wordnik.com/docs/#!/words/get_word_of_the_day)
|
128
|
+
:date Fetches by date in yyyy-MM-dd
|
129
|
+
:category Filters response by category
|
130
|
+
:creator Filters response by username
|
131
|
+
|
132
|
+
[Wordnik.words.get_search(query)](http://developer.wordnik.com/docs/#!/words/get_search)
|
133
|
+
:case_sensitive Search case sensitive
|
134
|
+
:include_part_of_speech Only include these comma-delimited parts of speech
|
135
|
+
:exclude_part_of_speech Exclude these comma-delimited parts of speech
|
136
|
+
:min_corpus_count Minimum corpus frequency for terms
|
137
|
+
:max_corpus_count Maximum corpus frequency for terms
|
138
|
+
:min_dictionary_count Minimum number of dictionary entries
|
139
|
+
:max_dictionary_count Maximum dictionary count
|
140
|
+
:min_length Minimum word length
|
141
|
+
:max_length Maximum word length
|
142
|
+
:skip Results to skip
|
143
|
+
:limit Maximum number of results to return
|
144
|
+
|
145
|
+
|
146
|
+
word_list
|
147
|
+
=========
|
148
|
+
|
149
|
+
[Wordnik.word_list.get(word_list_id)](http://developer.wordnik.com/docs/#!/word_list/get)
|
150
|
+
|
151
|
+
[Wordnik.word_list.post_delete_words(word_list_id)](http://developer.wordnik.com/docs/#!/word_list/post_delete_words)
|
152
|
+
:body Words to remove from WordList
|
153
|
+
|
154
|
+
[Wordnik.word_list.get_words(word_list_id)](http://developer.wordnik.com/docs/#!/word_list/get_words)
|
155
|
+
:sort_by Field to sort by
|
156
|
+
:sort_order Direction to sort
|
157
|
+
:skip Results to skip
|
158
|
+
:limit Maximum number of results to return
|
159
|
+
|
160
|
+
[Wordnik.word_list.post_words(word_list_id)](http://developer.wordnik.com/docs/#!/word_list/post_words)
|
161
|
+
:body Words to add to WordList
|
162
|
+
|
163
|
+
[Wordnik.word_list.put(word_list_id)](http://developer.wordnik.com/docs/#!/word_list/put)
|
164
|
+
:body Updated WordList
|
165
|
+
|
166
|
+
[Wordnik.word_list.delete(word_list_id)](http://developer.wordnik.com/docs/#!/word_list/delete)
|
167
|
+
|
168
|
+
|
169
|
+
word_lists
|
170
|
+
==========
|
171
|
+
|
172
|
+
[Wordnik.word_lists.post()](http://developer.wordnik.com/docs/#!/word_lists/post)
|
173
|
+
:body WordList to create
|
174
|
+
|
175
|
+
[Wordnik.word_lists.get()](http://developer.wordnik.com/docs/#!/word_lists/get)
|
176
|
+
|
data/api_docs/account.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"endPoints":[{"path":"/account.{format}/authenticate/{username}","description":"","operations":[{"parameters":[{"name":"username","description":"A confirmed Wordnik username","required":true,"paramType":"path"},{"name":"password","description":"The user's password","required":true,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"AuthenticationToken","errorResponses":[{"reason":"Account not available.","code":403},{"reason":"User not found.","code":404}],"
|
1
|
+
{"endPoints":[{"path":"/account.{format}/authenticate/{username}","description":"","operations":[{"parameters":[{"name":"username","description":"A confirmed Wordnik username","required":true,"paramType":"path"},{"name":"password","description":"The user's password","required":true,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"AuthenticationToken","errorResponses":[{"reason":"Account not available.","code":403},{"reason":"User not found.","code":404}],"condition":"any"}],"summary":"Authenticates a User","open":false,"httpMethod":"GET"}]},{"path":"/account.{format}/apiTokenStatus","description":"","operations":[{"parameters":[{"name":"api_key","description":"Wordnik authentication token","required":true,"paramType":"header"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"ApiTokenStatus","errorResponses":[{"reason":"No token supplied.","code":400},{"reason":"No API account with supplied token.","code":404}],"condition":"any"}],"summary":"Returns usage statistics for the API account.","open":true,"httpMethod":"GET"}]},{"path":"/account.{format}/authenticate/{username}","description":"","operations":[{"parameters":[{"name":"username","description":"A confirmed Wordnik username","required":true,"paramType":"path"},{"description":"The user's password","required":true,"paramType":"body"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"AuthenticationToken","errorResponses":[{"reason":"Account not available.","code":403},{"reason":"User not found.","code":404}],"condition":"any"}],"summary":"Authenticates a user","open":false,"httpMethod":"POST"}]},{"path":"/account.{format}/user","description":"","operations":[{"parameters":[{"name":"api_key","description":"API Key","required":true,"paramType":"header"},{"name":"auth_token","description":"The auth token of the logged-in user, obtained by calling /account.{format}/authenticate/{username} (described above)","required":true,"paramType":"header"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"user","errorResponses":[{"reason":"Not logged in.","code":403},{"reason":"User not found.","code":404}],"condition":"any"}],"summary":"Returns the logged-in User","open":false,"notes":"Requires a valid auth_token to be set.","httpMethod":"GET"}]},{"path":"/account.{format}/wordLists","description":"","operations":[{"parameters":[{"name":"api_key","description":"API Key","required":true,"paramType":"header"},{"name":"auth_token","description":"auth_token of logged-in user","required":true,"paramType":"header"},{"name":"skip","description":"Results to skip","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"List[wordList]","errorResponses":[{"reason":"Not authenticated.","code":403},{"reason":"User account not found.","code":404}],"condition":"any"}],"summary":"Fetches WordList objects for the logged-in user.","open":false,"httpMethod":"GET"}]}],"models":[{"name":"wordList","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"id","required":false,"paramType":"long"},{"name":"type","required":false,"paramType":"WordListType"},{"name":"description","required":false,"paramType":"string"},{"name":"userId","required":false,"paramType":"long"},{"name":"permalink","required":false,"paramType":"string"},{"name":"createdAt","required":false,"paramType":"Date"},{"name":"username","required":false,"paramType":"string"},{"name":"updatedAt","required":false,"paramType":"Date"},{"name":"numberWordsInList","required":false,"paramType":"long"}]},{"name":"ApiTokenStatus","fields":[{"name":"token","required":false,"paramType":"string"},{"name":"expiresInMillis","required":false,"paramType":"long"},{"name":"totalRequests","required":false,"paramType":"long"},{"name":"remainingCalls","required":false,"paramType":"long"},{"name":"resetsInMillis","required":false,"paramType":"long"}]},{"name":"AuthenticationToken","fields":[{"name":"token","required":false,"paramType":"string"},{"name":"userId","required":false,"paramType":"long"}]},{"name":"user","fields":[{"name":"id","description":"Unique idenitifier for a user","required":false,"paramType":"long"},{"name":"displayName","description":"Display name","required":false,"paramType":"string"},{"name":"status","description":"Account status","required":false,"allowableValues":"0,1,2,3","paramType":"int"},{"name":"password","required":false,"paramType":"string"},{"name":"userName","description":"User name","required":false,"paramType":"string"},{"name":"email","description":"Email address","required":false,"paramType":"string"},{"name":"faceBookId","description":"Facebook ID","required":false,"paramType":"string"}]}]}
|
data/api_docs/word.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"endPoints":[{"path":"/word.{format}/{word}","description":"","operations":[{"parameters":[{"name":"word","description":"String value of WordObject to return","required":true,"paramType":"path"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"includeSuggestions","description":"Return suggestions (for correct spelling, case variants, etc.)","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"Word","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"occurs":"1","condition":"any"}],"summary":"Given a word as a string, returns the WordObject that represents it","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/examples","description":"","operations":[{"parameters":[{"name":"word","description":"Word to return examples for","required":true,"paramType":"path"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"includeDuplicates","description":"Show duplicate examples from different sources","required":false,"paramType":"query"},{"name":"contentProvider","description":"Return results from a specific ContentProvider","required":false,"paramType":"query"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"skip","description":"Results to skip","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"ExampleSearchResults","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"occurs":"1","condition":"any"}],"summary":"Returns examples for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/definitions","description":"","operations":[{"parameters":[{"name":"word","description":"Word to return definitions for","required":true,"paramType":"path"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"partOfSpeech","description":"CSV list of part-of-speech types","required":false,"paramType":"query"},{"name":"includeRelated","description":"Return related words with definitions","required":false,"paramType":"query"},{"name":"sourceDictionaries","description":"Gets from dictionaries in the supplied order of precedence","required":false,"allowableValues":"ahd, century, wiktionary, webster, wordnet","paramType":"query"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"includeTags","description":"Return a closed set of XML tags in response","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"Definition[]","errorResponses":[{"reason":"Invalid word supplied.","code":400},{"reason":"No definitions found.","code":404}],"occurs":"1","condition":"any"}],"summary":"Return definitions for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/frequency","description":"","operations":[{"parameters":[{"name":"word","description":"Word to return","required":true,"paramType":"path"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"startYear","description":"Starting Year","required":false,"paramType":"query"},{"name":"endYear","description":"Ending Year","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"FrequencySummary","errorResponses":[{"reason":"Invalid word supplied.","code":400},{"reason":"No results.","code":404}],"occurs":"1","condition":"any"},{"valueType":"FrequencySummaryWithErrorBars","errorResponses":[{"reason":"Invalid word supplied.","code":400},{"reason":"No results.","code":404}],"occurs":"1","condition":"errorBars=true"}],"summary":"Returns word usage over time","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/topExample","description":"","operations":[{"parameters":[{"name":"word","description":"Word to fetch examples for","required":true,"paramType":"path"},{"name":"contentProvider","description":"Return results from a specific ContentProvider","required":false,"paramType":"query"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"Example","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"occurs":"1","condition":"any"}],"summary":"Returns a top example for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/related","description":"","operations":[{"parameters":[{"name":"word","description":"Word for which to return related words","required":true,"paramType":"path"},{"name":"partOfSpeech","description":"CSV list of part-of-speech types","required":false,"paramType":"query"},{"name":"sourceDictionary","description":"Get data from a single dictionary. Valid options are ahd, century, wiktionary, webster, and wordnet.","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"type","description":"Relationship type","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"Related[]","errorResponses":[{"reason":"Invalid word supplied.","code":400},{"reason":"No definitions found.","code":404}],"occurs":"1","condition":"any"}],"summary":"Return related words (thesaurus data) for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/phrases","description":"","operations":[{"parameters":[{"name":"word","description":"Word to fetch phrases for","required":true,"paramType":"path"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"wlmi","description":"Minimum WLMI for the phrase","required":false,"paramType":"query"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"Bigram[]","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"occurs":"1","condition":"any"}],"summary":"Fetches bi-gram phrases for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/hyphenation","description":"","operations":[{"parameters":[{"name":"word","description":"Word to get syllables for","required":true,"paramType":"path"},{"name":"useCanonical","description":"If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"sourceDictionary","description":"Get from a single dictionary. Valid options: ahd, century, wiktionary, webster, and wordnet.","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"Syllable[]","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"occurs":"1","condition":"any"}],"summary":"Returns syllable information for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/pronunciations","description":"","operations":[{"parameters":[{"name":"word","description":"Word to get pronunciations for","required":true,"paramType":"path"},{"name":"useCanonical","description":"If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"sourceDictionary","description":"Get from a single dictionary. Valid options: ahd, century, wiktionary, webster, and wordnet.","required":false,"paramType":"query"},{"name":"typeFormat","description":"Text pronunciation type","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"TextPron[]","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"occurs":"1","condition":"any"}],"summary":"Returns text pronunciations for a given word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/audio","description":"","operations":[{"parameters":[{"name":"word","description":"Word to get audio for.","required":true,"paramType":"path"},{"name":"useCanonical","description":"Use the canonical form of the word.","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"AudioPron[]","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"occurs":"1","condition":"any"}],"summary":"Fetches audio metadata for a word.","open":false,"notes":"The metadata includes a time-expiring fileUrl which allows reading the audio file directly from the API. Currently only audio pronunciations from the American Heritage Dictionary in mp3 format are supported.","httpMethod":"GET"}]}]}
|
1
|
+
{"endPoints":[{"path":"/word.{format}/{word}","description":"","operations":[{"parameters":[{"name":"word","description":"String value of WordObject to return","required":true,"paramType":"path"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"includeSuggestions","description":"Return suggestions (for correct spelling, case variants, etc.)","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"wordObject","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"condition":"any"}],"summary":"Given a word as a string, returns the WordObject that represents it","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/examples","description":"","operations":[{"parameters":[{"name":"word","description":"Word to return examples for","required":true,"paramType":"path"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"includeDuplicates","description":"Show duplicate examples from different sources","required":false,"paramType":"query"},{"name":"contentProvider","description":"Return results from a specific ContentProvider","required":false,"paramType":"query"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"skip","description":"Results to skip","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"exampleSearchResults","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"condition":"any"}],"summary":"Returns examples for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/definitions","description":"","operations":[{"parameters":[{"name":"word","description":"Word to return definitions for","required":true,"paramType":"path"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"partOfSpeech","description":"CSV list of part-of-speech types","required":false,"allowableValues":"synonym,antonym,variant,equivalent,cross-reference,related-word,rhyme,form,etymologically-related-term,hypernym,hyponym,inflected-form,primary,same-context,verb-form,verb-stem,unknown","paramType":"query"},{"name":"includeRelated","description":"Return related words with definitions","required":false,"paramType":"query"},{"name":"sourceDictionaries","description":"Gets from dictionaries in the supplied order of precedence","required":false,"allowableValues":"ahd, century, wiktionary, webster, wordnet","paramType":"query"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"includeTags","description":"Return a closed set of XML tags in response","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"List[definition]","errorResponses":[{"reason":"Invalid word supplied.","code":400},{"reason":"No definitions found.","code":404}],"condition":"any"}],"summary":"Return definitions for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/frequency","description":"","operations":[{"parameters":[{"name":"word","description":"Word to return","required":true,"paramType":"path"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"startYear","description":"Starting Year","required":false,"paramType":"query"},{"name":"endYear","description":"Ending Year","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"frequencySummary","errorResponses":[{"reason":"Invalid word supplied.","code":400},{"reason":"No results.","code":404}],"condition":"any"},{"valueType":"frequencySummaryE","errorResponses":[{"reason":"Invalid word supplied.","code":400},{"reason":"No results.","code":404}],"condition":"errorBars=true"}],"summary":"Returns word usage over time","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/topExample","description":"","operations":[{"parameters":[{"name":"word","description":"Word to fetch examples for","required":true,"paramType":"path"},{"name":"contentProvider","description":"Return results from a specific ContentProvider","required":false,"paramType":"query"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"example","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"condition":"any"}],"summary":"Returns a top example for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/related","description":"","operations":[{"parameters":[{"name":"word","description":"Word for which to return related words","required":true,"paramType":"path"},{"name":"partOfSpeech","description":"CSV list of part-of-speech types","required":false,"paramType":"query"},{"name":"sourceDictionary","description":"Get data from a single dictionary. Valid options are ahd, century, wiktionary, webster, and wordnet.","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"type","description":"Relationship type","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"List[related]","errorResponses":[{"reason":"Invalid word supplied.","code":400},{"reason":"No definitions found.","code":404}],"condition":"any"}],"summary":"Return related words (thesaurus data) for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/phrases","description":"","operations":[{"parameters":[{"name":"word","description":"Word to fetch phrases for","required":true,"paramType":"path"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"wlmi","description":"Minimum WLMI for the phrase","required":false,"paramType":"query"},{"name":"useCanonical","description":"If true will try to return the correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"List[bigram]","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"condition":"any"}],"summary":"Fetches bi-gram phrases for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/hyphenation","description":"","operations":[{"parameters":[{"name":"word","description":"Word to get syllables for","required":true,"paramType":"path"},{"name":"useCanonical","description":"If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"sourceDictionary","description":"Get from a single dictionary. Valid options: ahd, century, wiktionary, webster, and wordnet.","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"List[syllable]","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"condition":"any"}],"summary":"Returns syllable information for a word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/pronunciations","description":"","operations":[{"parameters":[{"name":"word","description":"Word to get pronunciations for","required":true,"paramType":"path"},{"name":"useCanonical","description":"If true will try to return a correct word root ('cats' -> 'cat'). If false returns exactly what was requested.","required":false,"paramType":"query"},{"name":"sourceDictionary","description":"Get from a single dictionary.","required":false,"allowableValues":"ahd,century,cmu,wiktionary,webster,wordnet","paramType":"query"},{"name":"typeFormat","description":"Text pronunciation type","required":false,"allowableValues":"ahd,arpabet,gcide-diacritical","paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"List[textPron]","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"condition":"any"}],"summary":"Returns text pronunciations for a given word","open":false,"httpMethod":"GET"}]},{"path":"/word.{format}/{word}/audio","description":"","operations":[{"parameters":[{"name":"word","description":"Word to get audio for.","required":true,"paramType":"path"},{"name":"useCanonical","description":"Use the canonical form of the word.","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"List[audioObject]","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"condition":"any"},{"valueType":"List[audioFile]","errorResponses":[{"reason":"Invalid word supplied.","code":400}],"condition":"any"}],"summary":"Fetches audio metadata for a word.","open":false,"notes":"The metadata includes a time-expiring fileUrl which allows reading the audio file directly from the API. Currently only audio pronunciations from the American Heritage Dictionary in mp3 format are supported.","httpMethod":"GET"}]}],"models":[{"name":"note","fields":[{"name":"noteType","description":"Contains the type of note","required":false,"allowableValues":"x, y, z","internalDescription":"Need to replace x, y z","paramAccess":"open","paramType":"string"},{"name":"pos","required":false,"paramType":"int"},{"name":"value","required":false,"paramType":"string"},{"name":"appliesTo","required":false,"paramType":"List[string]"}]},{"name":"example","fields":[{"name":"year","required":false,"paramType":"integer"},{"name":"provider","required":false,"paramType":"contentProvider"},{"name":"url","required":false,"paramType":"string"},{"name":"word","required":false,"paramType":"string"},{"name":"text","required":false,"paramType":"string"},{"name":"title","required":false,"paramType":"string"},{"name":"rating","required":false,"paramType":"float"},{"name":"exampleId","required":false,"paramType":"long"},{"name":"documentId","required":false,"paramType":"long"}]},{"name":"definition","fields":[{"name":"exampleUsage","required":false,"wrapperName":"exampleUses","paramType":"List[ExampleUsage]"},{"name":"word","required":false,"paramType":"string"},{"name":"text","required":false,"paramType":"string"},{"name":"textPron","required":false,"wrapperName":"textProns","paramType":"List[textPron]"},{"name":"partOfSpeech","required":false,"paramType":"string"},{"name":"note","required":false,"wrapperName":"notes","paramType":"List[note]"},{"name":"citation","required":false,"wrapperName":"citations","paramType":"List[citation]"},{"name":"relWord","required":false,"wrapperName":"relatedWords","paramType":"List[related]"},{"name":"sourceDictionary","required":false,"paramType":"string"},{"name":"label","required":false,"wrapperName":"labels","paramType":"List[Label]"},{"name":"sequence","required":false,"paramType":"string"},{"name":"seqString","required":false,"paramType":"string"},{"name":"extendedText","required":false,"paramType":"string"}]},{"name":"category","fields":[{"name":"name","required":false,"paramType":"string"}]},{"name":"frequency","fields":[{"name":"year","required":false,"paramType":"int"},{"name":"count","required":false,"paramType":"long"}]},{"name":"contentProvider","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"id","required":false,"paramType":"int"}]},{"name":"audioType","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"id","required":false,"paramType":"int"}]},{"name":"ExampleUsage","fields":[{"name":"text","required":false,"paramType":"string"}]},{"name":"root","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"categories","required":false,"paramType":"List[category]"}]},{"name":"frequencySummary","fields":[{"name":"word","required":false,"paramType":"string"},{"name":"totalCount","required":false,"paramType":"long"},{"name":"frequency","required":false,"paramType":"List[frequency]"},{"name":"unknownYearCount","required":false,"paramType":"int"},{"name":"countForYear","required":false,"paramType":"long"}]},{"name":"citation","fields":[{"name":"source","required":false,"paramType":"string"},{"name":"cite","required":false,"paramType":"string"}]},{"name":"audioType","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"id","required":false,"paramType":"int"}]},{"name":"scoredWord","fields":[{"name":"id","required":false,"paramType":"long"},{"name":"wordType","required":false,"paramType":"string"},{"name":"position","required":false,"paramType":"int"},{"name":"word","required":false,"paramType":"string"},{"name":"score","required":false,"paramType":"float"},{"name":"sentenceId","required":false,"paramType":"long"},{"name":"partOfSpeech","required":false,"paramType":"string"}]},{"name":"facetValue","fields":[{"name":"value","required":false,"paramType":"string"},{"name":"count","required":false,"paramType":"long"}]},{"name":"sentence","fields":[{"name":"id","required":false,"paramType":"long"},{"name":"scoredWord","required":false,"wrapperName":"scoredWords","paramType":"List[scoredWord]"},{"name":"display","required":false,"paramType":"string"},{"name":"documentMetadataId","required":false,"paramType":"long"},{"name":"rating","required":false,"paramType":"int"}]},{"name":"facet","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"facetValue","required":false,"wrapperName":"facetValues","paramType":"List[facetValue]"}]},{"name":"wordObject","fields":[{"name":"word","required":false,"paramType":"string"},{"name":"vulgar","required":false,"paramType":"string"}]},{"name":"bigram","fields":[{"name":"count","required":false,"paramType":"long"},{"name":"gram1","required":false,"paramType":"string"},{"name":"gram2","required":false,"paramType":"string"},{"name":"mi","required":false,"paramType":"double"},{"name":"wlmi","required":false,"paramType":"double"}]},{"name":"related","fields":[{"name":"word","required":false,"wrapperName":"words","paramType":"List[string]"},{"name":"relationshipType","required":false,"paramType":"string"},{"name":"label1","required":false,"paramType":"string"},{"name":"label2","required":false,"paramType":"string"},{"name":"label3","required":false,"paramType":"string"},{"name":"label4","required":false,"paramType":"string"},{"name":"gram","required":false,"paramType":"string"}]},{"name":"exampleSearchResults","fields":[{"name":"facet","required":false,"wrapperName":"facets","paramType":"List[facet]"},{"name":"example","required":false,"wrapperName":"examples","paramType":"List[example]"},{"name":"totalResults","required":false,"paramType":"int"}]},{"name":"frequencySummaryE","fields":[{"name":"elements","required":false,"paramType":"List[frequencyElement]"}]},{"name":"partOfSpeech","fields":[{"name":"roots","required":false,"paramType":"List[root]"}]},{"name":"syllable","fields":[{"name":"type","required":false,"paramType":"string"},{"name":"seq","required":false,"paramType":"int"},{"name":"text","required":false,"paramType":"string"}]},{"name":"textPron","fields":[{"name":"id","required":false,"paramType":"long"},{"name":"seq","required":false,"paramType":"int"},{"name":"raw","required":false,"paramType":"string"},{"name":"rawType","required":false,"paramType":"string"}]},{"name":"Label","fields":[{"name":"type","required":false,"paramType":"string"},{"name":"text","required":false,"paramType":"string"}]},{"name":"audioFile","fields":[{"name":"id","required":true,"paramType":"long"},{"name":"description","required":false,"paramType":"string"},{"name":"createdBy","required":false,"paramType":"string"},{"name":"word","required":false,"paramType":"string"},{"name":"createdAt","required":false,"paramType":"Date"},{"name":"commentCount","required":false,"paramType":"int"},{"name":"voteCount","required":false,"paramType":"integer"},{"name":"voteAverage","required":false,"paramType":"float"},{"name":"voteWeightedAverage","required":false,"paramType":"float"},{"name":"fileUrl","required":false,"paramType":"string"}]},{"name":"frequencyElement","fields":[{"name":"year","required":false,"paramType":"int"},{"name":"lowerWisker","required":false,"paramType":"double"},{"name":"upperWisker","required":false,"paramType":"double"},{"name":"lowerBox","required":false,"paramType":"double"},{"name":"upperBox","required":false,"paramType":"double"}]},{"name":"audioObject","fields":[{"name":"id","required":false,"paramType":"long"},{"name":"type","required":false,"paramType":"audioType"},{"name":"description","required":false,"paramType":"string"},{"name":"userId","required":false,"paramType":"long"},{"name":"createdBy","required":false,"paramType":"string"},{"name":"wordstring","required":false,"paramType":"string"},{"name":"wordId","required":false,"paramType":"long"},{"name":"createdAt","required":false,"paramType":"Date"},{"name":"filePath","required":false,"paramType":"string"},{"name":"recordId","required":false,"paramType":"string"},{"name":"audioFileType","required":false,"paramType":"audioType"},{"name":"audioFileId","required":false,"paramType":"long"},{"name":"streamPath","required":false,"paramType":"string"}]}]}
|
data/api_docs/wordList.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"endPoints":[{"path":"/wordList.{format}/{wordListId}","description":"","operations":[{"parameters":[{"name":"wordListId","description":"ID of WordList to fetch","required":true,"paramType":"path"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"
|
1
|
+
{"endPoints":[{"path":"/wordList.{format}/{wordListId}","description":"","operations":[{"parameters":[{"name":"wordListId","description":"ID of WordList to fetch","required":true,"paramType":"path"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"wordList","errorResponses":[{"reason":"Invalid ID supplied","code":400},{"reason":"Not Authorized to access WordList","code":403},{"reason":"WordList not found","code":404}],"condition":"any"}],"summary":"Fetches a WordList by ID","open":false,"httpMethod":"GET"}]},{"path":"/wordList.{format}/{wordListId}/deleteWords","description":"","operations":[{"parameters":[{"name":"wordListId","description":"ID of WordList to use","required":true,"paramType":"path"},{"description":"Words to remove from WordList","required":false,"paramType":"body"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"void","errorResponses":[{"reason":"Invalid ID supplied","code":400},{"reason":"Not Authorized to modify WordList","code":403},{"reason":"WordList not found","code":404}],"condition":"any"}],"summary":"Removes words from a WordList","open":false,"httpMethod":"POST"}]},{"path":"/wordList.{format}/{wordListId}/words","description":"","operations":[{"parameters":[{"name":"wordListId","description":"ID of WordList to use","required":true,"paramType":"path"},{"name":"sortBy","description":"Field to sort by","required":false,"allowableValues":"createDate,alpha","paramType":"query"},{"name":"sortOrder","description":"Direction to sort","required":false,"allowableValues":"asc,desc","paramType":"query"},{"name":"skip","description":"Results to skip","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"List[wordListWord]","errorResponses":[{"reason":"Invalid ID supplied","code":400},{"reason":"Not Authorized to access WordList","code":403},{"reason":"WordList not found","code":404}],"condition":"any"}],"summary":"Fetches words in a WordList","open":false,"httpMethod":"GET"}]},{"path":"/wordList.{format}/{wordListId}/words","description":"","operations":[{"parameters":[{"name":"wordListId","description":"ID of WordList to user","required":true,"paramType":"path"},{"description":"Words to add to WordList","required":false,"paramType":"body"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"void","errorResponses":[{"reason":"Invalid ID supplied","code":400},{"reason":"Not Authorized to access WordList","code":403},{"reason":"WordList not found","code":404}],"condition":"any"}],"summary":"Adds words to a WordList","open":false,"httpMethod":"POST"}]},{"path":"/wordList.{format}/{wordListId}","description":"","operations":[{"parameters":[{"name":"wordListId","description":"ID of WordList to update","required":true,"paramType":"path"},{"description":"Updated WordList","required":false,"paramType":"body"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"void","errorResponses":[{"reason":"Invalid ID supplied","code":400},{"reason":"Not Authorized to update WordList","code":403},{"reason":"WordList not found","code":404}],"condition":"any"}],"summary":"Updates an existing WordList","open":false,"httpMethod":"PUT"}]},{"path":"/wordList.{format}/{wordListId}","description":"","operations":[{"parameters":[{"name":"wordListId","description":"ID of WordList to delete","required":true,"paramType":"path"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"void","errorResponses":[{"reason":"Invalid ID supplied","code":400},{"reason":"Not Authorized to delete WordList","code":403},{"reason":"WordList not found","code":404}],"condition":"any"}],"summary":"Deletes an existing WordList","open":false,"httpMethod":"DELETE"}]}],"models":[{"name":"wordList","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"id","required":false,"paramType":"long"},{"name":"type","required":false,"paramType":"WordListType"},{"name":"description","required":false,"paramType":"string"},{"name":"userId","required":false,"paramType":"long"},{"name":"permalink","required":false,"paramType":"string"},{"name":"createdAt","required":false,"paramType":"Date"},{"name":"username","required":false,"paramType":"string"},{"name":"updatedAt","required":false,"paramType":"Date"},{"name":"numberWordsInList","required":false,"paramType":"long"}]},{"name":"wordListWord","fields":[{"name":"userId","required":false,"paramType":"long"},{"name":"word","required":false,"paramType":"string"},{"name":"createdAt","required":false,"paramType":"Date"},{"name":"username","required":false,"paramType":"string"},{"name":"numberCommentsOnWord","required":false,"paramType":"long"},{"name":"numberLists","required":false,"paramType":"long"}]}]}
|
data/api_docs/wordLists.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"endPoints":[{"path":"/wordLists","description":"","operations":[{"parameters":[{"description":"WordList to create","required":false,"paramType":"body"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"
|
1
|
+
{"endPoints":[{"path":"/wordLists","description":"","operations":[{"parameters":[{"description":"WordList to create","required":false,"paramType":"body"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"wordList","errorResponses":[{"reason":"Invalid WordList supplied or mandatory fields are missing.","code":400},{"reason":"Not authenticated.","code":403},{"reason":"WordList owner not found.","code":404}],"condition":"any"}],"summary":"Creates a WordList.","open":false,"httpMethod":"POST"}]},{"path":"/wordLists","description":"","operations":[{"parameters":[{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"doc","errorResponses":[{"reason":"No data available","code":404}],"condition":"any"}],"summary":"Returns information about API parameters","open":true,"httpMethod":"GET"}]}],"models":[{"name":"error","fields":[{"name":"reason","required":false,"paramType":"string"},{"name":"code","required":false,"paramType":"int"}]},{"name":"response","fields":[{"name":"valueType","required":false,"paramType":"string"},{"name":"errorResponses","required":false,"paramType":"List[error]"},{"name":"occurs","required":false,"paramType":"string"},{"name":"condition","required":false,"paramType":"string"}]},{"name":"parameter","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"defaultValue","required":false,"paramType":"string"},{"name":"description","required":false,"paramType":"string"},{"name":"required","required":false,"paramType":"boolean"},{"name":"allowableValues","required":false,"paramType":"string"},{"name":"wrapperName","required":false,"paramType":"string"},{"name":"internalDescription","required":false,"paramType":"string"},{"name":"paramAccess","required":false,"paramType":"string"},{"name":"paramType","required":false,"paramType":"string"}]},{"name":"wordList","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"id","required":false,"paramType":"long"},{"name":"type","required":false,"paramType":"WordListType"},{"name":"description","required":false,"paramType":"string"},{"name":"userId","required":false,"paramType":"long"},{"name":"permalink","required":false,"paramType":"string"},{"name":"createdAt","required":false,"paramType":"Date"},{"name":"username","required":false,"paramType":"string"},{"name":"updatedAt","required":false,"paramType":"Date"},{"name":"numberWordsInList","required":false,"paramType":"long"}]},{"name":"doc","fields":[{"name":"endPoints","required":false,"paramType":"List[endpoint]"},{"name":"models","required":false,"paramType":"List[object]"}]},{"name":"object","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"fields","required":false,"paramType":"List[parameter]"},{"name":"uniqueFieldName","required":false,"paramType":"string"}]},{"name":"endpoint","fields":[{"name":"path","required":false,"paramType":"string"},{"name":"description","required":false,"paramType":"string"},{"name":"operations","required":false,"paramType":"List[operation]"}]},{"name":"operation","fields":[{"name":"parameters","required":false,"paramType":"List[parameter]"},{"name":"response","required":false,"paramType":"List[response]"},{"name":"summary","required":false,"paramType":"string"},{"name":"open","required":false,"paramType":"boolean"},{"name":"notes","required":false,"paramType":"string"},{"name":"httpMethod","required":false,"paramType":"string"}]}]}
|
data/api_docs/words.json
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"endPoints":[{"path":"/words.{format}/randomWord","description":"","operations":[{"parameters":[{"name":"hasDictionaryDef","defaultValue":"true","description":"Only return words with dictionary definitions","required":false,"paramType":"query"},{"name":"includePartOfSpeech","description":"CSV part-of-speech values to include","required":false,"paramType":"query"},{"name":"excludePartOfSpeech","description":"CSV part-of-speech values to exclude","required":false,"paramType":"query"},{"name":"minCorpusCount","description":"Minimum corpus frequency for terms","required":false,"paramType":"query"},{"name":"maxCorpusCount","description":"Maximum corpus frequency for terms","required":false,"paramType":"query"},{"name":"minDictionaryCount","description":"Minimum dictionary count","required":false,"paramType":"query"},{"name":"maxDictionaryCount","description":"Maximum dictionary count","required":false,"paramType":"query"},{"name":"minLength","description":"Minimum word length","required":false,"paramType":"query"},{"name":"maxLength","description":"Maximum word length","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"Word","errorResponses":[{"reason":"No word found.","code":404}],"occurs":"1","condition":"any"}],"summary":"Returns a single random WordObject, in the format specified by the URL","open":false,"httpMethod":"GET"}]},{"path":"/words.{format}/randomWords","description":"","operations":[{"parameters":[{"name":"hasDictionaryDef","description":"Only return words with dictionary definitions","required":false,"paramType":"query"},{"name":"includePartOfSpeech","description":"CSV part-of-speech values to include","required":false,"paramType":"query"},{"name":"excludePartOfSpeech","description":"CSV part-of-speech values to exclude","required":false,"paramType":"query"},{"name":"minCorpusCount","description":"Minimum corpus frequency for terms (integer)","required":false,"paramType":"query"},{"name":"maxCorpusCount","description":"Maximum corpus frequency for terms (integer)","required":false,"paramType":"query"},{"name":"minDictionaryCount","description":"Minimum dictionary count (integer)","required":false,"paramType":"query"},{"name":"maxDictionaryCount","description":"Maximum dictionary count (integer)","required":false,"paramType":"query"},{"name":"minLength","description":"Minimum word length (characters)","required":false,"paramType":"query"},{"name":"maxLength","description":"Maximum word length (characters)","required":false,"paramType":"query"},{"name":"sortBy","description":"Attribute to sort by","required":false,"allowableValues":"alpha,count","paramType":"query"},{"name":"sortOrder","description":"Sort direction","required":false,"allowableValues":"asc,desc","paramType":"query"},{"name":"skip","description":"Results to skip (integer)","required":false,"paramType":"query"},{"name":"limit","description":"Maximum number of results to return (integer)","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"WordFrequency[]","errorResponses":[{"reason":"Invalid term supplied.","code":400},{"reason":"No results.","code":404}],"occurs":"1","condition":"any"}],"summary":"Returns an array of random WordObjects, in the format specified by the URL","open":false,"httpMethod":"GET"}]},{"path":"/words.{format}/search","description":"","operations":[{"parameters":[{"name":"query","description":"Search term","required":true,"paramType":"query"},{"name":"caseSensitive","defaultValue":"true","description":"Search case sensitive","required":false,"allowableValues":"true | false","paramType":"query"},{"name":"includePartOfSpeech","description":"Only include these comma-delimited parts of speech","required":false,"paramType":"query"},{"name":"excludePartOfSpeech","description":"Exclude these comma-delimited parts of speech","required":false,"paramType":"query"},{"name":"minCorpusCount","defaultValue":"5","description":"Minimum corpus frequency for terms","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"maxCorpusCount","description":"Maximum corpus frequency for terms","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"minDictionaryCount","defaultValue":"1","description":"Minimum number of dictionary entries","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"maxDictionaryCount","description":"Maximum dictionary count","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"minLength","defaultValue":"1","description":"Minimum word length","required":false,"allowableValues":"0 to 1024","paramType":"query"},{"name":"maxLength","description":"Maximum word length","required":false,"allowableValues":"0 to 1024","paramType":"query"},{"name":"skip","defaultValue":"0","description":"Results to skip","required":false,"allowableValues":"0 to 1000","paramType":"query"},{"name":"limit","defaultValue":"10","description":"Maximum number of results to return","required":false,"allowableValues":"1 to 1000","paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"WordFrequency[]","errorResponses":[{"reason":"Invalid term supplied.","code":400},{"reason":"No results.","code":404}],"occurs":"1","condition":"any"}],"summary":"Searches words.","open":false,"httpMethod":"GET"}]},{"path":"/words.{format}/wordOfTheDay","description":"","operations":[{"parameters":[{"name":"date","description":"Fetches by date in yyyy-MM-dd","required":false,"paramType":"query"},{"name":"category","description":"Filters response by category","required":false,"paramType":"query"},{"name":"creator","description":"Filters response by username","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"WordOfTheDay","errorResponses":[{"reason":"No data available","code":404}],"occurs":"1","condition":"any"}],"summary":"Returns a specific WordOfTheDay","open":true,"httpMethod":"GET"}]}]}
|
1
|
+
{"endPoints":[{"path":"/words.{format}/randomWord","description":"","operations":[{"parameters":[{"name":"hasDictionaryDef","defaultValue":"true","description":"Only return words with dictionary definitions","required":false,"paramType":"query"},{"name":"includePartOfSpeech","description":"CSV part-of-speech values to include","required":false,"paramType":"query"},{"name":"excludePartOfSpeech","description":"CSV part-of-speech values to exclude","required":false,"paramType":"query"},{"name":"minCorpusCount","description":"Minimum corpus frequency for terms","required":false,"paramType":"query"},{"name":"maxCorpusCount","description":"Maximum corpus frequency for terms","required":false,"paramType":"query"},{"name":"minDictionaryCount","description":"Minimum dictionary count","required":false,"paramType":"query"},{"name":"maxDictionaryCount","description":"Maximum dictionary count","required":false,"paramType":"query"},{"name":"minLength","description":"Minimum word length","required":false,"paramType":"query"},{"name":"maxLength","description":"Maximum word length","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"wordObject","errorResponses":[{"reason":"No word found.","code":404}],"condition":"any"}],"summary":"Returns a single random WordObject, in the format specified by the URL","open":false,"httpMethod":"GET"}]},{"path":"/words.{format}/randomWords","description":"","operations":[{"parameters":[{"name":"hasDictionaryDef","description":"Only return words with dictionary definitions","required":false,"paramType":"query"},{"name":"includePartOfSpeech","description":"CSV part-of-speech values to include","required":false,"paramType":"query"},{"name":"excludePartOfSpeech","description":"CSV part-of-speech values to exclude","required":false,"paramType":"query"},{"name":"minCorpusCount","description":"Minimum corpus frequency for terms (integer)","required":false,"paramType":"query"},{"name":"maxCorpusCount","description":"Maximum corpus frequency for terms (integer)","required":false,"paramType":"query"},{"name":"minDictionaryCount","description":"Minimum dictionary count (integer)","required":false,"paramType":"query"},{"name":"maxDictionaryCount","description":"Maximum dictionary count (integer)","required":false,"paramType":"query"},{"name":"minLength","description":"Minimum word length (characters)","required":false,"paramType":"query"},{"name":"maxLength","description":"Maximum word length (characters)","required":false,"paramType":"query"},{"name":"sortBy","description":"Attribute to sort by","required":false,"allowableValues":"alpha,count","paramType":"query"},{"name":"sortOrder","description":"Sort direction","required":false,"allowableValues":"asc,desc","paramType":"query"},{"name":"limit","description":"Maximum number of results to return (integer)","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"List[wordObject]","errorResponses":[{"reason":"Invalid term supplied.","code":400},{"reason":"No results.","code":404}],"condition":"any"}],"summary":"Returns an array of random WordObjects, in the format specified by the URL","open":false,"httpMethod":"GET"}]},{"path":"/words.{format}/search","description":"","operations":[{"parameters":[{"name":"query","description":"Search term","required":true,"paramType":"query"},{"name":"caseSensitive","defaultValue":"true","description":"Search case sensitive","required":false,"allowableValues":"true | false","paramType":"query"},{"name":"includePartOfSpeech","description":"Only include these comma-delimited parts of speech","required":false,"paramType":"query"},{"name":"excludePartOfSpeech","description":"Exclude these comma-delimited parts of speech","required":false,"paramType":"query"},{"name":"minCorpusCount","defaultValue":"5","description":"Minimum corpus frequency for terms","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"maxCorpusCount","description":"Maximum corpus frequency for terms","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"minDictionaryCount","defaultValue":"1","description":"Minimum number of dictionary entries","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"maxDictionaryCount","description":"Maximum dictionary count","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"minLength","defaultValue":"1","description":"Minimum word length","required":false,"allowableValues":"0 to 1024","paramType":"query"},{"name":"maxLength","description":"Maximum word length","required":false,"allowableValues":"0 to 1024","paramType":"query"},{"name":"skip","defaultValue":"0","description":"Results to skip","required":false,"allowableValues":"0 to 1000","paramType":"query"},{"name":"limit","defaultValue":"10","description":"Maximum number of results to return","required":false,"allowableValues":"1 to 1000","paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"List[wordFrequency]","errorResponses":[{"reason":"Invalid term supplied.","code":400},{"reason":"No results.","code":404}],"condition":"any"}],"summary":"Searches words.","open":false,"httpMethod":"GET"}]},{"path":"/words.{format}/wordOfTheDay","description":"","operations":[{"parameters":[{"name":"date","description":"Fetches by date in yyyy-MM-dd","required":false,"paramType":"query"},{"name":"category","description":"Filters response by category","required":false,"paramType":"query"},{"name":"creator","description":"Filters response by username","required":false,"paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"WordOfTheDay","errorResponses":[{"reason":"No data available","code":404}],"condition":"any"}],"summary":"Returns a specific WordOfTheDay","open":true,"httpMethod":"GET"}]},{"path":"/words.{format}/search/{query}","description":"","operations":[{"parameters":[{"name":"query","description":"Search query","required":true,"paramType":"path"},{"name":"caseSensitive","defaultValue":"true","description":"Search case sensitive","required":false,"allowableValues":"true | false","paramType":"query"},{"name":"includePartOfSpeech","description":"Only include these comma-delimited parts of speech","required":false,"paramType":"query"},{"name":"excludePartOfSpeech","description":"Exclude these comma-delimited parts of speech","required":false,"paramType":"query"},{"name":"minCorpusCount","defaultValue":"5","description":"Minimum corpus frequency for terms","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"maxCorpusCount","description":"Maximum corpus frequency for terms","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"minDictionaryCount","defaultValue":"1","description":"Minimum number of dictionary entries","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"maxDictionaryCount","description":"Maximum dictionary count","required":false,"allowableValues":"non-negative integer","paramType":"query"},{"name":"minLength","defaultValue":"1","description":"Minimum word length","required":false,"allowableValues":"0 to 1024","paramType":"query"},{"name":"maxLength","description":"Maximum word length","required":false,"allowableValues":"0 to 1024","paramType":"query"},{"name":"skip","defaultValue":"0","description":"Results to skip","required":false,"allowableValues":"0 to 1000","paramType":"query"},{"name":"limit","defaultValue":"10","description":"Maximum number of results to return","required":false,"allowableValues":"1 to 1000","paramType":"query"},{"name":"format","defaultValue":"json","description":"API response format","required":true,"allowableValues":"json,xml","paramType":"path"}],"response":[{"valueType":"wordSearchResults","errorResponses":[{"reason":"Invalid query supplied.","code":400}],"condition":"any"}],"summary":"Searches words.","open":false,"httpMethod":"GET"}]}],"models":[{"name":"wordFrequency","fields":[{"name":"count","required":false,"paramType":"long"},{"name":"wordstring","required":false,"paramType":"string"}]},{"name":"partOfSpeech","fields":[{"name":"roots","required":false,"paramType":"List[root]"}]},{"name":"wordObject","fields":[{"name":"word","required":false,"paramType":"string"},{"name":"vulgar","required":false,"paramType":"string"}]},{"name":"wordSearchResults","fields":[{"name":"searchResult","required":false,"wrapperName":"searchResults","paramType":"List[WordSearchResult]"},{"name":"totalResults","required":false,"paramType":"int"}]},{"name":"contentProvider","fields":[{"name":"name","required":false,"paramType":"string"},{"name":"id","required":false,"paramType":"int"}]},{"name":"WordOfTheDay","fields":[{"name":"id","required":true,"paramType":"long"},{"name":"category","required":false,"paramType":"string"},{"name":"example","required":false,"wrapperName":"examples","paramType":"List[SimpleExample]"},{"name":"createdBy","required":false,"paramType":"string"},{"name":"word","required":false,"paramType":"string"},{"name":"definition","required":false,"wrapperName":"definitions","paramType":"List[SimpleDefinition]"},{"name":"contentProvider","required":false,"paramType":"contentProvider"},{"name":"createdAt","required":false,"paramType":"Date"},{"name":"publishDate","required":false,"paramType":"Date"},{"name":"parentId","required":false,"paramType":"string"},{"name":"note","required":false,"paramType":"string"},{"name":"htmlExtra","required":false,"paramType":"string"}]},{"name":"SimpleDefinition","fields":[{"name":"text","required":false,"paramType":"string"},{"name":"partOfSpeech","required":false,"paramType":"string"},{"name":"note","required":false,"paramType":"string"},{"name":"source","required":false,"paramType":"string"}]},{"name":"WordSearchResult","fields":[{"name":"count","required":false,"paramType":"long"},{"name":"word","required":false,"paramType":"string"},{"name":"lexicality","required":false,"paramType":"double"}]},{"name":"SimpleExample","fields":[{"name":"url","required":false,"paramType":"string"},{"name":"text","required":false,"paramType":"string"},{"name":"title","required":false,"paramType":"string"},{"name":"id","required":false,"paramType":"long"}]}]}
|
data/lib/wordnik.rb
CHANGED
data/lib/wordnik/endpoint.rb
CHANGED
@@ -6,11 +6,13 @@ module Wordnik
|
|
6
6
|
include ActiveModel::Conversion
|
7
7
|
extend ActiveModel::Naming
|
8
8
|
|
9
|
-
attr_accessor :path, :description, :operations
|
9
|
+
attr_accessor :path, :description, :operations, :resource
|
10
10
|
|
11
11
|
validates_presence_of :path, :description, :operations
|
12
12
|
|
13
|
-
def initialize(attributes = {})
|
13
|
+
def initialize(resource, attributes = {})
|
14
|
+
self.resource = resource
|
15
|
+
|
14
16
|
attributes.each do |name, value|
|
15
17
|
send("#{name.to_s.underscore.to_sym}=", value)
|
16
18
|
end
|
@@ -18,7 +20,7 @@ module Wordnik
|
|
18
20
|
# Generate Operations instances from JSON
|
19
21
|
if self.operations
|
20
22
|
self.operations = self.operations.map do |operationData|
|
21
|
-
Operation.new(operationData)
|
23
|
+
Operation.new(self, operationData)
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
data/lib/wordnik/operation.rb
CHANGED
@@ -6,15 +6,18 @@ module Wordnik
|
|
6
6
|
include ActiveModel::Conversion
|
7
7
|
extend ActiveModel::Naming
|
8
8
|
|
9
|
-
attr_accessor :http_method, :summary, :notes, :parameters, :response, :open
|
9
|
+
attr_accessor :endpoint, :http_method, :summary, :notes, :parameters, :response, :open, :nickname
|
10
10
|
|
11
|
-
validates_presence_of :http_method, :summary, :notes, :parameters, :response, :open
|
11
|
+
validates_presence_of :endpoint, :http_method, :summary, :notes, :parameters, :response, :open
|
12
12
|
|
13
|
-
def initialize(attributes = {})
|
13
|
+
def initialize(endpoint, attributes = {})
|
14
|
+
self.endpoint = endpoint
|
15
|
+
|
14
16
|
attributes.each do |name, value|
|
15
17
|
send("#{name.to_s.underscore.to_sym}=", value)
|
16
18
|
end
|
17
|
-
|
19
|
+
|
20
|
+
# munge that meth!
|
18
21
|
self.http_method = self.http_method.to_s.downcase
|
19
22
|
|
20
23
|
# Generate OperationParameter instances from JSON
|
@@ -23,8 +26,24 @@ module Wordnik
|
|
23
26
|
OperationParameter.new(parameterData)
|
24
27
|
end
|
25
28
|
end
|
29
|
+
|
30
|
+
# Define nickname
|
31
|
+
self.nickname = [self.http_method, self.endpoint.path].
|
32
|
+
join("_"). # join http method and path
|
33
|
+
gsub(/\{\w+\}/, ""). # remove path params
|
34
|
+
tr("/", "_"). # replace slashes with underscores
|
35
|
+
tr(' .', ''). # remove spaces and dots
|
36
|
+
underscore. # underscore
|
37
|
+
gsub(/_+/, "_"). # reduce multiple consective underscores to one
|
38
|
+
gsub("_#{self.endpoint.resource.name.to_s.underscore}", ""). # remove resource name
|
39
|
+
gsub(/_$/, "") # remove underscore from end of string
|
26
40
|
|
27
41
|
end
|
42
|
+
|
43
|
+
# A globally unique identifier for the operation
|
44
|
+
def slug
|
45
|
+
[self.endpoint.resource.name, self.nickname].join("_")
|
46
|
+
end
|
28
47
|
|
29
48
|
def get?
|
30
49
|
self.http_method.downcase == "get"
|
@@ -40,6 +59,28 @@ module Wordnik
|
|
40
59
|
false
|
41
60
|
end
|
42
61
|
|
62
|
+
def positional_parameter_names
|
63
|
+
self.parameters.map do |parameter|
|
64
|
+
parameter.name if parameter.positional?
|
65
|
+
end.compact
|
66
|
+
end
|
67
|
+
|
68
|
+
def required_kwargs
|
69
|
+
self.parameters.map do |parameter|
|
70
|
+
next if parameter.name.to_sym == :format
|
71
|
+
next if parameter.positional?
|
72
|
+
next unless parameter.required?
|
73
|
+
parameter
|
74
|
+
end.compact
|
75
|
+
end
|
76
|
+
|
77
|
+
def optional_kwargs
|
78
|
+
self.parameters.map do |parameter|
|
79
|
+
next if parameter.required?
|
80
|
+
parameter
|
81
|
+
end.compact
|
82
|
+
end
|
83
|
+
|
43
84
|
end
|
44
85
|
|
45
86
|
end
|
@@ -12,6 +12,12 @@ module Wordnik
|
|
12
12
|
attributes.each do |name, value|
|
13
13
|
send("#{name.to_s.underscore.to_sym}=", value)
|
14
14
|
end
|
15
|
+
|
16
|
+
# Fudge body param into having the name :body
|
17
|
+
self.name = :body if self.name.blank?
|
18
|
+
|
19
|
+
# Change camelcase to underscore
|
20
|
+
self.name = self.name.to_s.underscore
|
15
21
|
end
|
16
22
|
|
17
23
|
def human_name
|
@@ -24,7 +30,12 @@ module Wordnik
|
|
24
30
|
end
|
25
31
|
|
26
32
|
def required?
|
27
|
-
self.required
|
33
|
+
self.required || self.param_type == "path"
|
34
|
+
end
|
35
|
+
|
36
|
+
# Is this a required positional param used in a convenience method?
|
37
|
+
def positional?
|
38
|
+
self.param_type == "path" && self.name.to_sym != :format
|
28
39
|
end
|
29
40
|
|
30
41
|
# It's an ActiveModel thing..
|
data/lib/wordnik/resource.rb
CHANGED
@@ -19,30 +19,40 @@ module Wordnik
|
|
19
19
|
# Generate Endpoint instances from JSON
|
20
20
|
if self.raw_data['endPoints']
|
21
21
|
self.endpoints = self.raw_data['endPoints'].map do |endpointData|
|
22
|
-
Endpoint.new(endpointData)
|
22
|
+
Endpoint.new(self, endpointData)
|
23
23
|
end
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
nickname_parts = []
|
34
|
-
nickname_parts << operation.http_method
|
35
|
-
nickname_parts << endpoint.path.gsub(/\{\w+\}/, "").tr("/", "_").tr(' .', '').underscore
|
36
|
-
nickname = nickname_parts.
|
37
|
-
join("_").
|
38
|
-
gsub(/_+/, "_").
|
39
|
-
gsub("_#{self.name.to_s.underscore}", "").
|
40
|
-
gsub(/_$/, "")
|
41
|
-
@pairs[nickname] = endpoint.path
|
27
|
+
# Cycle through endpoints and their operations in search of
|
28
|
+
# the path that corresponds to the given nickname
|
29
|
+
def path_for_operation_nickname(nickname)
|
30
|
+
self.endpoints.each do |endpoint|
|
31
|
+
endpoint.operations.each do |operation|
|
32
|
+
return endpoint.path if operation.nickname == nickname
|
42
33
|
end
|
43
34
|
end
|
44
|
-
@pairs
|
45
35
|
end
|
36
|
+
|
37
|
+
# def operation_nickname_pairs
|
38
|
+
# return @pairs if @pairs
|
39
|
+
# return unless self.endpoints.present?
|
40
|
+
# @pairs = {}
|
41
|
+
# self.endpoints.map do |endpoint|
|
42
|
+
# endpoint.operations.map do |operation|
|
43
|
+
# nickname_parts = []
|
44
|
+
# nickname_parts << operation.http_method
|
45
|
+
# nickname_parts << endpoint.path.gsub(/\{\w+\}/, "").tr("/", "_").tr(' .', '').underscore
|
46
|
+
# nickname = nickname_parts.
|
47
|
+
# join("_").
|
48
|
+
# gsub(/_+/, "_").
|
49
|
+
# gsub("_#{self.name.to_s.underscore}", "").
|
50
|
+
# gsub(/_$/, "")
|
51
|
+
# @pairs[nickname] = endpoint.path
|
52
|
+
# end
|
53
|
+
# end
|
54
|
+
# @pairs
|
55
|
+
# end
|
46
56
|
|
47
57
|
# Uses the received method name and arguments to dynamically construct a Request
|
48
58
|
# If the method name is prefixed with 'build_', then the 'unmade' Request
|
@@ -71,7 +81,7 @@ module Wordnik
|
|
71
81
|
|
72
82
|
# Find the path that corresponds to this method nickname
|
73
83
|
# e.g. post_words -> "/wordList.{format}/{wordListId}/words"
|
74
|
-
path =
|
84
|
+
path = self.path_for_operation_nickname(nickname)
|
75
85
|
|
76
86
|
# Take the '.{format}' portion out of the string so it doesn't interfere with
|
77
87
|
# the interpolation we're going to do on the path.
|
@@ -81,6 +91,8 @@ module Wordnik
|
|
81
91
|
args.each do |arg|
|
82
92
|
path.sub!(/\{\w+\}/, arg)
|
83
93
|
end
|
94
|
+
|
95
|
+
# TODO: treat kwargs as body instead of params if request method is post or put
|
84
96
|
|
85
97
|
request = Wordnik::Request.new(http_method, path, :params => params)
|
86
98
|
|
data/lib/wordnik/version.rb
CHANGED
data/spec/endpoint_spec.rb
CHANGED
@@ -6,8 +6,8 @@ describe Wordnik::Endpoint do
|
|
6
6
|
VCR.use_cassette('words', :record => :new_episodes) do
|
7
7
|
@response = Typhoeus::Request.get("http://api.wordnik.com/v4/word.json")
|
8
8
|
end
|
9
|
-
|
10
|
-
@endpoint =
|
9
|
+
@resource = Wordnik::Resource.new(:name => "word", :raw_data => JSON.parse(@response.body))
|
10
|
+
@endpoint = @resource.endpoints.first
|
11
11
|
end
|
12
12
|
|
13
13
|
describe "initialization" do
|
data/spec/operation_spec.rb
CHANGED
@@ -6,8 +6,9 @@ describe Wordnik::Operation do
|
|
6
6
|
VCR.use_cassette('words', :record => :new_episodes) do
|
7
7
|
@response = Typhoeus::Request.get("http://api.wordnik.com/v4/word.json")
|
8
8
|
end
|
9
|
-
|
10
|
-
@
|
9
|
+
@resource = Wordnik::Resource.new(:name => "word", :raw_data => JSON.parse(@response.body))
|
10
|
+
@endpoint = @resource.endpoints.first
|
11
|
+
@operation = @endpoint.operations.first
|
11
12
|
end
|
12
13
|
|
13
14
|
describe "initialization" do
|
data/spec/wordnik_spec.rb
CHANGED
@@ -32,6 +32,8 @@ describe Wordnik do
|
|
32
32
|
before(:each) do
|
33
33
|
end
|
34
34
|
|
35
|
+
it "auto-authenticates at load time if username and password are present"
|
36
|
+
|
35
37
|
it "succeeds if a username and password are present in the configuration" do
|
36
38
|
Wordnik.authenticate
|
37
39
|
Wordnik.authenticated?.should == true
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: wordnik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.4.
|
5
|
+
version: 0.4.1
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Zeke Sikelianos
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-
|
14
|
+
date: 2011-04-04 00:00:00 -07:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- Gemfile.lock
|
130
130
|
- README.md
|
131
131
|
- Rakefile
|
132
|
+
- USAGE.md
|
132
133
|
- api_docs/account.json
|
133
134
|
- api_docs/corpus.json
|
134
135
|
- api_docs/document.json
|