wordnik 4.06.00 → 4.06.01
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -3
- data/api_docs/.gitkeep +0 -0
- 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/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/words.json +1 -0
- data/lib/wordnik/resource_modules/.gitkeep +0 -0
- data/lib/wordnik/resource_modules/account.rb +486 -0
- data/lib/wordnik/resource_modules/corpus.rb +453 -0
- data/lib/wordnik/resource_modules/document.rb +167 -0
- data/lib/wordnik/resource_modules/partners.rb +339 -0
- data/lib/wordnik/resource_modules/tag.rb +59 -0
- data/lib/wordnik/resource_modules/user.rb +1207 -0
- data/lib/wordnik/resource_modules/users.rb +216 -0
- data/lib/wordnik/resource_modules/word.rb +1391 -0
- data/lib/wordnik/resource_modules/word_list.rb +574 -0
- data/lib/wordnik/resource_modules/word_lists.rb +139 -0
- data/lib/wordnik/resource_modules/words.rb +645 -0
- data/lib/wordnik/version.rb +1 -1
- metadata +24 -26
@@ -0,0 +1,574 @@
|
|
1
|
+
# HEY HACKER! THIS IS AN AUTO-GENERATED FILE.
|
2
|
+
# So don't bother editing it. To see how it's built, take a look at the Rakefile
|
3
|
+
|
4
|
+
module WordListMethods
|
5
|
+
|
6
|
+
# Updates an existing WordList
|
7
|
+
#
|
8
|
+
def update_word_list(wordListId, body, *args)
|
9
|
+
http_method = :put
|
10
|
+
path = '/wordList/{wordListId}'
|
11
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
12
|
+
|
13
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
14
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
15
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
16
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
17
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
18
|
+
last_arg ||= {}
|
19
|
+
|
20
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
21
|
+
# that we want the request itself back, not the response body
|
22
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
23
|
+
request_only = true
|
24
|
+
last_arg.delete(:request_only)
|
25
|
+
end
|
26
|
+
|
27
|
+
params = last_arg
|
28
|
+
body ||= {}
|
29
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
30
|
+
request_only ? request : request.response.body
|
31
|
+
end
|
32
|
+
|
33
|
+
# Deletes an existing WordList
|
34
|
+
#
|
35
|
+
def delete_word_list(wordListId, *args)
|
36
|
+
http_method = :delete
|
37
|
+
path = '/wordList/{wordListId}'
|
38
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
39
|
+
|
40
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
41
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
42
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
43
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
44
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
45
|
+
last_arg ||= {}
|
46
|
+
|
47
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
48
|
+
# that we want the request itself back, not the response body
|
49
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
50
|
+
request_only = true
|
51
|
+
last_arg.delete(:request_only)
|
52
|
+
end
|
53
|
+
|
54
|
+
params = last_arg
|
55
|
+
body ||= {}
|
56
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
57
|
+
request_only ? request : request.response.body
|
58
|
+
end
|
59
|
+
|
60
|
+
# Fetches a WordList by ID
|
61
|
+
#
|
62
|
+
def get_word_list_by_id(wordListId, *args)
|
63
|
+
http_method = :get
|
64
|
+
path = '/wordList/{wordListId}'
|
65
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
66
|
+
|
67
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
68
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
69
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
70
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
71
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
72
|
+
last_arg ||= {}
|
73
|
+
|
74
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
75
|
+
# that we want the request itself back, not the response body
|
76
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
77
|
+
request_only = true
|
78
|
+
last_arg.delete(:request_only)
|
79
|
+
end
|
80
|
+
|
81
|
+
params = last_arg
|
82
|
+
body ||= {}
|
83
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
84
|
+
request_only ? request : request.response.body
|
85
|
+
end
|
86
|
+
|
87
|
+
# Adds words to a WordList
|
88
|
+
#
|
89
|
+
def add_words_to_word_list(wordListId, body, *args)
|
90
|
+
http_method = :post
|
91
|
+
path = '/wordList/{wordListId}/words'
|
92
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
93
|
+
|
94
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
95
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
96
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
97
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
98
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
99
|
+
last_arg ||= {}
|
100
|
+
|
101
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
102
|
+
# that we want the request itself back, not the response body
|
103
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
104
|
+
request_only = true
|
105
|
+
last_arg.delete(:request_only)
|
106
|
+
end
|
107
|
+
|
108
|
+
params = last_arg
|
109
|
+
body ||= {}
|
110
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
111
|
+
request_only ? request : request.response.body
|
112
|
+
end
|
113
|
+
|
114
|
+
# Fetches words in a WordList
|
115
|
+
#
|
116
|
+
def get_word_list_words(wordListId, *args)
|
117
|
+
http_method = :get
|
118
|
+
path = '/wordList/{wordListId}/words'
|
119
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
120
|
+
|
121
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
122
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
123
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
124
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
125
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
126
|
+
last_arg ||= {}
|
127
|
+
|
128
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
129
|
+
# that we want the request itself back, not the response body
|
130
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
131
|
+
request_only = true
|
132
|
+
last_arg.delete(:request_only)
|
133
|
+
end
|
134
|
+
|
135
|
+
params = last_arg
|
136
|
+
body ||= {}
|
137
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
138
|
+
request_only ? request : request.response.body
|
139
|
+
end
|
140
|
+
|
141
|
+
# Returns information about API parameters
|
142
|
+
#
|
143
|
+
def get_help(*args)
|
144
|
+
http_method = :get
|
145
|
+
path = '/wordList'
|
146
|
+
|
147
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
148
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
149
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
150
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
151
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
152
|
+
last_arg ||= {}
|
153
|
+
|
154
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
155
|
+
# that we want the request itself back, not the response body
|
156
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
157
|
+
request_only = true
|
158
|
+
last_arg.delete(:request_only)
|
159
|
+
end
|
160
|
+
|
161
|
+
params = last_arg
|
162
|
+
body ||= {}
|
163
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
164
|
+
request_only ? request : request.response.body
|
165
|
+
end
|
166
|
+
|
167
|
+
# Checks to see if a WordList has been favorited for a user
|
168
|
+
#
|
169
|
+
def is_favorite_word_list(wordListId, *args)
|
170
|
+
http_method = :get
|
171
|
+
path = '/wordList/{wordListId}/isFavorite'
|
172
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
173
|
+
|
174
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
175
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
176
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
177
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
178
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
179
|
+
last_arg ||= {}
|
180
|
+
|
181
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
182
|
+
# that we want the request itself back, not the response body
|
183
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
184
|
+
request_only = true
|
185
|
+
last_arg.delete(:request_only)
|
186
|
+
end
|
187
|
+
|
188
|
+
params = last_arg
|
189
|
+
body ||= {}
|
190
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
191
|
+
request_only ? request : request.response.body
|
192
|
+
end
|
193
|
+
|
194
|
+
# Favorites a WordList for a User
|
195
|
+
#
|
196
|
+
def favorite_word_list(wordListId, *args)
|
197
|
+
http_method = :post
|
198
|
+
path = '/wordList/{wordListId}/favorite'
|
199
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
200
|
+
|
201
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
202
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
203
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
204
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
205
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
206
|
+
last_arg ||= {}
|
207
|
+
|
208
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
209
|
+
# that we want the request itself back, not the response body
|
210
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
211
|
+
request_only = true
|
212
|
+
last_arg.delete(:request_only)
|
213
|
+
end
|
214
|
+
|
215
|
+
params = last_arg
|
216
|
+
body ||= {}
|
217
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
218
|
+
request_only ? request : request.response.body
|
219
|
+
end
|
220
|
+
|
221
|
+
# Unfavorites a WordList for a User
|
222
|
+
#
|
223
|
+
def un_favorite_word_list(wordListId, *args)
|
224
|
+
http_method = :delete
|
225
|
+
path = '/wordList/{wordListId}/favorite'
|
226
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
227
|
+
|
228
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
229
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
230
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
231
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
232
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
233
|
+
last_arg ||= {}
|
234
|
+
|
235
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
236
|
+
# that we want the request itself back, not the response body
|
237
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
238
|
+
request_only = true
|
239
|
+
last_arg.delete(:request_only)
|
240
|
+
end
|
241
|
+
|
242
|
+
params = last_arg
|
243
|
+
body ||= {}
|
244
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
245
|
+
request_only ? request : request.response.body
|
246
|
+
end
|
247
|
+
|
248
|
+
# Fetches Tags on a WordList
|
249
|
+
#
|
250
|
+
def get_word_list_tags(wordListId, *args)
|
251
|
+
http_method = :get
|
252
|
+
path = '/wordList/{wordListId}/tags'
|
253
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
254
|
+
|
255
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
256
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
257
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
258
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
259
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
260
|
+
last_arg ||= {}
|
261
|
+
|
262
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
263
|
+
# that we want the request itself back, not the response body
|
264
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
265
|
+
request_only = true
|
266
|
+
last_arg.delete(:request_only)
|
267
|
+
end
|
268
|
+
|
269
|
+
params = last_arg
|
270
|
+
body ||= {}
|
271
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
272
|
+
request_only ? request : request.response.body
|
273
|
+
end
|
274
|
+
|
275
|
+
# Fetches Tag count on a WordList
|
276
|
+
#
|
277
|
+
def get_word_list_tag_count(wordListId, *args)
|
278
|
+
http_method = :get
|
279
|
+
path = '/wordList/{wordListId}/tagCount'
|
280
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
281
|
+
|
282
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
283
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
284
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
285
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
286
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
287
|
+
last_arg ||= {}
|
288
|
+
|
289
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
290
|
+
# that we want the request itself back, not the response body
|
291
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
292
|
+
request_only = true
|
293
|
+
last_arg.delete(:request_only)
|
294
|
+
end
|
295
|
+
|
296
|
+
params = last_arg
|
297
|
+
body ||= {}
|
298
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
299
|
+
request_only ? request : request.response.body
|
300
|
+
end
|
301
|
+
|
302
|
+
# Adds a Tag on a WordList
|
303
|
+
#
|
304
|
+
def add_word_list_tag(wordListId, *args)
|
305
|
+
http_method = :post
|
306
|
+
path = '/wordList/{wordListId}/tag'
|
307
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
308
|
+
|
309
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
310
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
311
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
312
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
313
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
314
|
+
last_arg ||= {}
|
315
|
+
|
316
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
317
|
+
# that we want the request itself back, not the response body
|
318
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
319
|
+
request_only = true
|
320
|
+
last_arg.delete(:request_only)
|
321
|
+
end
|
322
|
+
|
323
|
+
params = last_arg
|
324
|
+
body ||= {}
|
325
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
326
|
+
request_only ? request : request.response.body
|
327
|
+
end
|
328
|
+
|
329
|
+
# Adds a Tag on a WordList
|
330
|
+
#
|
331
|
+
def delete_word_list_tag(wordListId, *args)
|
332
|
+
http_method = :delete
|
333
|
+
path = '/wordList/{wordListId}/tag'
|
334
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
335
|
+
|
336
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
337
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
338
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
339
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
340
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
341
|
+
last_arg ||= {}
|
342
|
+
|
343
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
344
|
+
# that we want the request itself back, not the response body
|
345
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
346
|
+
request_only = true
|
347
|
+
last_arg.delete(:request_only)
|
348
|
+
end
|
349
|
+
|
350
|
+
params = last_arg
|
351
|
+
body ||= {}
|
352
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
353
|
+
request_only ? request : request.response.body
|
354
|
+
end
|
355
|
+
|
356
|
+
# Fetches comments on a WordList
|
357
|
+
#
|
358
|
+
def get_word_list_comments(wordListId, *args)
|
359
|
+
http_method = :get
|
360
|
+
path = '/wordList/{wordListId}/comments'
|
361
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
362
|
+
|
363
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
364
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
365
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
366
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
367
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
368
|
+
last_arg ||= {}
|
369
|
+
|
370
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
371
|
+
# that we want the request itself back, not the response body
|
372
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
373
|
+
request_only = true
|
374
|
+
last_arg.delete(:request_only)
|
375
|
+
end
|
376
|
+
|
377
|
+
params = last_arg
|
378
|
+
body ||= {}
|
379
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
380
|
+
request_only ? request : request.response.body
|
381
|
+
end
|
382
|
+
|
383
|
+
# Adds a Comment on a WordList
|
384
|
+
#
|
385
|
+
def add_comment_to_word_list(wordListId, body, *args)
|
386
|
+
http_method = :post
|
387
|
+
path = '/wordList/{wordListId}/comment'
|
388
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
389
|
+
|
390
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
391
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
392
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
393
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
394
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
395
|
+
last_arg ||= {}
|
396
|
+
|
397
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
398
|
+
# that we want the request itself back, not the response body
|
399
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
400
|
+
request_only = true
|
401
|
+
last_arg.delete(:request_only)
|
402
|
+
end
|
403
|
+
|
404
|
+
params = last_arg
|
405
|
+
body ||= {}
|
406
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
407
|
+
request_only ? request : request.response.body
|
408
|
+
end
|
409
|
+
|
410
|
+
# Updates a Comment on a WordList
|
411
|
+
#
|
412
|
+
def update_comment_on_word_list(wordListId, body, *args)
|
413
|
+
http_method = :put
|
414
|
+
path = '/wordList/{wordListId}/comment'
|
415
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
416
|
+
|
417
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
418
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
419
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
420
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
421
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
422
|
+
last_arg ||= {}
|
423
|
+
|
424
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
425
|
+
# that we want the request itself back, not the response body
|
426
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
427
|
+
request_only = true
|
428
|
+
last_arg.delete(:request_only)
|
429
|
+
end
|
430
|
+
|
431
|
+
params = last_arg
|
432
|
+
body ||= {}
|
433
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
434
|
+
request_only ? request : request.response.body
|
435
|
+
end
|
436
|
+
|
437
|
+
# Fetches a WordList comment by ID
|
438
|
+
#
|
439
|
+
def get_word_list_comment_by_id(wordListId, commentId, *args)
|
440
|
+
http_method = :get
|
441
|
+
path = '/wordList/{wordListId}/comment/{commentId}'
|
442
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
443
|
+
path.sub!('{commentId}', commentId.to_s)
|
444
|
+
|
445
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
446
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
447
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
448
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
449
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
450
|
+
last_arg ||= {}
|
451
|
+
|
452
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
453
|
+
# that we want the request itself back, not the response body
|
454
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
455
|
+
request_only = true
|
456
|
+
last_arg.delete(:request_only)
|
457
|
+
end
|
458
|
+
|
459
|
+
params = last_arg
|
460
|
+
body ||= {}
|
461
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
462
|
+
request_only ? request : request.response.body
|
463
|
+
end
|
464
|
+
|
465
|
+
# Deletes a WordList comment by ID
|
466
|
+
#
|
467
|
+
def delete_word_list_comment_by_id(wordListId, commentId, *args)
|
468
|
+
http_method = :delete
|
469
|
+
path = '/wordList/{wordListId}/comment/{commentId}'
|
470
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
471
|
+
path.sub!('{commentId}', commentId.to_s)
|
472
|
+
|
473
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
474
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
475
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
476
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
477
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
478
|
+
last_arg ||= {}
|
479
|
+
|
480
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
481
|
+
# that we want the request itself back, not the response body
|
482
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
483
|
+
request_only = true
|
484
|
+
last_arg.delete(:request_only)
|
485
|
+
end
|
486
|
+
|
487
|
+
params = last_arg
|
488
|
+
body ||= {}
|
489
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
490
|
+
request_only ? request : request.response.body
|
491
|
+
end
|
492
|
+
|
493
|
+
# Fetches WordList Comment count
|
494
|
+
#
|
495
|
+
def get_word_list_comment_count(wordListId, *args)
|
496
|
+
http_method = :get
|
497
|
+
path = '/wordList/{wordListId}/commentCount'
|
498
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
499
|
+
|
500
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
501
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
502
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
503
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
504
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
505
|
+
last_arg ||= {}
|
506
|
+
|
507
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
508
|
+
# that we want the request itself back, not the response body
|
509
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
510
|
+
request_only = true
|
511
|
+
last_arg.delete(:request_only)
|
512
|
+
end
|
513
|
+
|
514
|
+
params = last_arg
|
515
|
+
body ||= {}
|
516
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
517
|
+
request_only ? request : request.response.body
|
518
|
+
end
|
519
|
+
|
520
|
+
# Removes words from a WordList
|
521
|
+
#
|
522
|
+
def delete_words_from_word_list(wordListId, body, *args)
|
523
|
+
http_method = :post
|
524
|
+
path = '/wordList/{wordListId}/deleteWords'
|
525
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
526
|
+
|
527
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
528
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
529
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
530
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
531
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
532
|
+
last_arg ||= {}
|
533
|
+
|
534
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
535
|
+
# that we want the request itself back, not the response body
|
536
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
537
|
+
request_only = true
|
538
|
+
last_arg.delete(:request_only)
|
539
|
+
end
|
540
|
+
|
541
|
+
params = last_arg
|
542
|
+
body ||= {}
|
543
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
544
|
+
request_only ? request : request.response.body
|
545
|
+
end
|
546
|
+
|
547
|
+
# Gets a count of Words in a WordList
|
548
|
+
#
|
549
|
+
def get_word_list_words_count(wordListId, *args)
|
550
|
+
http_method = :get
|
551
|
+
path = '/wordList/{wordListId}/wordsCount'
|
552
|
+
path.sub!('{wordListId}', wordListId.to_s)
|
553
|
+
|
554
|
+
# Ruby turns all key-value arguments at the end into a single hash
|
555
|
+
# e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
|
556
|
+
# becomes {:limit => 10, :part_of_speech => 'verb'}
|
557
|
+
last_arg = args.pop if args.last.is_a?(Hash)
|
558
|
+
last_arg = args.pop if args.last.is_a?(Array)
|
559
|
+
last_arg ||= {}
|
560
|
+
|
561
|
+
# Look for a kwarg called :request_only, whose presence indicates
|
562
|
+
# that we want the request itself back, not the response body
|
563
|
+
if last_arg.is_a?(Hash) && last_arg[:request_only].present?
|
564
|
+
request_only = true
|
565
|
+
last_arg.delete(:request_only)
|
566
|
+
end
|
567
|
+
|
568
|
+
params = last_arg
|
569
|
+
body ||= {}
|
570
|
+
request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
|
571
|
+
request_only ? request : request.response.body
|
572
|
+
end
|
573
|
+
|
574
|
+
end
|