### Home Classes Methods

### In Files

- lib/twitter/rest/favorites.rb

### Methods

- #create_favorite!
- #destroy_favorite
- #fav
- #fav!
- #fave
- #fave!
- #favorite
- #favorite!
- #favorites
- #unfavorite

### Included Modules

- Twitter::REST::Utils
- Twitter::Utils

### Class/Module Index

Quicksearch

- Twitter
- Twitter::Arguments
- Twitter::Base
- Twitter::BasicUser
- Twitter::Client
- Twitter::Configuration
- Twitter::Creatable
- Twitter::Cursor
- Twitter::DirectMessage
- Twitter::Entities
- Twitter::Entity
- Twitter::Entity::Hashtag
- Twitter::Entity::Symbol
- Twitter::Entity::URI
- Twitter::Entity::URL
- Twitter::Entity::UserMention
- Twitter::Enumerable
- Twitter::Error
- Twitter::Error::AlreadyFavorited
- Twitter::Error::AlreadyRetweeted
- Twitter::Error::BadGateway
- Twitter::Error::BadRequest
- Twitter::Error::ClientError
- Twitter::Error::Code
- Twitter::Error::ConfigurationError
- Twitter::Error::DuplicateStatus
- Twitter::Error::Forbidden
- Twitter::Error::GatewayTimeout
- Twitter::Error::InternalServerError
- Twitter::Error::NotAcceptable
- Twitter::Error::NotFound
- Twitter::Error::RequestTimeout
- Twitter::Error::ServerError
- Twitter::Error::ServiceUnavailable
- Twitter::Error::TooManyRequests
- Twitter::Error::UnacceptableIO
- Twitter::Error::Unauthorized
- Twitter::Error::UnprocessableEntity
- Twitter::Factory
- Twitter::Geo
- Twitter::Geo::Point
- Twitter::Geo::Polygon
- Twitter::GeoFactory
- Twitter::GeoResults
- Twitter::Identity
- Twitter::Language
- Twitter::List
- Twitter::Media
- Twitter::Media::Photo
- Twitter::MediaFactory
- Twitter::Metadata
- Twitter::OEmbed
- Twitter::Place
- Twitter::Profile
- Twitter::ProfileBanner
- Twitter::REST
- Twitter::REST::API
- Twitter::REST::Client
- Twitter::REST::DirectMessages
- Twitter::REST::Favorites
- Twitter::REST::FriendsAndFollowers
- Twitter::REST::Help
- Twitter::REST::Lists
- Twitter::REST::Media
- Twitter::REST::OAuth
- Twitter::REST::PlacesAndGeo
- Twitter::REST::Request
- Twitter::REST::Request::MultipartWithFile
- Twitter::REST::Response
- Twitter::REST::Response::ParseErrorJson
- Twitter::REST::Response::ParseJson
- Twitter::REST::Response::RaiseError
- Twitter::REST::SavedSearches
- Twitter::REST::Search
- Twitter::REST::SpamReporting
- Twitter::REST::SuggestedUsers
- Twitter::REST::Timelines
- Twitter::REST::Trends
- Twitter::REST::Tweets
- Twitter::REST::Undocumented
- Twitter::REST::Users
- Twitter::REST::Utils
- Twitter::RateLimit
- Twitter::Relationship
- Twitter::Request
- Twitter::SavedSearch
- Twitter::SearchResults
- Twitter::Settings
- Twitter::Size
- Twitter::SourceUser
- Twitter::Streaming
- Twitter::Streaming::Client
- Twitter::Streaming::Connection
- Twitter::Streaming::DeletedTweet
- Twitter::Streaming::Event
- Twitter::Streaming::FriendList
- Twitter::Streaming::MessageParser
- Twitter::Streaming::Response
- Twitter::Streaming::StallWarning
- Twitter::Suggestion
- Twitter::TargetUser
- Twitter::Token
- Twitter::Trend
- Twitter::TrendResults
- Twitter::Tweet
- Twitter::User
- Twitter::Utils
- Twitter::Utils::ClassMethods
- Twitter::Version

