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,167 @@
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 DocumentMethods
5
+
6
+ # Fetches Document objects by Content Provider code.
7
+ #
8
+ def get_word_frequencies(document_id, *args)
9
+ http_method = :get
10
+ path = '/document/id/{document_id}/words'
11
+ path.sub!('{document_id}', document_id.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
+ # Fetches examples for a specific provider matching a criteria.
34
+ #
35
+ def get_glossaries(contentProvider, *args)
36
+ http_method = :get
37
+ path = '/document/{contentProvider}/documents'
38
+ path.sub!('{contentProvider}', contentProvider.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
+ # Returns information about API parameters
61
+ #
62
+ def get_help(*args)
63
+ http_method = :get
64
+ path = '/document'
65
+
66
+ # Ruby turns all key-value arguments at the end into a single hash
67
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
68
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
69
+ last_arg = args.pop if args.last.is_a?(Hash)
70
+ last_arg = args.pop if args.last.is_a?(Array)
71
+ last_arg ||= {}
72
+
73
+ # Look for a kwarg called :request_only, whose presence indicates
74
+ # that we want the request itself back, not the response body
75
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
76
+ request_only = true
77
+ last_arg.delete(:request_only)
78
+ end
79
+
80
+ params = last_arg
81
+ body ||= {}
82
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
83
+ request_only ? request : request.response.body
84
+ end
85
+
86
+ # Fetches Document objects by Content Provider code.
87
+ #
88
+ def get_documents_by_content_provider(provider, *args)
89
+ http_method = :get
90
+ path = '/document/provider/{provider}'
91
+ path.sub!('{provider}', provider.to_s)
92
+
93
+ # Ruby turns all key-value arguments at the end into a single hash
94
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
95
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
96
+ last_arg = args.pop if args.last.is_a?(Hash)
97
+ last_arg = args.pop if args.last.is_a?(Array)
98
+ last_arg ||= {}
99
+
100
+ # Look for a kwarg called :request_only, whose presence indicates
101
+ # that we want the request itself back, not the response body
102
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
103
+ request_only = true
104
+ last_arg.delete(:request_only)
105
+ end
106
+
107
+ params = last_arg
108
+ body ||= {}
109
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
110
+ request_only ? request : request.response.body
111
+ end
112
+
113
+ # Fetches Document objects by document identifier.
114
+ #
115
+ def get_metadata_by_id(id, *args)
116
+ http_method = :get
117
+ path = '/document/{id}/metadata'
118
+ path.sub!('{id}', id.to_s)
119
+
120
+ # Ruby turns all key-value arguments at the end into a single hash
121
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
122
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
123
+ last_arg = args.pop if args.last.is_a?(Hash)
124
+ last_arg = args.pop if args.last.is_a?(Array)
125
+ last_arg ||= {}
126
+
127
+ # Look for a kwarg called :request_only, whose presence indicates
128
+ # that we want the request itself back, not the response body
129
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
130
+ request_only = true
131
+ last_arg.delete(:request_only)
132
+ end
133
+
134
+ params = last_arg
135
+ body ||= {}
136
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
137
+ request_only ? request : request.response.body
138
+ end
139
+
140
+ # Fetches Document objects by id.
141
+ #
142
+ def get_model_by_id(id, *args)
143
+ http_method = :get
144
+ path = '/document/{id}/model'
145
+ path.sub!('{id}', id.to_s)
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
+ end
@@ -0,0 +1,339 @@
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 PartnersMethods
5
+
6
+ # Creates a glossary for the Content Provider.
7
+ #
8
+ def create_glossary(contentProvider, body, *args)
9
+ http_method = :post
10
+ path = '/partners/{contentProvider}/glossaries'
11
+ path.sub!('{contentProvider}', contentProvider.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
+ # Fetches glossaries for the specified Provider.
34
+ #
35
+ def get_glossaries(contentProvider, *args)
36
+ http_method = :get
37
+ path = '/partners/{contentProvider}/glossaries'
38
+ path.sub!('{contentProvider}', contentProvider.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 glossary for the specified Provider.
61
+ #
62
+ def get_glossary(contentProvider, permalinkId, *args)
63
+ http_method = :get
64
+ path = '/partners/{contentProvider}/glossary/{permalinkId}'
65
+ path.sub!('{contentProvider}', contentProvider.to_s)
66
+ path.sub!('{permalinkId}', permalinkId.to_s)
67
+
68
+ # Ruby turns all key-value arguments at the end into a single hash
69
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
70
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
71
+ last_arg = args.pop if args.last.is_a?(Hash)
72
+ last_arg = args.pop if args.last.is_a?(Array)
73
+ last_arg ||= {}
74
+
75
+ # Look for a kwarg called :request_only, whose presence indicates
76
+ # that we want the request itself back, not the response body
77
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
78
+ request_only = true
79
+ last_arg.delete(:request_only)
80
+ end
81
+
82
+ params = last_arg
83
+ body ||= {}
84
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
85
+ request_only ? request : request.response.body
86
+ end
87
+
88
+ # Updates a Glossaryfor the specified Provider.
89
+ #
90
+ def update_glossary(contentProvider, permalinkId, body, *args)
91
+ http_method = :put
92
+ path = '/partners/{contentProvider}/glossary/{permalinkId}'
93
+ path.sub!('{contentProvider}', contentProvider.to_s)
94
+ path.sub!('{permalinkId}', permalinkId.to_s)
95
+
96
+ # Ruby turns all key-value arguments at the end into a single hash
97
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
98
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
99
+ last_arg = args.pop if args.last.is_a?(Hash)
100
+ last_arg = args.pop if args.last.is_a?(Array)
101
+ last_arg ||= {}
102
+
103
+ # Look for a kwarg called :request_only, whose presence indicates
104
+ # that we want the request itself back, not the response body
105
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
106
+ request_only = true
107
+ last_arg.delete(:request_only)
108
+ end
109
+
110
+ params = last_arg
111
+ body ||= {}
112
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
113
+ request_only ? request : request.response.body
114
+ end
115
+
116
+ # Deletes a single Glossary.
117
+ #
118
+ def delete_glossary(contentProvider, permalinkId, *args)
119
+ http_method = :delete
120
+ path = '/partners/{contentProvider}/glossary/{permalinkId}'
121
+ path.sub!('{contentProvider}', contentProvider.to_s)
122
+ path.sub!('{permalinkId}', permalinkId.to_s)
123
+
124
+ # Ruby turns all key-value arguments at the end into a single hash
125
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
126
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
127
+ last_arg = args.pop if args.last.is_a?(Hash)
128
+ last_arg = args.pop if args.last.is_a?(Array)
129
+ last_arg ||= {}
130
+
131
+ # Look for a kwarg called :request_only, whose presence indicates
132
+ # that we want the request itself back, not the response body
133
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
134
+ request_only = true
135
+ last_arg.delete(:request_only)
136
+ end
137
+
138
+ params = last_arg
139
+ body ||= {}
140
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
141
+ request_only ? request : request.response.body
142
+ end
143
+
144
+ # Returns information about API parameters
145
+ #
146
+ def get_help(*args)
147
+ http_method = :get
148
+ path = '/partners'
149
+
150
+ # Ruby turns all key-value arguments at the end into a single hash
151
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
152
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
153
+ last_arg = args.pop if args.last.is_a?(Hash)
154
+ last_arg = args.pop if args.last.is_a?(Array)
155
+ last_arg ||= {}
156
+
157
+ # Look for a kwarg called :request_only, whose presence indicates
158
+ # that we want the request itself back, not the response body
159
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
160
+ request_only = true
161
+ last_arg.delete(:request_only)
162
+ end
163
+
164
+ params = last_arg
165
+ body ||= {}
166
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
167
+ request_only ? request : request.response.body
168
+ end
169
+
170
+ # Fetches GlossaryEntry objects for the specified Glossary.
171
+ #
172
+ def get_glossary_entries(contentProvider, permalinkId, *args)
173
+ http_method = :get
174
+ path = '/partners/{contentProvider}/glossary/{permalinkId}/entries'
175
+ path.sub!('{contentProvider}', contentProvider.to_s)
176
+ path.sub!('{permalinkId}', permalinkId.to_s)
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
+ params = last_arg
193
+ body ||= {}
194
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
195
+ request_only ? request : request.response.body
196
+ end
197
+
198
+ # Adds GlossaryEntry objects for the specified Glossary.
199
+ #
200
+ def add_glossary_entry(contentProvider, permalinkId, body, *args)
201
+ http_method = :post
202
+ path = '/partners/{contentProvider}/glossary/{permalinkId}/entries'
203
+ path.sub!('{contentProvider}', contentProvider.to_s)
204
+ path.sub!('{permalinkId}', permalinkId.to_s)
205
+
206
+ # Ruby turns all key-value arguments at the end into a single hash
207
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
208
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
209
+ last_arg = args.pop if args.last.is_a?(Hash)
210
+ last_arg = args.pop if args.last.is_a?(Array)
211
+ last_arg ||= {}
212
+
213
+ # Look for a kwarg called :request_only, whose presence indicates
214
+ # that we want the request itself back, not the response body
215
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
216
+ request_only = true
217
+ last_arg.delete(:request_only)
218
+ end
219
+
220
+ params = last_arg
221
+ body ||= {}
222
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
223
+ request_only ? request : request.response.body
224
+ end
225
+
226
+ # Publishes a Glossary.
227
+ #
228
+ def publish_glossary(contentProvider, permalinkId, *args)
229
+ http_method = :post
230
+ path = '/partners/{contentProvider}/glossary/{permalinkId}/publish'
231
+ path.sub!('{contentProvider}', contentProvider.to_s)
232
+ path.sub!('{permalinkId}', permalinkId.to_s)
233
+
234
+ # Ruby turns all key-value arguments at the end into a single hash
235
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
236
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
237
+ last_arg = args.pop if args.last.is_a?(Hash)
238
+ last_arg = args.pop if args.last.is_a?(Array)
239
+ last_arg ||= {}
240
+
241
+ # Look for a kwarg called :request_only, whose presence indicates
242
+ # that we want the request itself back, not the response body
243
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
244
+ request_only = true
245
+ last_arg.delete(:request_only)
246
+ end
247
+
248
+ params = last_arg
249
+ body ||= {}
250
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
251
+ request_only ? request : request.response.body
252
+ end
253
+
254
+ # Creates a new version of a Glossary.
255
+ #
256
+ def create_version(contentProvider, permalinkId, *args)
257
+ http_method = :post
258
+ path = '/partners/{contentProvider}/glossary/{permalinkId}/clone'
259
+ path.sub!('{contentProvider}', contentProvider.to_s)
260
+ path.sub!('{permalinkId}', permalinkId.to_s)
261
+
262
+ # Ruby turns all key-value arguments at the end into a single hash
263
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
264
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
265
+ last_arg = args.pop if args.last.is_a?(Hash)
266
+ last_arg = args.pop if args.last.is_a?(Array)
267
+ last_arg ||= {}
268
+
269
+ # Look for a kwarg called :request_only, whose presence indicates
270
+ # that we want the request itself back, not the response body
271
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
272
+ request_only = true
273
+ last_arg.delete(:request_only)
274
+ end
275
+
276
+ params = last_arg
277
+ body ||= {}
278
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
279
+ request_only ? request : request.response.body
280
+ end
281
+
282
+ # Removes a GlossaryEntry object from the specified Glossary.
283
+ #
284
+ def delete_glossary_entry(contentProvider, permalinkId, word, *args)
285
+ http_method = :delete
286
+ path = '/partners/{contentProvider}/glossary/{permalinkId}/entries/{word}'
287
+ path.sub!('{contentProvider}', contentProvider.to_s)
288
+ path.sub!('{permalinkId}', permalinkId.to_s)
289
+ path.sub!('{word}', word.to_s)
290
+
291
+ # Ruby turns all key-value arguments at the end into a single hash
292
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
293
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
294
+ last_arg = args.pop if args.last.is_a?(Hash)
295
+ last_arg = args.pop if args.last.is_a?(Array)
296
+ last_arg ||= {}
297
+
298
+ # Look for a kwarg called :request_only, whose presence indicates
299
+ # that we want the request itself back, not the response body
300
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
301
+ request_only = true
302
+ last_arg.delete(:request_only)
303
+ end
304
+
305
+ params = last_arg
306
+ body ||= {}
307
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
308
+ request_only ? request : request.response.body
309
+ end
310
+
311
+ # Removes a GlossaryEntry object from the specified Glossary.
312
+ #
313
+ def delete_glossary_entries(contentProvider, permalinkId, body, *args)
314
+ http_method = :post
315
+ path = '/partners/{contentProvider}/glossary/{permalinkId}/deleteEntries'
316
+ path.sub!('{contentProvider}', contentProvider.to_s)
317
+ path.sub!('{permalinkId}', permalinkId.to_s)
318
+
319
+ # Ruby turns all key-value arguments at the end into a single hash
320
+ # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb')
321
+ # becomes {:limit => 10, :part_of_speech => 'verb'}
322
+ last_arg = args.pop if args.last.is_a?(Hash)
323
+ last_arg = args.pop if args.last.is_a?(Array)
324
+ last_arg ||= {}
325
+
326
+ # Look for a kwarg called :request_only, whose presence indicates
327
+ # that we want the request itself back, not the response body
328
+ if last_arg.is_a?(Hash) && last_arg[:request_only].present?
329
+ request_only = true
330
+ last_arg.delete(:request_only)
331
+ end
332
+
333
+ params = last_arg
334
+ body ||= {}
335
+ request = Wordnik::Request.new(http_method, path, :params => params, :body => body)
336
+ request_only ? request : request.response.body
337
+ end
338
+
339
+ end