Module: Twitter::API::Favorites

### Home Classes Methods

### In Files

- lib/twitter/api/favorites.rb

### Methods

- #fav
- #fav!
- #fave
- #fave!
- #favorite
- #favorite!
- #favorite_create
- #favorite_create!
- #favorite_destroy
- #favorites
- #favourite_create
- #favourite_create!
- #favourite_destroy
- #favourites
- #unfavorite
- #unfavourite

### Included Modules

- Twitter::API::Utils

### Class/Module Index

Quicksearch

- Twitter
- Twitter::API
- Twitter::API::Arguments
- Twitter::API::DirectMessages
- Twitter::API::Favorites
- Twitter::API::FriendsAndFollowers
- Twitter::API::Help
- Twitter::API::Lists
- Twitter::API::PlacesAndGeo
- Twitter::API::SavedSearches
- Twitter::API::Search
- Twitter::API::SpamReporting
- Twitter::API::SuggestedUsers
- Twitter::API::Timelines
- Twitter::API::Trends
- Twitter::API::Tweets
- Twitter::API::Undocumented
- Twitter::API::Users
- Twitter::API::Utils
- Twitter::Action
- Twitter::Action::Favorite
- Twitter::Action::Follow
- Twitter::Action::ListMemberAdded
- Twitter::Action::Mention
- Twitter::Action::Reply
- Twitter::Action::Retweet
- Twitter::Action::Status
- Twitter::Action::Tweet
- Twitter::ActionFactory
- Twitter::Base
- Twitter::BasicUser
- Twitter::Client
- Twitter::Configurable
- Twitter::Configuration
- Twitter::Creatable
- Twitter::Cursor
- Twitter::Default
- Twitter::DirectMessage
- Twitter::Entity
- Twitter::Entity::Hashtag
- Twitter::Entity::Url
- Twitter::Entity::UserMention
- Twitter::Error
- Twitter::Error::AlreadyFavorited
- Twitter::Error::AlreadyRetweeted
- Twitter::Error::BadGateway
- Twitter::Error::BadRequest
- Twitter::Error::ClientError
- Twitter::Error::ConfigurationError
- Twitter::Error::DecodeError
- Twitter::Error::EnhanceYourCalm
- Twitter::Error::Forbidden
- Twitter::Error::GatewayTimeout
- Twitter::Error::IdentityMapKeyError
- Twitter::Error::InternalServerError
- Twitter::Error::NotAcceptable
- Twitter::Error::NotFound
- Twitter::Error::RateLimited
- Twitter::Error::ServerError
- Twitter::Error::ServiceUnavailable
- Twitter::Error::TooManyRequests
- Twitter::Error::Unauthorized
- Twitter::Error::UnprocessableEntity
- Twitter::Exceptable
- Twitter::Factory
- Twitter::Geo
- Twitter::Geo::Point
- Twitter::Geo::Polygon
- Twitter::GeoFactory
- Twitter::Identity
- Twitter::IdentityMap
- Twitter::Language
- Twitter::List
- Twitter::Media
- Twitter::Media::Photo
- Twitter::MediaFactory
- Twitter::Metadata
- Twitter::OEmbed
- Twitter::Place
- Twitter::ProfileBanner
- Twitter::RateLimit
- Twitter::Relationship
- Twitter::Request
- Twitter::Request::MultipartWithFile
- Twitter::Response
- Twitter::Response::ParseJson
- Twitter::Response::RaiseError
- Twitter::SavedSearch
- Twitter::SearchResults
- Twitter::Settings
- Twitter::Size
- Twitter::SourceUser
- Twitter::Status
- Twitter::Suggestion
- Twitter::TargetUser
- Twitter::Trend
- Twitter::Tweet
- Twitter::User
- Twitter::Version
- Enumerable
- Kernel

No matching classes.

# Twitter::API::Favorites

### Public Instance Methods

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(*ids)

    @param ids [Array<Integer>, Set<Integer>] An array of Tweet IDs.
    @example Favorite the Tweet with the ID 25938088801
      Twitter.favorite(25938088801)

@overload favorite(*ids, options)

    @param ids [Array<Integer>, Set<Integer>] An array of Tweet IDs.
    @param options [Hash] A customizable set of options.

    # File lib/twitter/api/favorites.rb, line 79
    def favorite(*args)
      arguments = Twitter::API::Arguments.new(args)
      arguments.flatten.threaded_map do |id|
        begin
          object_from_response(Twitter::Tweet, :post, "/1.1/favorites/create.json", arguments.options.merge(:id => id))
        rescue Twitter::Error::Forbidden => error
          raise unless error.message == Twitter::Error::AlreadyFavorited::MESSAGE
        end
      end.compact
    end

Also aliased as: fav, fave, favorite_create, favourite_create
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(*ids)

    @param ids [Array<Integer>, Set<Integer>] An array of Tweet IDs.
    @example Favorite the Tweet with the ID 25938088801
      Twitter.favorite(25938088801)

@overload favorite(*ids, options)

    @param ids [Array<Integer>, Set<Integer>] An array of Tweet IDs.
    @param options [Hash] A customizable set of options.

    # File lib/twitter/api/favorites.rb, line 109
    def favorite!(*args)
      arguments = Twitter::API::Arguments.new(args)
      arguments.flatten.threaded_map do |id|
        begin
          object_from_response(Twitter::Tweet, :post, "/1.1/favorites/create.json", arguments.options.merge(:id => id))
        rescue Twitter::Error::Forbidden => error
          handle_forbidden_error(Twitter::Error::AlreadyFavorited, error)
        end
      end
    end

Also aliased as: fav!, fave!, favorite_create!, favourite_create!
favorite_create(*args) click to toggle source
Alias for: favorite
favorite_create!(*args) click to toggle source
Alias for: favorite!
favorite_destroy(*args) click to toggle source
Alias for: unfavorite
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.
    @example Return the 20 most recent favorite Tweets for the authenticating user
      Twitter.favorites

@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, 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.
    @example Return the 20 most recent favorite Tweets for @sferik
      Twitter.favorites('sferik')

    # File lib/twitter/api/favorites.rb, line 35
    def favorites(*args)
      arguments = Twitter::API::Arguments.new(args)
      if user = arguments.pop
        merge_user!(arguments.options, user)
      end
      objects_from_response(Twitter::Tweet, :get, "/1.1/favorites/list.json", arguments.options)
    end

Also aliased as: favourites
favourite_create(*args) click to toggle source
Alias for: favorite
favourite_create!(*args) click to toggle source
Alias for: favorite!
favourite_destroy(*args) click to toggle source
Alias for: unfavorite
favourites(*args) click to toggle source
Alias for: favorites
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(*ids)

    @param ids [Array<Integer>, Set<Integer>] An array of Tweet IDs.
    @example Un-favorite the tweet with the ID 25938088801
      Twitter.unfavorite(25938088801)

@overload unfavorite(*ids, options)

    @param ids [Array<Integer>, Set<Integer>] An array of Tweet IDs.
    @param options [Hash] A customizable set of options.

    # File lib/twitter/api/favorites.rb, line 58
    def unfavorite(*args)
      threaded_object_from_response(Twitter::Tweet, :post, "/1.1/favorites/destroy.json", args)
    end

Also aliased as: favorite_destroy, favourite_destroy, unfavourite
unfavourite(*args) click to toggle source
Alias for: unfavorite

[Validate]

Generated with the Darkfish Rdoc Generator 2.