Module: WordsMethods
- Defined in:
- lib/wordnik/resource_modules/words.rb
Overview
HEY HACKER! THIS IS AN AUTO-GENERATED FILE. So don’t bother editing it. To see how it’s built, take a look at the Rakefile
Instance Method Summary collapse
-
#get_examples_for_words(body, *args) ⇒ Object
Fetches examples for multiple words.
-
#get_frequency(*args) ⇒ Object
Fetches corpus-level word frequency.
-
#get_random_word(*args) ⇒ Object
Returns a single random WordObject.
-
#get_random_words(*args) ⇒ Object
Returns an array of random WordObjects.
-
#get_recent_word_of_the_day_lists(*args) ⇒ Object
Fetches recently created WordOfTheDayLists.
-
#get_surface_forms(*args) ⇒ Object
Fetches surface forms of a word.
-
#get_word_of_the_day(*args) ⇒ Object
Returns a specific WordOfTheDay.
-
#get_word_of_the_day_list(permalink, *args) ⇒ Object
Fetches a WordOfTheDayList by ID.
-
#get_word_of_the_day_list_item(permalink, specifier, *args) ⇒ Object
Fetches a WordOfTheDayList by ID.
-
#get_word_of_the_day_list_subscription_process_status(*args) ⇒ Object
Returns whether or not a subscription process has been run.
-
#get_word_of_the_day_lists_containing_word(*args) ⇒ Object
Fetches an array of WordOfTheDayList basd on a criteria.
-
#get_word_of_the_day_lists_for_date(date, *args) ⇒ Object
Fetches WordOfTheDay objects for a specific date.
-
#get_word_of_the_day_range(*args) ⇒ Object
Returns a WordOfTheDay range.
-
#get_words_most_commented_on(statsType, object, *args) ⇒ Object
Fetches words most commented on.
-
#invite_to_word_of_the_day_list(permalink, body, *args) ⇒ Object
Invites users to a WordOfTheDayList A user can invite up to 20 people in a single day.
-
#search_definitions(*args) ⇒ Object
Searches definitions.
-
#search_words(*args) ⇒ Object
Searches words.
-
#search_words_new(query, *args) ⇒ Object
Searches words.
-
#subscribe_to_list(permalink, body, *args) ⇒ Object
Subscribes a user to a WordOfTheDayList.
Instance Method Details
#get_examples_for_words(body, *args) ⇒ Object
Fetches examples for multiple words.
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 |
# File 'lib/wordnik/resource_modules/words.rb', line 270 def get_examples_for_words(body, *args) http_method = :post path = '/words/examples' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_frequency(*args) ⇒ Object
Fetches corpus-level word frequency
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 |
# File 'lib/wordnik/resource_modules/words.rb', line 113 def get_frequency(*args) http_method = :get path = '/words/frequency' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_random_word(*args) ⇒ Object
Returns a single random WordObject
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'lib/wordnik/resource_modules/words.rb', line 244 def get_random_word(*args) http_method = :get path = '/words/randomWord' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_random_words(*args) ⇒ Object
Returns an array of random WordObjects
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/wordnik/resource_modules/words.rb', line 218 def get_random_words(*args) http_method = :get path = '/words/randomWords' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_recent_word_of_the_day_lists(*args) ⇒ Object
Fetches recently created WordOfTheDayLists
380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 |
# File 'lib/wordnik/resource_modules/words.rb', line 380 def get_recent_word_of_the_day_lists(*args) http_method = :get path = '/words/wordOfTheDayLists/recent' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_surface_forms(*args) ⇒ Object
Fetches surface forms of a word
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/wordnik/resource_modules/words.rb', line 139 def get_surface_forms(*args) http_method = :get path = '/words/surfaceForms' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_word_of_the_day(*args) ⇒ Object
Returns a specific WordOfTheDay
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/wordnik/resource_modules/words.rb', line 61 def get_word_of_the_day(*args) http_method = :get path = '/words/wordOfTheDay' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_word_of_the_day_list(permalink, *args) ⇒ Object
Fetches a WordOfTheDayList by ID
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/wordnik/resource_modules/words.rb', line 34 def get_word_of_the_day_list(permalink, *args) http_method = :get path = '/words/wordOfTheDayList/{permalink}' path.sub!('{permalink}', permalink.to_s) # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_word_of_the_day_list_item(permalink, specifier, *args) ⇒ Object
Fetches a WordOfTheDayList by ID
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
# File 'lib/wordnik/resource_modules/words.rb', line 406 def get_word_of_the_day_list_item(permalink, specifier, *args) http_method = :get path = '/words/wordOfTheDayList/{permalink}/{specifier}' path.sub!('{permalink}', permalink.to_s) path.sub!('{specifier}', specifier.to_s) # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_word_of_the_day_list_subscription_process_status(*args) ⇒ Object
Returns whether or not a subscription process has been run. Uses the current server time (day resolution) as the default date to check for, optionally a dateString can be supplied for a specific date to check for.
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 |
# File 'lib/wordnik/resource_modules/words.rb', line 461 def get_word_of_the_day_list_subscription_process_status(*args) http_method = :get path = '/words/wordOfTheDayLists/subscriptionProcess' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_word_of_the_day_lists_containing_word(*args) ⇒ Object
Fetches an array of WordOfTheDayList basd on a criteria
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 |
# File 'lib/wordnik/resource_modules/words.rb', line 434 def get_word_of_the_day_lists_containing_word(*args) http_method = :get path = '/words/wordOfTheDayLists' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_word_of_the_day_lists_for_date(date, *args) ⇒ Object
Fetches WordOfTheDay objects for a specific date
514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 |
# File 'lib/wordnik/resource_modules/words.rb', line 514 def get_word_of_the_day_lists_for_date(date, *args) http_method = :get path = '/words/wordOfTheDayLists/{date}' path.sub!('{date}', date.to_s) # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_word_of_the_day_range(*args) ⇒ Object
Returns a WordOfTheDay range
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/wordnik/resource_modules/words.rb', line 165 def get_word_of_the_day_range(*args) http_method = :get path = '/words/wordOfTheDay/range' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#get_words_most_commented_on(statsType, object, *args) ⇒ Object
Fetches words most commented on. Set the dayInterval to determine the time frame.
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 |
# File 'lib/wordnik/resource_modules/words.rb', line 297 def get_words_most_commented_on(*args) http_method = :get path = '/words/mostCommentedOn' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#invite_to_word_of_the_day_list(permalink, body, *args) ⇒ Object
Invites users to a WordOfTheDayList A user can invite up to 20 people in a single day. The users being invited will be checked to see if they have opted out of email communications
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/wordnik/resource_modules/words.rb', line 353 def invite_to_word_of_the_day_list(permalink, body, *args) http_method = :post path = '/words/wordOfTheDayList/{permalink}/invite' path.sub!('{permalink}', permalink.to_s) # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#search_definitions(*args) ⇒ Object
Searches definitions.
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/wordnik/resource_modules/words.rb', line 87 def search_definitions(*args) http_method = :get path = '/words/searchDefinitions' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#search_words(*args) ⇒ Object
Searches words.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/wordnik/resource_modules/words.rb', line 8 def search_words(*args) http_method = :get path = '/words/search' # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#search_words_new(query, *args) ⇒ Object
Searches words.
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/wordnik/resource_modules/words.rb', line 191 def search_words_new(query, *args) http_method = :get path = '/words/search/{query}' path.sub!('{query}', query.to_s) # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |
#subscribe_to_list(permalink, body, *args) ⇒ Object
Subscribes a user to a WordOfTheDayList
487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 |
# File 'lib/wordnik/resource_modules/words.rb', line 487 def subscribe_to_list(permalink, body, *args) http_method = :post path = '/words/wordOfTheDayList/{permalink}/subscription' path.sub!('{permalink}', permalink.to_s) # Ruby turns all key-value arguments at the end into a single hash # e.g. Wordnik.word.get_examples('dingo', :limit => 10, :part_of_speech => 'verb') # becomes {:limit => 10, :part_of_speech => 'verb'} last_arg = args.pop if args.last.is_a?(Hash) last_arg = args.pop if args.last.is_a?(Array) last_arg ||= {} # Look for a kwarg called :request_only, whose presence indicates # that we want the request itself back, not the response body if last_arg.is_a?(Hash) && last_arg[:request_only].present? request_only = true last_arg.delete(:request_only) end params = last_arg body ||= {} request = Wordnik::Request.new(http_method, path, :params => params, :body => body) request_only ? request : request.response.body end |