wordnik 4.06.00 → 4.06.01

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,216 @@
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 UsersMethods
5
+
6
+ # Fetches recent AudioPron objects
7
+ #
8
+ def get_recent_pronunciations(*args)
9
+ http_method = :get
10
+ path = '/users/pronunciations'
11
+
12
+ # Ruby turns all key-value arguments at the end into a single hash
13
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
14
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
15
+ last_arg = args.pop if args.last.is_a?(Hash)
16
+ last_arg = args.pop if args.last.is_a?(Array)
17
+ last_arg ||= {}
18
+
19
+ # Look for a kwarg called :request_only, whose presence indicates
20
+ # that we want the request itself back, not the response body
21
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
22
+ request_only = true
23
+ last_arg.delete(:request_only)
24
+ end
25
+
26
+ params = last_arg
27
+ body ||= {}
28
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
29
+ request_only ? request : request.response.body
30
+ end
31
+
32
+ # Returns information about API parameters
33
+ #
34
+ def get_help(*args)
35
+ http_method = :get
36
+ path = '/users'
37
+
38
+ # Ruby turns all key-value arguments at the end into a single hash
39
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
40
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
41
+ last_arg = args.pop if args.last.is_a?(Hash)
42
+ last_arg = args.pop if args.last.is_a?(Array)
43
+ last_arg ||= {}
44
+
45
+ # Look for a kwarg called :request_only, whose presence indicates
46
+ # that we want the request itself back, not the response body
47
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
48
+ request_only = true
49
+ last_arg.delete(:request_only)
50
+ end
51
+
52
+ params = last_arg
53
+ body ||= {}
54
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
55
+ request_only ? request : request.response.body
56
+ end
57
+
58
+ # Creates a User
59
+ #
60
+ def create_user(body, *args)
61
+ http_method = :post
62
+ path = '/users'
63
+
64
+ # Ruby turns all key-value arguments at the end into a single hash
65
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
66
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
67
+ last_arg = args.pop if args.last.is_a?(Hash)
68
+ last_arg = args.pop if args.last.is_a?(Array)
69
+ last_arg ||= {}
70
+
71
+ # Look for a kwarg called :request_only, whose presence indicates
72
+ # that we want the request itself back, not the response body
73
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
74
+ request_only = true
75
+ last_arg.delete(:request_only)
76
+ end
77
+
78
+ params = last_arg
79
+ body ||= {}
80
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
81
+ request_only ? request : request.response.body
82
+ end
83
+
84
+ # Fetches a User by ID
85
+ #
86
+ def get_user_by_id(id, *args)
87
+ http_method = :get
88
+ path = '/users/id/{id}'
89
+ path.sub!('{id}', id.to_s)
90
+
91
+ # Ruby turns all key-value arguments at the end into a single hash
92
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
93
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
94
+ last_arg = args.pop if args.last.is_a?(Hash)
95
+ last_arg = args.pop if args.last.is_a?(Array)
96
+ last_arg ||= {}
97
+
98
+ # Look for a kwarg called :request_only, whose presence indicates
99
+ # that we want the request itself back, not the response body
100
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
101
+ request_only = true
102
+ last_arg.delete(:request_only)
103
+ end
104
+
105
+ params = last_arg
106
+ body ||= {}
107
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
108
+ request_only ? request : request.response.body
109
+ end
110
+
111
+ # Fetches a User by Facebook ID
112
+ #
113
+ def get_by_facebook_id(facebookId, *args)
114
+ http_method = :get
115
+ path = '/users/facebook/{facebookId}'
116
+ path.sub!('{facebookId}', facebookId.to_s)
117
+
118
+ # Ruby turns all key-value arguments at the end into a single hash
119
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
120
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
121
+ last_arg = args.pop if args.last.is_a?(Hash)
122
+ last_arg = args.pop if args.last.is_a?(Array)
123
+ last_arg ||= {}
124
+
125
+ # Look for a kwarg called :request_only, whose presence indicates
126
+ # that we want the request itself back, not the response body
127
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
128
+ request_only = true
129
+ last_arg.delete(:request_only)
130
+ end
131
+
132
+ params = last_arg
133
+ body ||= {}
134
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
135
+ request_only ? request : request.response.body
136
+ end
137
+
138
+ # Fetches recent Favorite Word objects.
139
+ #
140
+ def get_recent_favorites(*args)
141
+ http_method = :get
142
+ path = '/users/favorites'
143
+
144
+ # Ruby turns all key-value arguments at the end into a single hash
145
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
146
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
147
+ last_arg = args.pop if args.last.is_a?(Hash)
148
+ last_arg = args.pop if args.last.is_a?(Array)
149
+ last_arg ||= {}
150
+
151
+ # Look for a kwarg called :request_only, whose presence indicates
152
+ # that we want the request itself back, not the response body
153
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
154
+ request_only = true
155
+ last_arg.delete(:request_only)
156
+ end
157
+
158
+ params = last_arg
159
+ body ||= {}
160
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
161
+ request_only ? request : request.response.body
162
+ end
163
+
164
+ # Fetches recent Comment objects
165
+ #
166
+ def get_recent_comments(*args)
167
+ http_method = :get
168
+ path = '/users/comments'
169
+
170
+ # Ruby turns all key-value arguments at the end into a single hash
171
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
172
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
173
+ last_arg = args.pop if args.last.is_a?(Hash)
174
+ last_arg = args.pop if args.last.is_a?(Array)
175
+ last_arg ||= {}
176
+
177
+ # Look for a kwarg called :request_only, whose presence indicates
178
+ # that we want the request itself back, not the response body
179
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
180
+ request_only = true
181
+ last_arg.delete(:request_only)
182
+ end
183
+
184
+ params = last_arg
185
+ body ||= {}
186
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
187
+ request_only ? request : request.response.body
188
+ end
189
+
190
+ # Fetches info on Users who listed most words
191
+ #
192
+ def get_users_who_listed_most_words(*args)
193
+ http_method = :get
194
+ path = '/users/listedMostWords'
195
+
196
+ # Ruby turns all key-value arguments at the end into a single hash
197
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
198
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
199
+ last_arg = args.pop if args.last.is_a?(Hash)
200
+ last_arg = args.pop if args.last.is_a?(Array)
201
+ last_arg ||= {}
202
+
203
+ # Look for a kwarg called :request_only, whose presence indicates
204
+ # that we want the request itself back, not the response body
205
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
206
+ request_only = true
207
+ last_arg.delete(:request_only)
208
+ end
209
+
210
+ params = last_arg
211
+ body ||= {}
212
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
213
+ request_only ? request : request.response.body
214
+ end
215
+
216
+ end
@@ -0,0 +1,1391 @@
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 WordMethods
5
+
6
+ # Return entries for a word
7
+ #
8
+ def get_entries(word, *args)
9
+ http_method = :get
10
+ path = '/word/{word}/entries'
11
+ path.sub!('{word}', word.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
+ # Returns examples for a word
34
+ #
35
+ def get_examples(word, *args)
36
+ http_method = :get
37
+ path = '/word/{word}/examples'
38
+ path.sub!('{word}', word.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 examples for a word
61
+ #
62
+ def get_examples_post(word, body, *args)
63
+ http_method = :post
64
+ path = '/word/{word}/examples'
65
+ path.sub!('{word}', word.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 a Relationship Map to a word
88
+ #
89
+ def add_word_form(word, body, *args)
90
+ http_method = :post
91
+ path = '/word/{word}/wordForms'
92
+ path.sub!('{word}', word.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
+ # Returns other forms of a word
115
+ #
116
+ def get_word_forms(word, *args)
117
+ http_method = :get
118
+ path = '/word/{word}/wordForms'
119
+ path.sub!('{word}', word.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
+ # Deletes a relationship from a word
142
+ #
143
+ def delete_word_form(word, *args)
144
+ http_method = :delete
145
+ path = '/word/{word}/wordForms'
146
+ path.sub!('{word}', word.to_s)
147
+
148
+ # Ruby turns all key-value arguments at the end into a single hash
149
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
150
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
151
+ last_arg = args.pop if args.last.is_a?(Hash)
152
+ last_arg = args.pop if args.last.is_a?(Array)
153
+ last_arg ||= {}
154
+
155
+ # Look for a kwarg called :request_only, whose presence indicates
156
+ # that we want the request itself back, not the response body
157
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
158
+ request_only = true
159
+ last_arg.delete(:request_only)
160
+ end
161
+
162
+ params = last_arg
163
+ body ||= {}
164
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
165
+ request_only ? request : request.response.body
166
+ end
167
+
168
+ # Given a word as a string, returns the WordObject that represents it
169
+ #
170
+ def get_word(word, *args)
171
+ http_method = :get
172
+ path = '/word/{word}'
173
+ path.sub!('{word}', word.to_s)
174
+
175
+ # Ruby turns all key-value arguments at the end into a single hash
176
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
177
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
178
+ last_arg = args.pop if args.last.is_a?(Hash)
179
+ last_arg = args.pop if args.last.is_a?(Array)
180
+ last_arg ||= {}
181
+
182
+ # Look for a kwarg called :request_only, whose presence indicates
183
+ # that we want the request itself back, not the response body
184
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
185
+ request_only = true
186
+ last_arg.delete(:request_only)
187
+ end
188
+
189
+ params = last_arg
190
+ body ||= {}
191
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
192
+ request_only ? request : request.response.body
193
+ end
194
+
195
+ # Return definitions for a word
196
+ #
197
+ def get_definitions(word, *args)
198
+ http_method = :get
199
+ path = '/word/{word}/definitions'
200
+ path.sub!('{word}', word.to_s)
201
+
202
+ # Ruby turns all key-value arguments at the end into a single hash
203
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
204
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
205
+ last_arg = args.pop if args.last.is_a?(Hash)
206
+ last_arg = args.pop if args.last.is_a?(Array)
207
+ last_arg ||= {}
208
+
209
+ # Look for a kwarg called :request_only, whose presence indicates
210
+ # that we want the request itself back, not the response body
211
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
212
+ request_only = true
213
+ last_arg.delete(:request_only)
214
+ end
215
+
216
+ params = last_arg
217
+ body ||= {}
218
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
219
+ request_only ? request : request.response.body
220
+ end
221
+
222
+ # Returns word statistics
223
+ #
224
+ def get_word_stats(word, *args)
225
+ http_method = :get
226
+ path = '/word/{word}/stats'
227
+ path.sub!('{word}', word.to_s)
228
+
229
+ # Ruby turns all key-value arguments at the end into a single hash
230
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
231
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
232
+ last_arg = args.pop if args.last.is_a?(Hash)
233
+ last_arg = args.pop if args.last.is_a?(Array)
234
+ last_arg ||= {}
235
+
236
+ # Look for a kwarg called :request_only, whose presence indicates
237
+ # that we want the request itself back, not the response body
238
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
239
+ request_only = true
240
+ last_arg.delete(:request_only)
241
+ end
242
+
243
+ params = last_arg
244
+ body ||= {}
245
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
246
+ request_only ? request : request.response.body
247
+ end
248
+
249
+ # Returns information about API parameters
250
+ #
251
+ def get_help(*args)
252
+ http_method = :get
253
+ path = '/word'
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
+ # Returns a top example for a word
276
+ #
277
+ def get_top_example(word, *args)
278
+ http_method = :get
279
+ path = '/word/{word}/topExample'
280
+ path.sub!('{word}', word.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
+ # Fetches other forms of a word
303
+ # Deprecated
304
+ #
305
+ def get_punctuation_factor(word, *args)
306
+ http_method = :get
307
+ path = '/word/{word}/punctuationFactor'
308
+ path.sub!('{word}', word.to_s)
309
+
310
+ # Ruby turns all key-value arguments at the end into a single hash
311
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
312
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
313
+ last_arg = args.pop if args.last.is_a?(Hash)
314
+ last_arg = args.pop if args.last.is_a?(Array)
315
+ last_arg ||= {}
316
+
317
+ # Look for a kwarg called :request_only, whose presence indicates
318
+ # that we want the request itself back, not the response body
319
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
320
+ request_only = true
321
+ last_arg.delete(:request_only)
322
+ end
323
+
324
+ params = last_arg
325
+ body ||= {}
326
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
327
+ request_only ? request : request.response.body
328
+ end
329
+
330
+ # Returns definitions for a word based on the sentence in which it is found
331
+ # Use the offset parameter when the word occurs more than once in the sentence
332
+ #
333
+ def contextual_lookup(word, *args)
334
+ http_method = :get
335
+ path = '/word/{word}/contextualLookup'
336
+ path.sub!('{word}', word.to_s)
337
+
338
+ # Ruby turns all key-value arguments at the end into a single hash
339
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
340
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
341
+ last_arg = args.pop if args.last.is_a?(Hash)
342
+ last_arg = args.pop if args.last.is_a?(Array)
343
+ last_arg ||= {}
344
+
345
+ # Look for a kwarg called :request_only, whose presence indicates
346
+ # that we want the request itself back, not the response body
347
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
348
+ request_only = true
349
+ last_arg.delete(:request_only)
350
+ end
351
+
352
+ params = last_arg
353
+ body ||= {}
354
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
355
+ request_only ? request : request.response.body
356
+ end
357
+
358
+ # Returns definitions for a word based on the sentence in which it is found
359
+ # Use the offset parameter when the word occurs more than once in the sentence
360
+ #
361
+ def contextual_lookup_post(word, body, *args)
362
+ http_method = :post
363
+ path = '/word/{word}/contextualLookup'
364
+ path.sub!('{word}', word.to_s)
365
+
366
+ # Ruby turns all key-value arguments at the end into a single hash
367
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
368
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
369
+ last_arg = args.pop if args.last.is_a?(Hash)
370
+ last_arg = args.pop if args.last.is_a?(Array)
371
+ last_arg ||= {}
372
+
373
+ # Look for a kwarg called :request_only, whose presence indicates
374
+ # that we want the request itself back, not the response body
375
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
376
+ request_only = true
377
+ last_arg.delete(:request_only)
378
+ end
379
+
380
+ params = last_arg
381
+ body ||= {}
382
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
383
+ request_only ? request : request.response.body
384
+ end
385
+
386
+ # Returns the number of comments on a word
387
+ #
388
+ def get_comment_count(word, *args)
389
+ http_method = :get
390
+ path = '/word/{word}/commentCount'
391
+ path.sub!('{word}', word.to_s)
392
+
393
+ # Ruby turns all key-value arguments at the end into a single hash
394
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
395
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
396
+ last_arg = args.pop if args.last.is_a?(Hash)
397
+ last_arg = args.pop if args.last.is_a?(Array)
398
+ last_arg ||= {}
399
+
400
+ # Look for a kwarg called :request_only, whose presence indicates
401
+ # that we want the request itself back, not the response body
402
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
403
+ request_only = true
404
+ last_arg.delete(:request_only)
405
+ end
406
+
407
+ params = last_arg
408
+ body ||= {}
409
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
410
+ request_only ? request : request.response.body
411
+ end
412
+
413
+ # Return related words (thesaurus data) for a word
414
+ #
415
+ def get_related_words(word, *args)
416
+ http_method = :get
417
+ path = '/word/{word}/related'
418
+ path.sub!('{word}', word.to_s)
419
+
420
+ # Ruby turns all key-value arguments at the end into a single hash
421
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
422
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
423
+ last_arg = args.pop if args.last.is_a?(Hash)
424
+ last_arg = args.pop if args.last.is_a?(Array)
425
+ last_arg ||= {}
426
+
427
+ # Look for a kwarg called :request_only, whose presence indicates
428
+ # that we want the request itself back, not the response body
429
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
430
+ request_only = true
431
+ last_arg.delete(:request_only)
432
+ end
433
+
434
+ params = last_arg
435
+ body ||= {}
436
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
437
+ request_only ? request : request.response.body
438
+ end
439
+
440
+ # Returns WordLists containing a word
441
+ #
442
+ def get_listed_in(word, *args)
443
+ http_method = :get
444
+ path = '/word/{word}/listedIn'
445
+ path.sub!('{word}', word.to_s)
446
+
447
+ # Ruby turns all key-value arguments at the end into a single hash
448
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
449
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
450
+ last_arg = args.pop if args.last.is_a?(Hash)
451
+ last_arg = args.pop if args.last.is_a?(Array)
452
+ last_arg ||= {}
453
+
454
+ # Look for a kwarg called :request_only, whose presence indicates
455
+ # that we want the request itself back, not the response body
456
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
457
+ request_only = true
458
+ last_arg.delete(:request_only)
459
+ end
460
+
461
+ params = last_arg
462
+ body ||= {}
463
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
464
+ request_only ? request : request.response.body
465
+ end
466
+
467
+ # Returns a count of lists a word appears in
468
+ #
469
+ def get_listed_in_count(word, *args)
470
+ http_method = :get
471
+ path = '/word/{word}/listedInCount'
472
+ path.sub!('{word}', word.to_s)
473
+
474
+ # Ruby turns all key-value arguments at the end into a single hash
475
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
476
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
477
+ last_arg = args.pop if args.last.is_a?(Hash)
478
+ last_arg = args.pop if args.last.is_a?(Array)
479
+ last_arg ||= {}
480
+
481
+ # Look for a kwarg called :request_only, whose presence indicates
482
+ # that we want the request itself back, not the response body
483
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
484
+ request_only = true
485
+ last_arg.delete(:request_only)
486
+ end
487
+
488
+ params = last_arg
489
+ body ||= {}
490
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
491
+ request_only ? request : request.response.body
492
+ end
493
+
494
+ # Returns the first WordList a word appeared in
495
+ #
496
+ def get_first_listed_in(word, *args)
497
+ http_method = :get
498
+ path = '/word/{word}/firstListedIn'
499
+ path.sub!('{word}', word.to_s)
500
+
501
+ # Ruby turns all key-value arguments at the end into a single hash
502
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
503
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
504
+ last_arg = args.pop if args.last.is_a?(Hash)
505
+ last_arg = args.pop if args.last.is_a?(Array)
506
+ last_arg ||= {}
507
+
508
+ # Look for a kwarg called :request_only, whose presence indicates
509
+ # that we want the request itself back, not the response body
510
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
511
+ request_only = true
512
+ last_arg.delete(:request_only)
513
+ end
514
+
515
+ params = last_arg
516
+ body ||= {}
517
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
518
+ request_only ? request : request.response.body
519
+ end
520
+
521
+ # Returns the first User to list a particular word
522
+ #
523
+ def get_first_listed_by(word, *args)
524
+ http_method = :get
525
+ path = '/word/{word}/firstListedBy'
526
+ path.sub!('{word}', word.to_s)
527
+
528
+ # Ruby turns all key-value arguments at the end into a single hash
529
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
530
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
531
+ last_arg = args.pop if args.last.is_a?(Hash)
532
+ last_arg = args.pop if args.last.is_a?(Array)
533
+ last_arg ||= {}
534
+
535
+ # Look for a kwarg called :request_only, whose presence indicates
536
+ # that we want the request itself back, not the response body
537
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
538
+ request_only = true
539
+ last_arg.delete(:request_only)
540
+ end
541
+
542
+ params = last_arg
543
+ body ||= {}
544
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
545
+ request_only ? request : request.response.body
546
+ end
547
+
548
+ # Returns text pronunciations for a given word
549
+ #
550
+ def get_text_pronunciations(word, *args)
551
+ http_method = :get
552
+ path = '/word/{word}/pronunciations'
553
+ path.sub!('{word}', word.to_s)
554
+
555
+ # Ruby turns all key-value arguments at the end into a single hash
556
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
557
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
558
+ last_arg = args.pop if args.last.is_a?(Hash)
559
+ last_arg = args.pop if args.last.is_a?(Array)
560
+ last_arg ||= {}
561
+
562
+ # Look for a kwarg called :request_only, whose presence indicates
563
+ # that we want the request itself back, not the response body
564
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
565
+ request_only = true
566
+ last_arg.delete(:request_only)
567
+ end
568
+
569
+ params = last_arg
570
+ body ||= {}
571
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
572
+ request_only ? request : request.response.body
573
+ end
574
+
575
+ # Returns Flickr images for a word
576
+ #
577
+ def get_flickr_images(word, *args)
578
+ http_method = :get
579
+ path = '/word/{word}/images/flickr'
580
+ path.sub!('{word}', word.to_s)
581
+
582
+ # Ruby turns all key-value arguments at the end into a single hash
583
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
584
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
585
+ last_arg = args.pop if args.last.is_a?(Hash)
586
+ last_arg = args.pop if args.last.is_a?(Array)
587
+ last_arg ||= {}
588
+
589
+ # Look for a kwarg called :request_only, whose presence indicates
590
+ # that we want the request itself back, not the response body
591
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
592
+ request_only = true
593
+ last_arg.delete(:request_only)
594
+ end
595
+
596
+ params = last_arg
597
+ body ||= {}
598
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
599
+ request_only ? request : request.response.body
600
+ end
601
+
602
+ # Returns the Scrabble score for a word
603
+ #
604
+ def get_scrabble_score(word, *args)
605
+ http_method = :get
606
+ path = '/word/{word}/scrabbleScore'
607
+ path.sub!('{word}', word.to_s)
608
+
609
+ # Ruby turns all key-value arguments at the end into a single hash
610
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
611
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
612
+ last_arg = args.pop if args.last.is_a?(Hash)
613
+ last_arg = args.pop if args.last.is_a?(Array)
614
+ last_arg ||= {}
615
+
616
+ # Look for a kwarg called :request_only, whose presence indicates
617
+ # that we want the request itself back, not the response body
618
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
619
+ request_only = true
620
+ last_arg.delete(:request_only)
621
+ end
622
+
623
+ params = last_arg
624
+ body ||= {}
625
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
626
+ request_only ? request : request.response.body
627
+ end
628
+
629
+ # Returns citations for a word
630
+ #
631
+ def get_citations(word, *args)
632
+ http_method = :get
633
+ path = '/word/{word}/citations'
634
+ path.sub!('{word}', word.to_s)
635
+
636
+ # Ruby turns all key-value arguments at the end into a single hash
637
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
638
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
639
+ last_arg = args.pop if args.last.is_a?(Hash)
640
+ last_arg = args.pop if args.last.is_a?(Array)
641
+ last_arg ||= {}
642
+
643
+ # Look for a kwarg called :request_only, whose presence indicates
644
+ # that we want the request itself back, not the response body
645
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
646
+ request_only = true
647
+ last_arg.delete(:request_only)
648
+ end
649
+
650
+ params = last_arg
651
+ body ||= {}
652
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
653
+ request_only ? request : request.response.body
654
+ end
655
+
656
+ # Returns syllable information for a word
657
+ #
658
+ def get_hyphenation(word, *args)
659
+ http_method = :get
660
+ path = '/word/{word}/hyphenation'
661
+ path.sub!('{word}', word.to_s)
662
+
663
+ # Ruby turns all key-value arguments at the end into a single hash
664
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
665
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
666
+ last_arg = args.pop if args.last.is_a?(Hash)
667
+ last_arg = args.pop if args.last.is_a?(Array)
668
+ last_arg ||= {}
669
+
670
+ # Look for a kwarg called :request_only, whose presence indicates
671
+ # that we want the request itself back, not the response body
672
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
673
+ request_only = true
674
+ last_arg.delete(:request_only)
675
+ end
676
+
677
+ params = last_arg
678
+ body ||= {}
679
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
680
+ request_only ? request : request.response.body
681
+ end
682
+
683
+ # Returns syllable information for a word
684
+ #
685
+ def get_unigram_count_internal(word, *args)
686
+ http_method = :get
687
+ path = '/word/{word}/unigramCountInternal'
688
+ path.sub!('{word}', word.to_s)
689
+
690
+ # Ruby turns all key-value arguments at the end into a single hash
691
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
692
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
693
+ last_arg = args.pop if args.last.is_a?(Hash)
694
+ last_arg = args.pop if args.last.is_a?(Array)
695
+ last_arg ||= {}
696
+
697
+ # Look for a kwarg called :request_only, whose presence indicates
698
+ # that we want the request itself back, not the response body
699
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
700
+ request_only = true
701
+ last_arg.delete(:request_only)
702
+ end
703
+
704
+ params = last_arg
705
+ body ||= {}
706
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
707
+ request_only ? request : request.response.body
708
+ end
709
+
710
+ # Returns Bigrams for the given word
711
+ #
712
+ def get_bigrams_internal(word, *args)
713
+ http_method = :get
714
+ path = '/word/{word}/phrasesInternal'
715
+ path.sub!('{word}', word.to_s)
716
+
717
+ # Ruby turns all key-value arguments at the end into a single hash
718
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
719
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
720
+ last_arg = args.pop if args.last.is_a?(Hash)
721
+ last_arg = args.pop if args.last.is_a?(Array)
722
+ last_arg ||= {}
723
+
724
+ # Look for a kwarg called :request_only, whose presence indicates
725
+ # that we want the request itself back, not the response body
726
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
727
+ request_only = true
728
+ last_arg.delete(:request_only)
729
+ end
730
+
731
+ params = last_arg
732
+ body ||= {}
733
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
734
+ request_only ? request : request.response.body
735
+ end
736
+
737
+ # Returns the number of times a word has been viewed
738
+ #
739
+ def get_lookup_count(word, *args)
740
+ http_method = :get
741
+ path = '/word/{word}/lookupCount'
742
+ path.sub!('{word}', word.to_s)
743
+
744
+ # Ruby turns all key-value arguments at the end into a single hash
745
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
746
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
747
+ last_arg = args.pop if args.last.is_a?(Hash)
748
+ last_arg = args.pop if args.last.is_a?(Array)
749
+ last_arg ||= {}
750
+
751
+ # Look for a kwarg called :request_only, whose presence indicates
752
+ # that we want the request itself back, not the response body
753
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
754
+ request_only = true
755
+ last_arg.delete(:request_only)
756
+ end
757
+
758
+ params = last_arg
759
+ body ||= {}
760
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
761
+ request_only ? request : request.response.body
762
+ end
763
+
764
+ # Fetches tags for a word
765
+ #
766
+ def get_tags_on_word(word, *args)
767
+ http_method = :get
768
+ path = '/word/{word}/tags'
769
+ path.sub!('{word}', word.to_s)
770
+
771
+ # Ruby turns all key-value arguments at the end into a single hash
772
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
773
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
774
+ last_arg = args.pop if args.last.is_a?(Hash)
775
+ last_arg = args.pop if args.last.is_a?(Array)
776
+ last_arg ||= {}
777
+
778
+ # Look for a kwarg called :request_only, whose presence indicates
779
+ # that we want the request itself back, not the response body
780
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
781
+ request_only = true
782
+ last_arg.delete(:request_only)
783
+ end
784
+
785
+ params = last_arg
786
+ body ||= {}
787
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
788
+ request_only ? request : request.response.body
789
+ end
790
+
791
+ # Fetches tag count for a word
792
+ #
793
+ def get_tag_count_on_word(word, *args)
794
+ http_method = :get
795
+ path = '/word/{word}/tagCount'
796
+ path.sub!('{word}', word.to_s)
797
+
798
+ # Ruby turns all key-value arguments at the end into a single hash
799
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
800
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
801
+ last_arg = args.pop if args.last.is_a?(Hash)
802
+ last_arg = args.pop if args.last.is_a?(Array)
803
+ last_arg ||= {}
804
+
805
+ # Look for a kwarg called :request_only, whose presence indicates
806
+ # that we want the request itself back, not the response body
807
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
808
+ request_only = true
809
+ last_arg.delete(:request_only)
810
+ end
811
+
812
+ params = last_arg
813
+ body ||= {}
814
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
815
+ request_only ? request : request.response.body
816
+ end
817
+
818
+ # Adds a tag to a word
819
+ #
820
+ def add_tag_to_word(word, *args)
821
+ http_method = :post
822
+ path = '/word/{word}/tag'
823
+ path.sub!('{word}', word.to_s)
824
+
825
+ # Ruby turns all key-value arguments at the end into a single hash
826
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
827
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
828
+ last_arg = args.pop if args.last.is_a?(Hash)
829
+ last_arg = args.pop if args.last.is_a?(Array)
830
+ last_arg ||= {}
831
+
832
+ # Look for a kwarg called :request_only, whose presence indicates
833
+ # that we want the request itself back, not the response body
834
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
835
+ request_only = true
836
+ last_arg.delete(:request_only)
837
+ end
838
+
839
+ params = last_arg
840
+ body ||= {}
841
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
842
+ request_only ? request : request.response.body
843
+ end
844
+
845
+ # Removes a tag from a word
846
+ #
847
+ def delete_tag_from_word(word, *args)
848
+ http_method = :delete
849
+ path = '/word/{word}/tag'
850
+ path.sub!('{word}', word.to_s)
851
+
852
+ # Ruby turns all key-value arguments at the end into a single hash
853
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
854
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
855
+ last_arg = args.pop if args.last.is_a?(Hash)
856
+ last_arg = args.pop if args.last.is_a?(Array)
857
+ last_arg ||= {}
858
+
859
+ # Look for a kwarg called :request_only, whose presence indicates
860
+ # that we want the request itself back, not the response body
861
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
862
+ request_only = true
863
+ last_arg.delete(:request_only)
864
+ end
865
+
866
+ params = last_arg
867
+ body ||= {}
868
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
869
+ request_only ? request : request.response.body
870
+ end
871
+
872
+ # Returns word usage over time
873
+ #
874
+ def get_word_frequency(word, *args)
875
+ http_method = :get
876
+ path = '/word/{word}/frequency'
877
+ path.sub!('{word}', word.to_s)
878
+
879
+ # Ruby turns all key-value arguments at the end into a single hash
880
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
881
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
882
+ last_arg = args.pop if args.last.is_a?(Hash)
883
+ last_arg = args.pop if args.last.is_a?(Array)
884
+ last_arg ||= {}
885
+
886
+ # Look for a kwarg called :request_only, whose presence indicates
887
+ # that we want the request itself back, not the response body
888
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
889
+ request_only = true
890
+ last_arg.delete(:request_only)
891
+ end
892
+
893
+ params = last_arg
894
+ body ||= {}
895
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
896
+ request_only ? request : request.response.body
897
+ end
898
+
899
+ # Returns first usage of a word
900
+ #
901
+ def get_first_usage_of_word(word, *args)
902
+ http_method = :get
903
+ path = '/word/{word}/firstUsed'
904
+ path.sub!('{word}', word.to_s)
905
+
906
+ # Ruby turns all key-value arguments at the end into a single hash
907
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
908
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
909
+ last_arg = args.pop if args.last.is_a?(Hash)
910
+ last_arg = args.pop if args.last.is_a?(Array)
911
+ last_arg ||= {}
912
+
913
+ # Look for a kwarg called :request_only, whose presence indicates
914
+ # that we want the request itself back, not the response body
915
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
916
+ request_only = true
917
+ last_arg.delete(:request_only)
918
+ end
919
+
920
+ params = last_arg
921
+ body ||= {}
922
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
923
+ request_only ? request : request.response.body
924
+ end
925
+
926
+ # Records a word view from the website
927
+ #
928
+ def add_word_view(word, *args)
929
+ http_method = :post
930
+ path = '/word/{word}/wordView'
931
+ path.sub!('{word}', word.to_s)
932
+
933
+ # Ruby turns all key-value arguments at the end into a single hash
934
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
935
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
936
+ last_arg = args.pop if args.last.is_a?(Hash)
937
+ last_arg = args.pop if args.last.is_a?(Array)
938
+ last_arg ||= {}
939
+
940
+ # Look for a kwarg called :request_only, whose presence indicates
941
+ # that we want the request itself back, not the response body
942
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
943
+ request_only = true
944
+ last_arg.delete(:request_only)
945
+ end
946
+
947
+ params = last_arg
948
+ body ||= {}
949
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
950
+ request_only ? request : request.response.body
951
+ end
952
+
953
+ # Checks to see if a word is a user's favorite
954
+ #
955
+ def is_favorite(word, *args)
956
+ http_method = :get
957
+ path = '/word/{word}/isFavorite'
958
+ path.sub!('{word}', word.to_s)
959
+
960
+ # Ruby turns all key-value arguments at the end into a single hash
961
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
962
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
963
+ last_arg = args.pop if args.last.is_a?(Hash)
964
+ last_arg = args.pop if args.last.is_a?(Array)
965
+ last_arg ||= {}
966
+
967
+ # Look for a kwarg called :request_only, whose presence indicates
968
+ # that we want the request itself back, not the response body
969
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
970
+ request_only = true
971
+ last_arg.delete(:request_only)
972
+ end
973
+
974
+ params = last_arg
975
+ body ||= {}
976
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
977
+ request_only ? request : request.response.body
978
+ end
979
+
980
+ # Returns the number of times a word has been Favorited
981
+ #
982
+ def get_favorite_count(word, *args)
983
+ http_method = :get
984
+ path = '/word/{word}/favoriteCount'
985
+ path.sub!('{word}', word.to_s)
986
+
987
+ # Ruby turns all key-value arguments at the end into a single hash
988
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
989
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
990
+ last_arg = args.pop if args.last.is_a?(Hash)
991
+ last_arg = args.pop if args.last.is_a?(Array)
992
+ last_arg ||= {}
993
+
994
+ # Look for a kwarg called :request_only, whose presence indicates
995
+ # that we want the request itself back, not the response body
996
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
997
+ request_only = true
998
+ last_arg.delete(:request_only)
999
+ end
1000
+
1001
+ params = last_arg
1002
+ body ||= {}
1003
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1004
+ request_only ? request : request.response.body
1005
+ end
1006
+
1007
+ # Favorites a Word for a user
1008
+ #
1009
+ def add_word_to_favorites(word, *args)
1010
+ http_method = :post
1011
+ path = '/word/{word}/favorite'
1012
+ path.sub!('{word}', word.to_s)
1013
+
1014
+ # Ruby turns all key-value arguments at the end into a single hash
1015
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1016
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1017
+ last_arg = args.pop if args.last.is_a?(Hash)
1018
+ last_arg = args.pop if args.last.is_a?(Array)
1019
+ last_arg ||= {}
1020
+
1021
+ # Look for a kwarg called :request_only, whose presence indicates
1022
+ # that we want the request itself back, not the response body
1023
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1024
+ request_only = true
1025
+ last_arg.delete(:request_only)
1026
+ end
1027
+
1028
+ params = last_arg
1029
+ body ||= {}
1030
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1031
+ request_only ? request : request.response.body
1032
+ end
1033
+
1034
+ # Removes a Word from a user's Favorites
1035
+ #
1036
+ def delete_from_favorites(word, *args)
1037
+ http_method = :delete
1038
+ path = '/word/{word}/favorite'
1039
+ path.sub!('{word}', word.to_s)
1040
+
1041
+ # Ruby turns all key-value arguments at the end into a single hash
1042
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1043
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1044
+ last_arg = args.pop if args.last.is_a?(Hash)
1045
+ last_arg = args.pop if args.last.is_a?(Array)
1046
+ last_arg ||= {}
1047
+
1048
+ # Look for a kwarg called :request_only, whose presence indicates
1049
+ # that we want the request itself back, not the response body
1050
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1051
+ request_only = true
1052
+ last_arg.delete(:request_only)
1053
+ end
1054
+
1055
+ params = last_arg
1056
+ body ||= {}
1057
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1058
+ request_only ? request : request.response.body
1059
+ end
1060
+
1061
+ # Fetches bi-gram phrases for a word
1062
+ #
1063
+ def get_phrases(word, *args)
1064
+ http_method = :get
1065
+ path = '/word/{word}/phrases'
1066
+ path.sub!('{word}', word.to_s)
1067
+
1068
+ # Ruby turns all key-value arguments at the end into a single hash
1069
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1070
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1071
+ last_arg = args.pop if args.last.is_a?(Hash)
1072
+ last_arg = args.pop if args.last.is_a?(Array)
1073
+ last_arg ||= {}
1074
+
1075
+ # Look for a kwarg called :request_only, whose presence indicates
1076
+ # that we want the request itself back, not the response body
1077
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1078
+ request_only = true
1079
+ last_arg.delete(:request_only)
1080
+ end
1081
+
1082
+ params = last_arg
1083
+ body ||= {}
1084
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1085
+ request_only ? request : request.response.body
1086
+ end
1087
+
1088
+ # Fetches etymology data
1089
+ #
1090
+ def get_etymologies(word, *args)
1091
+ http_method = :get
1092
+ path = '/word/{word}/etymologies'
1093
+ path.sub!('{word}', word.to_s)
1094
+
1095
+ # Ruby turns all key-value arguments at the end into a single hash
1096
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1097
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1098
+ last_arg = args.pop if args.last.is_a?(Hash)
1099
+ last_arg = args.pop if args.last.is_a?(Array)
1100
+ last_arg ||= {}
1101
+
1102
+ # Look for a kwarg called :request_only, whose presence indicates
1103
+ # that we want the request itself back, not the response body
1104
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1105
+ request_only = true
1106
+ last_arg.delete(:request_only)
1107
+ end
1108
+
1109
+ params = last_arg
1110
+ body ||= {}
1111
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1112
+ request_only ? request : request.response.body
1113
+ end
1114
+
1115
+ # Fetches other forms of a word
1116
+ # Deprecated
1117
+ #
1118
+ def get_other_forms_internal(word, *args)
1119
+ http_method = :get
1120
+ path = '/word/{word}/otherFormsInternal'
1121
+ path.sub!('{word}', word.to_s)
1122
+
1123
+ # Ruby turns all key-value arguments at the end into a single hash
1124
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1125
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1126
+ last_arg = args.pop if args.last.is_a?(Hash)
1127
+ last_arg = args.pop if args.last.is_a?(Array)
1128
+ last_arg ||= {}
1129
+
1130
+ # Look for a kwarg called :request_only, whose presence indicates
1131
+ # that we want the request itself back, not the response body
1132
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1133
+ request_only = true
1134
+ last_arg.delete(:request_only)
1135
+ end
1136
+
1137
+ params = last_arg
1138
+ body ||= {}
1139
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1140
+ request_only ? request : request.response.body
1141
+ end
1142
+
1143
+ # Adds a word relationship
1144
+ # Deprecated
1145
+ #
1146
+ def add_word_relationship_internal(word, body, *args)
1147
+ http_method = :post
1148
+ path = '/word/{word}/wordRelationshipInternal'
1149
+ path.sub!('{word}', word.to_s)
1150
+
1151
+ # Ruby turns all key-value arguments at the end into a single hash
1152
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1153
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1154
+ last_arg = args.pop if args.last.is_a?(Hash)
1155
+ last_arg = args.pop if args.last.is_a?(Array)
1156
+ last_arg ||= {}
1157
+
1158
+ # Look for a kwarg called :request_only, whose presence indicates
1159
+ # that we want the request itself back, not the response body
1160
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1161
+ request_only = true
1162
+ last_arg.delete(:request_only)
1163
+ end
1164
+
1165
+ params = last_arg
1166
+ body ||= {}
1167
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1168
+ request_only ? request : request.response.body
1169
+ end
1170
+
1171
+ # Fetches comments on a Word
1172
+ #
1173
+ def get_comments_on_word(word, *args)
1174
+ http_method = :get
1175
+ path = '/word/{word}/comments'
1176
+ path.sub!('{word}', word.to_s)
1177
+
1178
+ # Ruby turns all key-value arguments at the end into a single hash
1179
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1180
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1181
+ last_arg = args.pop if args.last.is_a?(Hash)
1182
+ last_arg = args.pop if args.last.is_a?(Array)
1183
+ last_arg ||= {}
1184
+
1185
+ # Look for a kwarg called :request_only, whose presence indicates
1186
+ # that we want the request itself back, not the response body
1187
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1188
+ request_only = true
1189
+ last_arg.delete(:request_only)
1190
+ end
1191
+
1192
+ params = last_arg
1193
+ body ||= {}
1194
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1195
+ request_only ? request : request.response.body
1196
+ end
1197
+
1198
+ # Fetches a Comment by ID
1199
+ #
1200
+ def delete_comment_on_word(word, commentId, *args)
1201
+ http_method = :get
1202
+ path = '/word/{word}/comment/{commentId}'
1203
+ path.sub!('{word}', word.to_s)
1204
+ path.sub!('{commentId}', commentId.to_s)
1205
+
1206
+ # Ruby turns all key-value arguments at the end into a single hash
1207
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1208
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1209
+ last_arg = args.pop if args.last.is_a?(Hash)
1210
+ last_arg = args.pop if args.last.is_a?(Array)
1211
+ last_arg ||= {}
1212
+
1213
+ # Look for a kwarg called :request_only, whose presence indicates
1214
+ # that we want the request itself back, not the response body
1215
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1216
+ request_only = true
1217
+ last_arg.delete(:request_only)
1218
+ end
1219
+
1220
+ params = last_arg
1221
+ body ||= {}
1222
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1223
+ request_only ? request : request.response.body
1224
+ end
1225
+
1226
+ # Deletes an existing word comment
1227
+ #
1228
+ def delete_comment_by_id_on_word(word, commentId, *args)
1229
+ http_method = :delete
1230
+ path = '/word/{word}/comment/{commentId}'
1231
+ path.sub!('{word}', word.to_s)
1232
+ path.sub!('{commentId}', commentId.to_s)
1233
+
1234
+ # Ruby turns all key-value arguments at the end into a single hash
1235
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1236
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1237
+ last_arg = args.pop if args.last.is_a?(Hash)
1238
+ last_arg = args.pop if args.last.is_a?(Array)
1239
+ last_arg ||= {}
1240
+
1241
+ # Look for a kwarg called :request_only, whose presence indicates
1242
+ # that we want the request itself back, not the response body
1243
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1244
+ request_only = true
1245
+ last_arg.delete(:request_only)
1246
+ end
1247
+
1248
+ params = last_arg
1249
+ body ||= {}
1250
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1251
+ request_only ? request : request.response.body
1252
+ end
1253
+
1254
+ # Adds a comment to a word
1255
+ #
1256
+ def comment_on_word(word, body, *args)
1257
+ http_method = :post
1258
+ path = '/word/{word}/comment'
1259
+ path.sub!('{word}', word.to_s)
1260
+
1261
+ # Ruby turns all key-value arguments at the end into a single hash
1262
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1263
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1264
+ last_arg = args.pop if args.last.is_a?(Hash)
1265
+ last_arg = args.pop if args.last.is_a?(Array)
1266
+ last_arg ||= {}
1267
+
1268
+ # Look for a kwarg called :request_only, whose presence indicates
1269
+ # that we want the request itself back, not the response body
1270
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1271
+ request_only = true
1272
+ last_arg.delete(:request_only)
1273
+ end
1274
+
1275
+ params = last_arg
1276
+ body ||= {}
1277
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1278
+ request_only ? request : request.response.body
1279
+ end
1280
+
1281
+ # Updates an existing word comment
1282
+ #
1283
+ def update_comment_on_word(word, body, *args)
1284
+ http_method = :put
1285
+ path = '/word/{word}/comment'
1286
+ path.sub!('{word}', word.to_s)
1287
+
1288
+ # Ruby turns all key-value arguments at the end into a single hash
1289
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1290
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1291
+ last_arg = args.pop if args.last.is_a?(Hash)
1292
+ last_arg = args.pop if args.last.is_a?(Array)
1293
+ last_arg ||= {}
1294
+
1295
+ # Look for a kwarg called :request_only, whose presence indicates
1296
+ # that we want the request itself back, not the response body
1297
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1298
+ request_only = true
1299
+ last_arg.delete(:request_only)
1300
+ end
1301
+
1302
+ params = last_arg
1303
+ body ||= {}
1304
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1305
+ request_only ? request : request.response.body
1306
+ end
1307
+
1308
+ # Fetches audio metadata for a word.
1309
+ # 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.
1310
+ #
1311
+ def get_audio(word, *args)
1312
+ http_method = :get
1313
+ path = '/word/{word}/audio'
1314
+ path.sub!('{word}', word.to_s)
1315
+
1316
+ # Ruby turns all key-value arguments at the end into a single hash
1317
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1318
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1319
+ last_arg = args.pop if args.last.is_a?(Hash)
1320
+ last_arg = args.pop if args.last.is_a?(Array)
1321
+ last_arg ||= {}
1322
+
1323
+ # Look for a kwarg called :request_only, whose presence indicates
1324
+ # that we want the request itself back, not the response body
1325
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1326
+ request_only = true
1327
+ last_arg.delete(:request_only)
1328
+ end
1329
+
1330
+ params = last_arg
1331
+ body ||= {}
1332
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1333
+ request_only ? request : request.response.body
1334
+ end
1335
+
1336
+ # Creates AudioPron metadata
1337
+ #
1338
+ def add_audio(word, body, *args)
1339
+ http_method = :post
1340
+ path = '/word/{word}/audio'
1341
+ path.sub!('{word}', word.to_s)
1342
+
1343
+ # Ruby turns all key-value arguments at the end into a single hash
1344
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1345
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1346
+ last_arg = args.pop if args.last.is_a?(Hash)
1347
+ last_arg = args.pop if args.last.is_a?(Array)
1348
+ last_arg ||= {}
1349
+
1350
+ # Look for a kwarg called :request_only, whose presence indicates
1351
+ # that we want the request itself back, not the response body
1352
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1353
+ request_only = true
1354
+ last_arg.delete(:request_only)
1355
+ end
1356
+
1357
+ params = last_arg
1358
+ body ||= {}
1359
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1360
+ request_only ? request : request.response.body
1361
+ end
1362
+
1363
+ # Deletes an AudioPron
1364
+ #
1365
+ def delete_audio(word, audio_id, *args)
1366
+ http_method = :delete
1367
+ path = '/word/{word}/audio/{audio_id}'
1368
+ path.sub!('{word}', word.to_s)
1369
+ path.sub!('{audio_id}', audio_id.to_s)
1370
+
1371
+ # Ruby turns all key-value arguments at the end into a single hash
1372
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
1373
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
1374
+ last_arg = args.pop if args.last.is_a?(Hash)
1375
+ last_arg = args.pop if args.last.is_a?(Array)
1376
+ last_arg ||= {}
1377
+
1378
+ # Look for a kwarg called :request_only, whose presence indicates
1379
+ # that we want the request itself back, not the response body
1380
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
1381
+ request_only = true
1382
+ last_arg.delete(:request_only)
1383
+ end
1384
+
1385
+ params = last_arg
1386
+ body ||= {}
1387
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
1388
+ request_only ? request : request.response.body
1389
+ end
1390
+
1391
+ end