Module: UserMethods
- Defined in:
- lib/wordnik/resource_modules/user.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
-
#add_subscription(user, objectType, objectIdentifier, *args) ⇒ Object
Subscribes to an object.
-
#add_word_to_word_of_the_day_list(username, permalink, body, *args) ⇒ Object
Adds an item to a user’s WordOfTheDayList.
-
#comment_on_user(username, body, *args) ⇒ Object
Adds a Comment on a User.
-
#create_word_of_the_day_list(username, body, *args) ⇒ Object
Creates a WordOfTheDayList A user can have only one WordOfTheDayList.
-
#delete_comment_on_user(username, commentId, *args) ⇒ Object
Deletes a Comment on a User.
-
#delete_user(username, *args) ⇒ Object
Deletes a User.
-
#delete_word_from_word_of_the_day_list(username, permalink, wordToDelete, *args) ⇒ Object
Deletes a specific word from a user’s WordOfTheDayList.
-
#get_api_key_for_user(username, *args) ⇒ Object
Returns the API key for the specified user Use the super user API key for getting this information or auth token of the user who is requesting the API key.
-
#get_comment_on_user_by_id(username, commentId, *args) ⇒ Object
Fetches a comment by ID.
-
#get_comments_by_user(username, *args) ⇒ Object
Returns Comments by a user.
-
#get_comments_by_user_count(username, *args) ⇒ Object
Returns a count of Comments by a user.
-
#get_comments_on_user(username, *args) ⇒ Object
Returns Comments on a user.
-
#get_comments_on_user_count(username, *args) ⇒ Object
Returns a count of Comments on a user.
-
#get_subscriptions(user, *args) ⇒ Object
Fetches all subscriptions for a User.
-
#get_ugc_summary_for_user(username, *args) ⇒ Object
Returns UgcSummary info a user.
-
#get_user(username, *args) ⇒ Object
Fetches a User by username or email address.
-
#get_user_activity_stream(user, *args) ⇒ Object
Fetches the total search count for a User.
-
#get_user_favorite_count(user, *args) ⇒ Object
Fetches favorite word count for a user.
-
#get_user_favorite_word_lists(user, *args) ⇒ Object
Fetches Favorite WordLists for a user.
-
#get_user_favorite_word_lists_count(user, *args) ⇒ Object
Fetches Favorite WordList count for a user.
-
#get_user_favorite_words(user, *args) ⇒ Object
Fetches Favorite Words for a user.
-
#get_user_profile(username, *args) ⇒ Object
Returns a UserProfile.
-
#get_user_pronunciations(user, *args) ⇒ Object
Fetches the total search count for a User.
-
#get_user_search_history(user, *args) ⇒ Object
Fetches SearchHistory for a User.
-
#get_user_search_history_count(user, *args) ⇒ Object
Fetches the total search count for a User.
-
#get_user_settings(username, *args) ⇒ Object
Returns a user’s settings.
-
#get_user_tag_count(user, *args) ⇒ Object
Fetches the count of Tags created by a User.
-
#get_user_tag_history(user, *args) ⇒ Object
Fetches TagHistory for a User.
-
#get_user_tags(user, *args) ⇒ Object
Fetches Tags by a User.
-
#get_user_tracking_info(username, *args) ⇒ Object
Returns a user’s tracking info.
-
#get_user_word_list_count(username, *args) ⇒ Object
Gets the count of WordLists for a User.
-
#get_user_word_lists(username, *args) ⇒ Object
Gets WordLists for a User.
-
#get_word_of_the_day_by_date(username, date, *args) ⇒ Object
Returns the WordOfTheDay for a given user on a given date.
-
#get_word_of_the_day_list(username, *args) ⇒ Object
Returns a user’s WordOfTheDayList.
-
#remove_subscription(user, objectType, objectIdentifier, *args) ⇒ Object
Deletes a subscription to an object.
-
#remove_user_search_history_item(user, *args) ⇒ Object
Fetches SearchHistory for a User.
-
#update_comment_on_user(username, body, *args) ⇒ Object
Updates a Comment on a User.
-
#update_item_in_word_of_the_day_list(username, permalink, body, *args) ⇒ Object
Adds a WordOfTheDay to a user’s WordOfTheDayList.
-
#update_user(username, body, *args) ⇒ Object
Updates a User.
-
#update_user_profile(username, body, *args) ⇒ Object
Updates a UserProfile.
-
#update_user_settings(username, body, *args) ⇒ Object
Updates a user’s settings.
-
#update_word_of_the_day_list(username, permalink, *args) ⇒ Object
Deletes a user’s WordOfTheDayList.
Instance Method Details
#add_subscription(user, objectType, objectIdentifier, *args) ⇒ Object
Subscribes to an object.
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 |
# File 'lib/wordnik/resource_modules/user.rb', line 882 def add_subscription(user, objectType, objectIdentifier, *args) http_method = :post path = '/user/{user}/subscriptions/{objectType}/{objectIdentifier}' path.sub!('{user}', user.to_s) path.sub!('{objectType}', objectType.to_s) path.sub!('{objectIdentifier}', objectIdentifier.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 |
#add_word_to_word_of_the_day_list(username, permalink, body, *args) ⇒ Object
Adds an item to a user’s WordOfTheDayList
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
# File 'lib/wordnik/resource_modules/user.rb', line 308 def add_word_to_word_of_the_day_list(username, permalink, body, *args) http_method = :put path = '/user/{username}/wordOfTheDayList/{permalink}/add' path.sub!('{username}', username.to_s) 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 |
#comment_on_user(username, body, *args) ⇒ Object
Adds a Comment on a User
529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
# File 'lib/wordnik/resource_modules/user.rb', line 529 def comment_on_user(username, body, *args) http_method = :post path = '/user/{username}/comment' path.sub!('{username}', username.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 |
#create_word_of_the_day_list(username, body, *args) ⇒ Object
Creates a WordOfTheDayList A user can have only one WordOfTheDayList.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/wordnik/resource_modules/user.rb', line 36 def create_word_of_the_day_list(username, body, *args) http_method = :post path = '/user/{username}/wordOfTheDayList' path.sub!('{username}', username.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 |
#delete_comment_on_user(username, commentId, *args) ⇒ Object
Deletes a Comment on a User
583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 |
# File 'lib/wordnik/resource_modules/user.rb', line 583 def delete_comment_on_user(username, commentId, *args) http_method = :delete path = '/user/{username}/comment/{commentId}' path.sub!('{username}', username.to_s) path.sub!('{commentId}', commentId.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 |
#delete_user(username, *args) ⇒ Object
Deletes a User
281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 |
# File 'lib/wordnik/resource_modules/user.rb', line 281 def delete_user(username, *args) http_method = :delete path = '/user/{username}' path.sub!('{username}', username.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 |
#delete_word_from_word_of_the_day_list(username, permalink, wordToDelete, *args) ⇒ Object
Deletes a specific word from a user’s WordOfTheDayList
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
# File 'lib/wordnik/resource_modules/user.rb', line 336 def delete_word_from_word_of_the_day_list(username, permalink, wordToDelete, *args) http_method = :delete path = '/user/{username}/wordOfTheDayList/{permalink}/{wordToDelete}' path.sub!('{username}', username.to_s) path.sub!('{permalink}', permalink.to_s) path.sub!('{wordToDelete}', wordToDelete.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_api_key_for_user(username, *args) ⇒ Object
Returns the API key for the specified user Use the super user API key for getting this information or auth token of the user who is requesting the API key
502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
# File 'lib/wordnik/resource_modules/user.rb', line 502 def get_api_key_for_user(username, *args) http_method = :get path = '/user/{username}/apiKey' path.sub!('{username}', username.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_comment_on_user_by_id(username, commentId, *args) ⇒ Object
Fetches a comment by ID
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 |
# File 'lib/wordnik/resource_modules/user.rb', line 611 def get_comment_on_user_by_id(username, commentId, *args) http_method = :get path = '/user/{username}/comment/{commentId}' path.sub!('{username}', username.to_s) path.sub!('{commentId}', commentId.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_comments_by_user(username, *args) ⇒ Object
Returns Comments by a user
693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 |
# File 'lib/wordnik/resource_modules/user.rb', line 693 def get_comments_by_user(username, *args) http_method = :get path = '/user/{username}/commentsBy' path.sub!('{username}', username.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_comments_by_user_count(username, *args) ⇒ Object
Returns a count of Comments by a user
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 |
# File 'lib/wordnik/resource_modules/user.rb', line 666 def get_comments_by_user_count(username, *args) http_method = :get path = '/user/{username}/commentsByCount' path.sub!('{username}', username.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_comments_on_user(username, *args) ⇒ Object
Returns Comments on a user
720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 |
# File 'lib/wordnik/resource_modules/user.rb', line 720 def get_comments_on_user(username, *args) http_method = :get path = '/user/{username}/commentsOnUser' path.sub!('{username}', username.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_comments_on_user_count(username, *args) ⇒ Object
Returns a count of Comments on a user
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 |
# File 'lib/wordnik/resource_modules/user.rb', line 639 def get_comments_on_user_count(username, *args) http_method = :get path = '/user/{username}/commentsOnCount' path.sub!('{username}', username.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_subscriptions(user, *args) ⇒ Object
Fetches all subscriptions for a User.
855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 |
# File 'lib/wordnik/resource_modules/user.rb', line 855 def get_subscriptions(user, *args) http_method = :get path = '/user/{user}/subscriptions' path.sub!('{user}', user.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_ugc_summary_for_user(username, *args) ⇒ Object
Returns UgcSummary info a user
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 |
# File 'lib/wordnik/resource_modules/user.rb', line 747 def get_ugc_summary_for_user(username, *args) http_method = :get path = '/user/{username}/ugcSummary' path.sub!('{username}', username.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_user(username, *args) ⇒ Object
Fetches a User by username or email address
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
# File 'lib/wordnik/resource_modules/user.rb', line 254 def get_user(username, *args) http_method = :get path = '/user/{username}' path.sub!('{username}', username.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_user_activity_stream(user, *args) ⇒ Object
Fetches the total search count for a User.
1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 |
# File 'lib/wordnik/resource_modules/user.rb', line 1156 def get_user_activity_stream(user, *args) http_method = :get path = '/user/{user}/activitystream' path.sub!('{user}', user.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_user_favorite_count(user, *args) ⇒ Object
Fetches favorite word count for a user.
967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 |
# File 'lib/wordnik/resource_modules/user.rb', line 967 def get_user_favorite_count(user, *args) http_method = :get path = '/user/{user}/favorites/wordCount' path.sub!('{user}', user.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_user_favorite_word_lists(user, *args) ⇒ Object
Fetches Favorite WordLists for a user.
994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 |
# File 'lib/wordnik/resource_modules/user.rb', line 994 def get_user_favorite_word_lists(user, *args) http_method = :get path = '/user/{user}/favorites/wordLists' path.sub!('{user}', user.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_user_favorite_word_lists_count(user, *args) ⇒ Object
Fetches Favorite WordList count for a user.
1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 |
# File 'lib/wordnik/resource_modules/user.rb', line 1021 def get_user_favorite_word_lists_count(user, *args) http_method = :get path = '/user/{user}/favorites/wordListCount' path.sub!('{user}', user.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_user_favorite_words(user, *args) ⇒ Object
Fetches Favorite Words for a user.
940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 |
# File 'lib/wordnik/resource_modules/user.rb', line 940 def get_user_favorite_words(user, *args) http_method = :get path = '/user/{user}/favorites/words' path.sub!('{user}', user.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_user_profile(username, *args) ⇒ Object
Returns a UserProfile
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/wordnik/resource_modules/user.rb', line 146 def get_user_profile(username, *args) http_method = :get path = '/user/{username}/profile' path.sub!('{username}', username.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_user_pronunciations(user, *args) ⇒ Object
Fetches the total search count for a User.
1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 |
# File 'lib/wordnik/resource_modules/user.rb', line 1129 def get_user_pronunciations(user, *args) http_method = :get path = '/user/{user}/pronunciations' path.sub!('{user}', user.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_user_search_history(user, *args) ⇒ Object
Fetches SearchHistory for a User.
1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 |
# File 'lib/wordnik/resource_modules/user.rb', line 1048 def get_user_search_history(user, *args) http_method = :get path = '/user/{user}/searches' path.sub!('{user}', user.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_user_search_history_count(user, *args) ⇒ Object
Fetches the total search count for a User.
1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 |
# File 'lib/wordnik/resource_modules/user.rb', line 1102 def get_user_search_history_count(user, *args) http_method = :get path = '/user/{user}/totalSearches' path.sub!('{user}', user.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_user_settings(username, *args) ⇒ Object
Returns a user’s settings
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 |
# File 'lib/wordnik/resource_modules/user.rb', line 447 def get_user_settings(username, *args) http_method = :get path = '/user/{username}/settings' path.sub!('{username}', username.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_user_tag_count(user, *args) ⇒ Object
Fetches the count of Tags created by a User.
828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 |
# File 'lib/wordnik/resource_modules/user.rb', line 828 def get_user_tag_count(user, *args) http_method = :get path = '/user/{user}/tagCount' path.sub!('{user}', user.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_user_tag_history(user, *args) ⇒ Object
Fetches TagHistory for a User.
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 |
# File 'lib/wordnik/resource_modules/user.rb', line 774 def get_user_tag_history(user, *args) http_method = :get path = '/user/{user}/tagHistory' path.sub!('{user}', user.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_user_tags(user, *args) ⇒ Object
Fetches Tags by a User.
801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 |
# File 'lib/wordnik/resource_modules/user.rb', line 801 def (user, *args) http_method = :get path = '/user/{user}/tags' path.sub!('{user}', user.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_user_tracking_info(username, *args) ⇒ Object
Returns a user’s tracking info
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
# File 'lib/wordnik/resource_modules/user.rb', line 200 def get_user_tracking_info(username, *args) http_method = :get path = '/user/{username}/trackingInfo' path.sub!('{username}', username.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_user_word_list_count(username, *args) ⇒ Object
Gets the count of WordLists for a User.
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 |
# File 'lib/wordnik/resource_modules/user.rb', line 420 def get_user_word_list_count(username, *args) http_method = :get path = '/user/{username}/wordListsCount' path.sub!('{username}', username.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_user_word_lists(username, *args) ⇒ Object
Gets WordLists for a User.
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/wordnik/resource_modules/user.rb', line 393 def get_user_word_lists(username, *args) http_method = :get path = '/user/{username}/wordLists' path.sub!('{username}', username.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_by_date(username, date, *args) ⇒ Object
Returns the WordOfTheDay for a given user on a given date
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
# File 'lib/wordnik/resource_modules/user.rb', line 365 def get_word_of_the_day_by_date(username, date, *args) http_method = :get path = '/user/{username}/wordOfTheDay/{date}' path.sub!('{username}', username.to_s) 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_list(username, *args) ⇒ Object
Returns a user’s WordOfTheDayList
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/wordnik/resource_modules/user.rb', line 8 def get_word_of_the_day_list(username, *args) http_method = :get path = '/user/{username}/wordOfTheDayList' path.sub!('{username}', username.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 |
#remove_subscription(user, objectType, objectIdentifier, *args) ⇒ Object
Deletes a subscription to an object.
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 |
# File 'lib/wordnik/resource_modules/user.rb', line 911 def remove_subscription(user, objectType, objectIdentifier, *args) http_method = :delete path = '/user/{user}/subscriptions/{objectType}/{objectIdentifier}' path.sub!('{user}', user.to_s) path.sub!('{objectType}', objectType.to_s) path.sub!('{objectIdentifier}', objectIdentifier.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 |
#remove_user_search_history_item(user, *args) ⇒ Object
Fetches SearchHistory for a User.
1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 |
# File 'lib/wordnik/resource_modules/user.rb', line 1075 def remove_user_search_history_item(user, *args) http_method = :delete path = '/user/{user}/searches' path.sub!('{user}', user.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 |
#update_comment_on_user(username, body, *args) ⇒ Object
Updates a Comment on a User
556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
# File 'lib/wordnik/resource_modules/user.rb', line 556 def update_comment_on_user(username, body, *args) http_method = :put path = '/user/{username}/comment' path.sub!('{username}', username.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 |
#update_item_in_word_of_the_day_list(username, permalink, body, *args) ⇒ Object
Adds a WordOfTheDay to a user’s WordOfTheDayList
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/wordnik/resource_modules/user.rb', line 118 def update_item_in_word_of_the_day_list(username, permalink, body, *args) http_method = :put path = '/user/{username}/wordOfTheDayList/{permalink}' path.sub!('{username}', username.to_s) 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 |
#update_user(username, body, *args) ⇒ Object
Updates a User
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/wordnik/resource_modules/user.rb', line 227 def update_user(username, body, *args) http_method = :put path = '/user/{username}' path.sub!('{username}', username.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 |
#update_user_profile(username, body, *args) ⇒ Object
Updates a UserProfile
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/wordnik/resource_modules/user.rb', line 173 def update_user_profile(username, body, *args) http_method = :put path = '/user/{username}/profile' path.sub!('{username}', username.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 |
#update_user_settings(username, body, *args) ⇒ Object
Updates a user’s settings
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 |
# File 'lib/wordnik/resource_modules/user.rb', line 474 def update_user_settings(username, body, *args) http_method = :put path = '/user/{username}/settings' path.sub!('{username}', username.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 |
#update_word_of_the_day_list(username, permalink, *args) ⇒ Object
Deletes a user’s WordOfTheDayList
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/wordnik/resource_modules/user.rb', line 63 def update_word_of_the_day_list(username, body, *args) http_method = :put path = '/user/{username}/wordOfTheDayList' path.sub!('{username}', username.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 |