lib/twitter/rest/friends_and_followers.rb in twitter-5.12.0 vs lib/twitter/rest/friends_and_followers.rb in twitter-5.13.0

- old
+ new

@@ -1,9 +1,9 @@ require 'twitter/arguments' require 'twitter/cursor' require 'twitter/relationship' -require 'twitter/request' +require 'twitter/rest/request' require 'twitter/rest/utils' require 'twitter/user' require 'twitter/utils' module Twitter @@ -25,11 +25,11 @@ # Returns an array of numeric IDs for every user the specified user is following # # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object. # @param options [Hash] A customizable set of options. def friend_ids(*args) - cursor_from_response_with_user(:ids, nil, :get, '/1.1/friends/ids.json', args) + cursor_from_response_with_user(:ids, nil, '/1.1/friends/ids.json', args) end # @see https://dev.twitter.com/docs/api/1.1/get/followers/ids # @rate_limited Yes # @authentication Requires user context @@ -43,11 +43,11 @@ # Returns an array of numeric IDs for every user following the specified user # # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object. # @param options [Hash] A customizable set of options. def follower_ids(*args) - cursor_from_response_with_user(:ids, nil, :get, '/1.1/followers/ids.json', args) + cursor_from_response_with_user(:ids, nil, '/1.1/followers/ids.json', args) end # Returns the relationship of the authenticating user to the comma separated list of up to 100 screen_names or user_ids provided. Values for connections can be: following, following_requested, followed_by, none. # # @see https://dev.twitter.com/docs/api/1.1/get/friendships/lookup @@ -61,11 +61,11 @@ # @param users [Enumerable<Integer, String, Twitter::User>] A collection of Twitter user IDs, screen names, or objects. # @param options [Hash] A customizable set of options. def friendships(*args) arguments = Twitter::Arguments.new(args) merge_users!(arguments.options, arguments) - perform_with_objects(:get, '/1.1/friendships/lookup.json', arguments.options, Twitter::User) + perform_get_with_objects('/1.1/friendships/lookup.json', arguments.options, Twitter::User) end # Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user # # @see https://dev.twitter.com/docs/api/1.1/get/friendships/incoming @@ -73,11 +73,11 @@ # @authentication Requires user context # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. # @return [Twitter::Cursor] # @param options [Hash] A customizable set of options. def friendships_incoming(options = {}) - perform_with_cursor(:get, '/1.1/friendships/incoming.json', options, :ids) + perform_get_with_cursor('/1.1/friendships/incoming.json', options, :ids) end # Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request # # @see https://dev.twitter.com/docs/api/1.1/get/friendships/outgoing @@ -85,11 +85,11 @@ # @authentication Requires user context # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. # @return [Twitter::Cursor] # @param options [Hash] A customizable set of options. def friendships_outgoing(options = {}) - perform_with_cursor(:get, '/1.1/friendships/outgoing.json', options, :ids) + perform_get_with_cursor('/1.1/friendships/outgoing.json', options, :ids) end # Allows the authenticating user to follow the specified users, unless they are already followed # # @see https://dev.twitter.com/docs/api/1.1/post/friendships/create @@ -130,11 +130,11 @@ # @param options [Hash] A customizable set of options. # @option options [Boolean] :follow (false) Enable notifications for the target user. def follow!(*args) arguments = Twitter::Arguments.new(args) pmap(arguments) do |user| - perform_with_object(:post, '/1.1/friendships/create.json', merge_user(arguments.options, user), Twitter::User) + perform_post_with_object('/1.1/friendships/create.json', merge_user(arguments.options, user), Twitter::User) end.compact end alias_method :create_friendship!, :follow! deprecate_alias :friendship_create!, :follow! @@ -167,11 +167,11 @@ # @param options [Hash] A customizable set of options. # @option options [Boolean] :device Enable/disable device notifications from the target user. # @option options [Boolean] :retweets Enable/disable retweets from the target user. def friendship_update(user, options = {}) merge_user!(options, user) - perform_with_object(:post, '/1.1/friendships/update.json', options, Twitter::Relationship) + perform_post_with_object('/1.1/friendships/update.json', options, Twitter::Relationship) end # Returns detailed information about the relationship between two users # # @see https://dev.twitter.com/docs/api/1.1/get/friendships/show @@ -185,11 +185,11 @@ def friendship(source, target, options = {}) merge_user!(options, source, 'source') options[:source_id] = options.delete(:source_user_id) unless options[:source_user_id].nil? merge_user!(options, target, 'target') options[:target_id] = options.delete(:target_user_id) unless options[:target_user_id].nil? - perform_with_object(:get, '/1.1/friendships/show.json', options, Twitter::Relationship) + perform_get_with_object('/1.1/friendships/show.json', options, Twitter::Relationship) end alias_method :friendship_show, :friendship alias_method :relationship, :friendship # Test for the existence of friendship between two users @@ -225,11 +225,11 @@ # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object. # @param options [Hash] A customizable set of options. # @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1. # @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false. def followers(*args) - cursor_from_response_with_user(:users, Twitter::User, :get, '/1.1/followers/list.json', args) + cursor_from_response_with_user(:users, Twitter::User, '/1.1/followers/list.json', args) end # Returns a cursored collection of user objects for every user the specified user is following (otherwise known as their "friends"). # # @see https://dev.twitter.com/docs/api/1.1/get/friends/list @@ -249,11 +249,11 @@ # @param user [Integer, String, Twitter::User] A Twitter user ID, screen name, URI, or object. # @param options [Hash] A customizable set of options. # @option options [Boolean, String, Integer] :skip_status Do not include contributee's Tweets when set to true, 't' or 1. # @option options [Boolean, String, Integer] :include_user_entities The user entities node will be disincluded when set to false. def friends(*args) - cursor_from_response_with_user(:users, Twitter::User, :get, '/1.1/friends/list.json', args) + cursor_from_response_with_user(:users, Twitter::User, '/1.1/friends/list.json', args) end alias_method :following, :friends # Returns a collection of user IDs that the currently authenticated user does not want to receive retweets from. # @see https://dev.twitter.com/docs/api/1.1/get/friendships/no_retweets/ids @@ -261,10 +261,10 @@ # @authentication Requires user context # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. # @return [Array<Integer>] # @param options [Hash] A customizable set of options. def no_retweet_ids(options = {}) - get('/1.1/friendships/no_retweets/ids.json', options).body.collect(&:to_i) + perform_get('/1.1/friendships/no_retweets/ids.json', options).collect(&:to_i) end alias_method :no_retweets_ids, :no_retweet_ids end end end