No matching classes.

# Twitter::REST::Favorites

### Public Instance Methods

create_favorite!(*args) click to toggle source
Alias for: favorite!
destroy_favorite(*args) click to toggle source
Alias for: unfavorite
fav(*args) click to toggle source
Alias for: favorite
fav!(*args) click to toggle source
Alias for: favorite!
fave(*args) click to toggle source
Alias for: favorite
fave!(*args) click to toggle source
Alias for: favorite!
favorite(*args) click to toggle source

Favorites the specified Tweets as the authenticating user

@see dev.twitter.com/docs/api/1.1/post/favorites/create @rate_limited No @authentication Requires user context @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Array<Twitter::Tweet>] The favorited Tweets. @overload favorite(*tweets)

    @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.

@overload favorite(*tweets, options)

    @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
    @param options [Hash] A customizable set of options.

    # File lib/twitter/rest/favorites.rb, line 69
    def favorite(*args)
      arguments = Twitter::Arguments.new(args)
      pmap(arguments) do |tweet|
        begin
          perform_with_object(:post, '/1.1/favorites/create.json', arguments.options.merge(:id => extract_id(tweet)), Twitter::Tweet)
        rescue Twitter::Error::AlreadyFavorited
          next
        end
      end.compact
    end

Also aliased as: fav, fave
favorite!(*args) click to toggle source

Favorites the specified Tweets as the authenticating user and raises an error if one has already been favorited

@see dev.twitter.com/docs/api/1.1/post/favorites/create @rate_limited No @authentication Requires user context @raise [Twitter::Error::AlreadyFavorited] Error raised when tweet has already been favorited. @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Array<Twitter::Tweet>] The favorited Tweets. @overload favorite(*tweets)

    @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.

@overload favorite(*tweets, options)

    @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
    @param options [Hash] A customizable set of options.

    # File lib/twitter/rest/favorites.rb, line 96
    def favorite!(*args)
      arguments = Twitter::Arguments.new(args)
      pmap(arguments) do |tweet|
        perform_with_object(:post, '/1.1/favorites/create.json', arguments.options.merge(:id => extract_id(tweet)), Twitter::Tweet)
      end
    end

Also aliased as: create_favorite!, fav!, fave!
favorites(*args) click to toggle source

@see dev.twitter.com/docs/api/1.1/get/favorites/list @rate_limited Yes @authentication Requires user context @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Array<Twitter::Tweet>] favorite Tweets. @overload favorites(options = {})

    Returns the 20 most recent favorite Tweets for the authenticating user

    @param options [Hash] A customizable set of options.
    @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
    @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.

@overload favorites(user, options = {})

    Returns the 20 most recent favorite Tweets for 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.
    @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100.
    @option options [Integer] :since_id Returns results with an ID greater than (that is, more recent than) the specified ID.

    # File lib/twitter/rest/favorites.rb, line 33
    def favorites(*args)
      arguments = Twitter::Arguments.new(args)
      merge_user!(arguments.options, arguments.pop) if arguments.last
      perform_with_objects(:get, '/1.1/favorites/list.json', arguments.options, Twitter::Tweet)
    end

unfavorite(*args) click to toggle source

Un-favorites the specified Tweets as the authenticating user

@see dev.twitter.com/docs/api/1.1/post/favorites/destroy @rate_limited No @authentication Requires user context @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @return [Array<Twitter::Tweet>] The un-favorited Tweets. @overload unfavorite(*tweets)

    @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.

@overload unfavorite(*tweets, options)

    @param tweets [Enumerable<Integer, String, URI, Twitter::Tweet>] A collection of Tweet IDs, URIs, or objects.
    @param options [Hash] A customizable set of options.

    # File lib/twitter/rest/favorites.rb, line 51
    def unfavorite(*args)
      parallel_objects_from_response(Twitter::Tweet, :post, '/1.1/favorites/destroy.json', args)
    end

Also aliased as: destroy_favorite

[Validate]

Generated with the Darkfish Rdoc Generator 2.