Module Twitter::Client::FriendsAndFollowers
In: lib/twitter/client/friends_and_followers.rb

Defines methods related to friends and followers

Methods

Public Instance methods

Allows the authenticating user to accept the specified user‘s follow request

@note Undocumented @rate_limited No @requires_authentication Yes @param user [Integer, String] A Twitter user ID or screen name. @param options [Hash] A customizable set of options. @return [Twitter::User] The accepted user. @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Accept @sferik‘s follow request

  Twitter.accept("sferik")

Allows the authenticating user to deny the specified user‘s follow request

@note Undocumented @rate_limited No @requires_authentication Yes @param user [Integer, String] A Twitter user ID or screen name. @param options [Hash] A customizable set of options. @return [Twitter::User] The denied user. @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Deny @sferik‘s follow request

  Twitter.deny("sferik")

Allows the authenticating user to follow the specified user

@see dev.twitter.com/docs/api/1/post/friendships/create @rate_limited No @requires_authentication Yes @param user [Integer, String] A Twitter user ID or screen name. @param options [Hash] A customizable set of options. @option options [Boolean] :follow (false) Enable notifications for the target user. @option options [Boolean, String, Integer] :include_entities Include {dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, ‘t’ or 1. @return [Twitter::User] The followed user. @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Follow @sferik

  Twitter.follow("sferik")

@see dev.twitter.com/docs/api/1/get/followers/ids @rate_limited Yes @requires_authentication No unless requesting it from a protected user

  If getting this data of a protected user, you must authenticate (and be allowed to see that user).

@overload follower_ids(options={})

  Returns an array of numeric IDs for every user following the authenticated user

  @param options [Hash] A customizable set of options.
  @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
  @return [Twitter::Cursor]
  @example Return the authenticated user's followers' IDs
    Twitter.follower_ids

@overload follower_ids(user, options={})

  Returns an array of numeric IDs for every user following the specified user

  @param user [Integer, String] A Twitter user ID or screen name.
  @param options [Hash] A customizable set of options.
  @option options [Integer] :cursor (-1) Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
  @return [Twitter::Cursor]
  @example Return @sferik's followers' IDs
    Twitter.follower_ids("sferik")
    Twitter.follower_ids(7505382)  # Same as above

@see dev.twitter.com/docs/api/1/get/friends/ids @rate_limited Yes @requires_authentication No unless requesting it from a protected user

  If getting this data of a protected user, you must authenticate (and be allowed to see that user).

@overload friend_ids(options={})

  Returns an array of numeric IDs for every user the authenticated user is following

  @param options [Hash] A customizable set of options.
  @option options [Integer] :cursor (-1) Breaks the results into pages. This is recommended for users who are following many users. Provide a value of -1 to begin paging. Provide values as returned in the response body's next_cursor and previous_cursor attributes to page back and forth in the list.
  @return [Twitter::Cursor]
  @example Return the authenticated user's friends' IDs
    Twitter.friend_ids

@overload friend_ids(user, options={})

  Returns an array of numeric IDs for every user the specified user is following

  @param user [Integer, String] A Twitter user ID or screen name.
  @param options [Hash] A customizable set of options.
  @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects's next_cursor and previous_cursor attributes to page back and forth in the list.
  @return [Twitter::Cursor]
  @example Return @sferik's friends' IDs
    Twitter.friend_ids("sferik")
    Twitter.friend_ids(7505382)  # Same as above

Returns detailed information about the relationship between two users

@see dev.twitter.com/docs/api/1/get/friendships/show @rate_limited Yes @requires_authentication No @param options [Hash] A customizable set of options. @return [Twitter::Relationship] @example Return the relationship between @sferik and @pengwynn

  Twitter.friendship("sferik", "pengwynn")
  Twitter.friendship(7505382, 14100886)

Test for the existence of friendship between two users

@see dev.twitter.com/docs/api/1/get/friendships/exists @note Consider using {Twitter::Client::FriendsAndFollowers#friendship} instead of this method. @rate_limited Yes @requires_authentication No unless user_a or user_b is protected @param user_a [Integer, String] The ID or screen_name of the subject user. @param user_b [Integer, String] The ID or screen_name of the user to test for following. @param options [Hash] A customizable set of options. @return [Boolean] true if user_a follows user_b, otherwise false. @example Return true if @sferik follows @pengwynn

  Twitter.friendship?("sferik", "pengwynn")
friendship_create(user, options={})

Alias for follow

friendship_destroy(user, options={})

Alias for unfollow

friendship_show(source, target, options={})

Alias for friendship

Allows one to enable or disable retweets and device notifications from the specified user.

@see dev.twitter.com/docs/api/1/post/friendships/update @rate_limited No @requires_authentication Yes @param user [Integer, String] Twitter user ID or screen name. @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. @return [Twitter::Relationship] @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Enable rewteets and devise notifications for @sferik

  Twitter.friendship_update("sferik", :device => true, :retweets => true)

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 dev.twitter.com/docs/api/1/get/friendships/lookup @rate_limited Yes @requires_authentication Yes @param options [Hash] A customizable set of options. @return [Twitter::Relationship] @overload friendships(*users, options={})

  @param users [Array<Integer, String>, Set<Integer, String>] Twitter user IDs or screen names.
  @param options [Hash] A customizable set of options.
  @option options [Boolean, String, Integer] :include_entities Include {https://dev.twitter.com/docs/tweet-entities Tweet
  @return [Array<Twitter::User>] The requested users.
  @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid.
  @example Return extended information for @sferik and @pengwynn
    Twitter.friendships("sferik", "pengwynn")
    Twitter.friendships("sferik", 14100886)   # Same as above
    Twitter.friendships(7505382, 14100886)    # Same as above

Returns an array of numeric IDs for every user who has a pending request to follow the authenticating user

@see dev.twitter.com/docs/api/1/get/friendships/incoming @rate_limited Yes @requires_authentication Yes @param options [Hash] A customizable set of options. @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects‘s next_cursor and previous_cursor attributes to page back and forth in the list. @return [Twitter::Cursor] @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Return an array of numeric IDs for every user who has a pending request to follow the authenticating user

  Twitter.friendships_incoming

Returns an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request

@see dev.twitter.com/docs/api/1/get/friendships/outgoing @rate_limited Yes @requires_authentication Yes @param options [Hash] A customizable set of options. @option options [Integer] :cursor (-1) Breaks the results into pages. Provide values as returned in the response objects‘s next_cursor and previous_cursor attributes to page back and forth in the list. @return [Twitter::Cursor] @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Return an array of numeric IDs for every protected user for whom the authenticating user has a pending follow request

  Twitter.friendships_outgoing

Returns an array of user_ids that the currently authenticated user does not want to see retweets from.

@see dev.twitter.com/docs/api/1/get/friendships/no_retweet_ids @rate_limited Yes @requires_authentication Yes @param user [Integer, String] Twitter user ID or screen name. @param options [Hash] A customizable set of options. @option options [Boolean] :stringify_ids Many programming environments will not consume our ids due to their size. Provide this option to have ids returned as strings instead. Read more about Twitter IDs, JSON and Snowflake. @return [Array<Integer>] @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Enable rewteets and devise notifications for @sferik

  Twitter.no_retweet_ids
relationship(source, target, options={})

Alias for friendship

Allows the authenticating user to unfollow the specified user

@see dev.twitter.com/docs/api/1/post/friendships/destroy @rate_limited No @requires_authentication Yes @param user [Integer, String] A Twitter user ID or screen name. @param options [Hash] A customizable set of options. @option options [Boolean, String, Integer] :include_entities Include {dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, ‘t’ or 1. @return [Twitter::User] The unfollowed user. @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Unfollow @sferik

  Twitter.unfollow("sferik")

[Validate]