wordnik 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,438 @@
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
+ # Given a word as a string, returns the WordObject that represents it
7
+ #
8
+ def get_word(word, *args)
9
+ http_method = :get
10
+ path = '/word/{word}'
11
+ path.sub!('{word}', word)
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
+ if [:post, :put].include?(http_method)
28
+ params = nil
29
+ body = last_arg
30
+ else
31
+ params = last_arg
32
+ body = nil
33
+ end
34
+
35
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
36
+ request_only ? request : request.response.body
37
+ end
38
+
39
+ # Returns examples for a word
40
+ #
41
+ def get_examples(word, *args)
42
+ http_method = :get
43
+ path = '/word/{word}/examples'
44
+ path.sub!('{word}', word)
45
+
46
+ # Ruby turns all key-value arguments at the end into a single hash
47
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
48
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
49
+ last_arg = args.pop if args.last.is_a?(Hash)
50
+ last_arg = args.pop if args.last.is_a?(Array)
51
+ last_arg ||= {}
52
+
53
+ # Look for a kwarg called :request_only, whose presence indicates
54
+ # that we want the request itself back, not the response body
55
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
56
+ request_only = true
57
+ last_arg.delete(:request_only)
58
+ end
59
+
60
+ if [:post, :put].include?(http_method)
61
+ params = nil
62
+ body = last_arg
63
+ else
64
+ params = last_arg
65
+ body = nil
66
+ end
67
+
68
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
69
+ request_only ? request : request.response.body
70
+ end
71
+
72
+ # Return definitions for a word
73
+ #
74
+ def get_definitions(word, *args)
75
+ http_method = :get
76
+ path = '/word/{word}/definitions'
77
+ path.sub!('{word}', word)
78
+
79
+ # Ruby turns all key-value arguments at the end into a single hash
80
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
81
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
82
+ last_arg = args.pop if args.last.is_a?(Hash)
83
+ last_arg = args.pop if args.last.is_a?(Array)
84
+ last_arg ||= {}
85
+
86
+ # Look for a kwarg called :request_only, whose presence indicates
87
+ # that we want the request itself back, not the response body
88
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
89
+ request_only = true
90
+ last_arg.delete(:request_only)
91
+ end
92
+
93
+ if [:post, :put].include?(http_method)
94
+ params = nil
95
+ body = last_arg
96
+ else
97
+ params = last_arg
98
+ body = nil
99
+ end
100
+
101
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
102
+ request_only ? request : request.response.body
103
+ end
104
+
105
+ # Returns word usage over time
106
+ #
107
+ def get_word_frequency(word, *args)
108
+ http_method = :get
109
+ path = '/word/{word}/frequency'
110
+ path.sub!('{word}', word)
111
+
112
+ # Ruby turns all key-value arguments at the end into a single hash
113
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
114
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
115
+ last_arg = args.pop if args.last.is_a?(Hash)
116
+ last_arg = args.pop if args.last.is_a?(Array)
117
+ last_arg ||= {}
118
+
119
+ # Look for a kwarg called :request_only, whose presence indicates
120
+ # that we want the request itself back, not the response body
121
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
122
+ request_only = true
123
+ last_arg.delete(:request_only)
124
+ end
125
+
126
+ if [:post, :put].include?(http_method)
127
+ params = nil
128
+ body = last_arg
129
+ else
130
+ params = last_arg
131
+ body = nil
132
+ end
133
+
134
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
135
+ request_only ? request : request.response.body
136
+ end
137
+
138
+ # Returns a top example for a word
139
+ #
140
+ def get_top_example(word, *args)
141
+ http_method = :get
142
+ path = '/word/{word}/topExample'
143
+ path.sub!('{word}', word)
144
+
145
+ # Ruby turns all key-value arguments at the end into a single hash
146
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
147
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
148
+ last_arg = args.pop if args.last.is_a?(Hash)
149
+ last_arg = args.pop if args.last.is_a?(Array)
150
+ last_arg ||= {}
151
+
152
+ # Look for a kwarg called :request_only, whose presence indicates
153
+ # that we want the request itself back, not the response body
154
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
155
+ request_only = true
156
+ last_arg.delete(:request_only)
157
+ end
158
+
159
+ if [:post, :put].include?(http_method)
160
+ params = nil
161
+ body = last_arg
162
+ else
163
+ params = last_arg
164
+ body = nil
165
+ end
166
+
167
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
168
+ request_only ? request : request.response.body
169
+ end
170
+
171
+ # Return related words (thesaurus data) for a word
172
+ #
173
+ def get_related_words(word, *args)
174
+ http_method = :get
175
+ path = '/word/{word}/related'
176
+ path.sub!('{word}', word)
177
+
178
+ # Ruby turns all key-value arguments at the end into a single hash
179
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
180
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
181
+ last_arg = args.pop if args.last.is_a?(Hash)
182
+ last_arg = args.pop if args.last.is_a?(Array)
183
+ last_arg ||= {}
184
+
185
+ # Look for a kwarg called :request_only, whose presence indicates
186
+ # that we want the request itself back, not the response body
187
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
188
+ request_only = true
189
+ last_arg.delete(:request_only)
190
+ end
191
+
192
+ if [:post, :put].include?(http_method)
193
+ params = nil
194
+ body = last_arg
195
+ else
196
+ params = last_arg
197
+ body = nil
198
+ end
199
+
200
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
201
+ request_only ? request : request.response.body
202
+ end
203
+
204
+ # Fetches bi-gram phrases for a word
205
+ #
206
+ def get_phrases(word, *args)
207
+ http_method = :get
208
+ path = '/word/{word}/phrases'
209
+ path.sub!('{word}', word)
210
+
211
+ # Ruby turns all key-value arguments at the end into a single hash
212
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
213
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
214
+ last_arg = args.pop if args.last.is_a?(Hash)
215
+ last_arg = args.pop if args.last.is_a?(Array)
216
+ last_arg ||= {}
217
+
218
+ # Look for a kwarg called :request_only, whose presence indicates
219
+ # that we want the request itself back, not the response body
220
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
221
+ request_only = true
222
+ last_arg.delete(:request_only)
223
+ end
224
+
225
+ if [:post, :put].include?(http_method)
226
+ params = nil
227
+ body = last_arg
228
+ else
229
+ params = last_arg
230
+ body = nil
231
+ end
232
+
233
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
234
+ request_only ? request : request.response.body
235
+ end
236
+
237
+ # Returns syllable information for a word
238
+ #
239
+ def get_hyphenation(word, *args)
240
+ http_method = :get
241
+ path = '/word/{word}/hyphenation'
242
+ path.sub!('{word}', word)
243
+
244
+ # Ruby turns all key-value arguments at the end into a single hash
245
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
246
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
247
+ last_arg = args.pop if args.last.is_a?(Hash)
248
+ last_arg = args.pop if args.last.is_a?(Array)
249
+ last_arg ||= {}
250
+
251
+ # Look for a kwarg called :request_only, whose presence indicates
252
+ # that we want the request itself back, not the response body
253
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
254
+ request_only = true
255
+ last_arg.delete(:request_only)
256
+ end
257
+
258
+ if [:post, :put].include?(http_method)
259
+ params = nil
260
+ body = last_arg
261
+ else
262
+ params = last_arg
263
+ body = nil
264
+ end
265
+
266
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
267
+ request_only ? request : request.response.body
268
+ end
269
+
270
+ # Returns text pronunciations for a given word
271
+ #
272
+ def get_text_pronunciations(word, *args)
273
+ http_method = :get
274
+ path = '/word/{word}/pronunciations'
275
+ path.sub!('{word}', word)
276
+
277
+ # Ruby turns all key-value arguments at the end into a single hash
278
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
279
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
280
+ last_arg = args.pop if args.last.is_a?(Hash)
281
+ last_arg = args.pop if args.last.is_a?(Array)
282
+ last_arg ||= {}
283
+
284
+ # Look for a kwarg called :request_only, whose presence indicates
285
+ # that we want the request itself back, not the response body
286
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
287
+ request_only = true
288
+ last_arg.delete(:request_only)
289
+ end
290
+
291
+ if [:post, :put].include?(http_method)
292
+ params = nil
293
+ body = last_arg
294
+ else
295
+ params = last_arg
296
+ body = nil
297
+ end
298
+
299
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
300
+ request_only ? request : request.response.body
301
+ end
302
+
303
+ # Returns other forms of a word
304
+ #
305
+ def get_word_forms(word, *args)
306
+ http_method = :get
307
+ path = '/word/{word}/wordForms'
308
+ path.sub!('{word}', word)
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
+ if [:post, :put].include?(http_method)
325
+ params = nil
326
+ body = last_arg
327
+ else
328
+ params = last_arg
329
+ body = nil
330
+ end
331
+
332
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
333
+ request_only ? request : request.response.body
334
+ end
335
+
336
+ # Fetches audio metadata for a word.
337
+ # 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.
338
+ #
339
+ def get_audio(word, *args)
340
+ http_method = :get
341
+ path = '/word/{word}/audio'
342
+ path.sub!('{word}', word)
343
+
344
+ # Ruby turns all key-value arguments at the end into a single hash
345
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
346
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
347
+ last_arg = args.pop if args.last.is_a?(Hash)
348
+ last_arg = args.pop if args.last.is_a?(Array)
349
+ last_arg ||= {}
350
+
351
+ # Look for a kwarg called :request_only, whose presence indicates
352
+ # that we want the request itself back, not the response body
353
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
354
+ request_only = true
355
+ last_arg.delete(:request_only)
356
+ end
357
+
358
+ if [:post, :put].include?(http_method)
359
+ params = nil
360
+ body = last_arg
361
+ else
362
+ params = last_arg
363
+ body = nil
364
+ end
365
+
366
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
367
+ request_only ? request : request.response.body
368
+ end
369
+
370
+ # Returns definitions for a word based on the sentence in which it is found
371
+ # Use the offset parameter when the word occurs more than once in the sentence
372
+ #
373
+ def contextual_lookup(word, *args)
374
+ http_method = :get
375
+ path = '/word/{word}/contextualLookup'
376
+ path.sub!('{word}', word)
377
+
378
+ # Ruby turns all key-value arguments at the end into a single hash
379
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
380
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
381
+ last_arg = args.pop if args.last.is_a?(Hash)
382
+ last_arg = args.pop if args.last.is_a?(Array)
383
+ last_arg ||= {}
384
+
385
+ # Look for a kwarg called :request_only, whose presence indicates
386
+ # that we want the request itself back, not the response body
387
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
388
+ request_only = true
389
+ last_arg.delete(:request_only)
390
+ end
391
+
392
+ if [:post, :put].include?(http_method)
393
+ params = nil
394
+ body = last_arg
395
+ else
396
+ params = last_arg
397
+ body = nil
398
+ end
399
+
400
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
401
+ request_only ? request : request.response.body
402
+ end
403
+
404
+ # Returns definitions for a word based on the sentence in which it is found
405
+ # Use the offset parameter when the word occurs more than once in the sentence
406
+ #
407
+ def contextual_lookup_post(word, *args)
408
+ http_method = :post
409
+ path = '/word/{word}/contextualLookup'
410
+ path.sub!('{word}', word)
411
+
412
+ # Ruby turns all key-value arguments at the end into a single hash
413
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
414
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
415
+ last_arg = args.pop if args.last.is_a?(Hash)
416
+ last_arg = args.pop if args.last.is_a?(Array)
417
+ last_arg ||= {}
418
+
419
+ # Look for a kwarg called :request_only, whose presence indicates
420
+ # that we want the request itself back, not the response body
421
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
422
+ request_only = true
423
+ last_arg.delete(:request_only)
424
+ end
425
+
426
+ if [:post, :put].include?(http_method)
427
+ params = nil
428
+ body = last_arg
429
+ else
430
+ params = last_arg
431
+ body = nil
432
+ end
433
+
434
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
435
+ request_only ? request : request.response.body
436
+ end
437
+
438
+ end
@@ -0,0 +1,211 @@
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
+ # Fetches a WordList by ID
7
+ #
8
+ def get_word_list_by_id(wordListId, *args)
9
+ http_method = :get
10
+ path = '/wordList/{wordListId}'
11
+ path.sub!('{wordListId}', wordListId)
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
+ if [:post, :put].include?(http_method)
28
+ params = nil
29
+ body = last_arg
30
+ else
31
+ params = last_arg
32
+ body = nil
33
+ end
34
+
35
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
36
+ request_only ? request : request.response.body
37
+ end
38
+
39
+ # Fetches words in a WordList
40
+ #
41
+ def get_word_list_words(wordListId, *args)
42
+ http_method = :get
43
+ path = '/wordList/{wordListId}/words'
44
+ path.sub!('{wordListId}', wordListId)
45
+
46
+ # Ruby turns all key-value arguments at the end into a single hash
47
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
48
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
49
+ last_arg = args.pop if args.last.is_a?(Hash)
50
+ last_arg = args.pop if args.last.is_a?(Array)
51
+ last_arg ||= {}
52
+
53
+ # Look for a kwarg called :request_only, whose presence indicates
54
+ # that we want the request itself back, not the response body
55
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
56
+ request_only = true
57
+ last_arg.delete(:request_only)
58
+ end
59
+
60
+ if [:post, :put].include?(http_method)
61
+ params = nil
62
+ body = last_arg
63
+ else
64
+ params = last_arg
65
+ body = nil
66
+ end
67
+
68
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
69
+
70
+
71
+ operation = self.operations.find_by_nickname('get_word_list_words')
72
+ response_value_type = operation.response.value_type
73
+
74
+ Massage(response.body)
75
+
76
+
77
+ end
78
+
79
+ # Adds words to a WordList
80
+ #
81
+ def add_words_to_word_list(wordListId, *args)
82
+ http_method = :post
83
+ path = '/wordList/{wordListId}/words'
84
+ path.sub!('{wordListId}', wordListId)
85
+
86
+ # Ruby turns all key-value arguments at the end into a single hash
87
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
88
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
89
+ last_arg = args.pop if args.last.is_a?(Hash)
90
+ last_arg = args.pop if args.last.is_a?(Array)
91
+ last_arg ||= {}
92
+
93
+ # Look for a kwarg called :request_only, whose presence indicates
94
+ # that we want the request itself back, not the response body
95
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
96
+ request_only = true
97
+ last_arg.delete(:request_only)
98
+ end
99
+
100
+ if [:post, :put].include?(http_method)
101
+ params = nil
102
+ body = last_arg
103
+ else
104
+ params = last_arg
105
+ body = nil
106
+ end
107
+
108
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
109
+ request_only ? request : request.response.body
110
+ end
111
+
112
+ # Updates an existing WordList
113
+ #
114
+ def update_word_list(wordListId, *args)
115
+ http_method = :put
116
+ path = '/wordList/{wordListId}'
117
+ path.sub!('{wordListId}', wordListId)
118
+
119
+ # Ruby turns all key-value arguments at the end into a single hash
120
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
121
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
122
+ last_arg = args.pop if args.last.is_a?(Hash)
123
+ last_arg = args.pop if args.last.is_a?(Array)
124
+ last_arg ||= {}
125
+
126
+ # Look for a kwarg called :request_only, whose presence indicates
127
+ # that we want the request itself back, not the response body
128
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
129
+ request_only = true
130
+ last_arg.delete(:request_only)
131
+ end
132
+
133
+ if [:post, :put].include?(http_method)
134
+ params = nil
135
+ body = last_arg
136
+ else
137
+ params = last_arg
138
+ body = nil
139
+ end
140
+
141
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
142
+ request_only ? request : request.response.body
143
+ end
144
+
145
+ # Deletes an existing WordList
146
+ #
147
+ def delete_word_list(wordListId, *args)
148
+ http_method = :delete
149
+ path = '/wordList/{wordListId}'
150
+ path.sub!('{wordListId}', wordListId)
151
+
152
+ # Ruby turns all key-value arguments at the end into a single hash
153
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
154
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
155
+ last_arg = args.pop if args.last.is_a?(Hash)
156
+ last_arg = args.pop if args.last.is_a?(Array)
157
+ last_arg ||= {}
158
+
159
+ # Look for a kwarg called :request_only, whose presence indicates
160
+ # that we want the request itself back, not the response body
161
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
162
+ request_only = true
163
+ last_arg.delete(:request_only)
164
+ end
165
+
166
+ if [:post, :put].include?(http_method)
167
+ params = nil
168
+ body = last_arg
169
+ else
170
+ params = last_arg
171
+ body = nil
172
+ end
173
+
174
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
175
+ request_only ? request : request.response.body
176
+ end
177
+
178
+ # Removes words from a WordList
179
+ #
180
+ def delete_words_from_word_list(wordListId, *args)
181
+ http_method = :post
182
+ path = '/wordList/{wordListId}/deleteWords'
183
+ path.sub!('{wordListId}', wordListId)
184
+
185
+ # Ruby turns all key-value arguments at the end into a single hash
186
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
187
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
188
+ last_arg = args.pop if args.last.is_a?(Hash)
189
+ last_arg = args.pop if args.last.is_a?(Array)
190
+ last_arg ||= {}
191
+
192
+ # Look for a kwarg called :request_only, whose presence indicates
193
+ # that we want the request itself back, not the response body
194
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
195
+ request_only = true
196
+ last_arg.delete(:request_only)
197
+ end
198
+
199
+ if [:post, :put].include?(http_method)
200
+ params = nil
201
+ body = last_arg
202
+ else
203
+ params = last_arg
204
+ body = nil
205
+ end
206
+
207
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
208
+ request_only ? request : request.response.body
209
+ end
210
+
211
+ end