Module: Twitter::Client::Favorites
- Included in:
- Twitter::Client
- Defined in:
- lib/twitter/client/favorites.rb
Overview
Defines methods related to favorites (or favourites)
Instance Method Summary collapse
-
#favorite(id, options = {}) ⇒ Twitter::Status
(also: #favorite_create)
Favorites the specified status as the authenticating user.
- #favorites(*args) ⇒ Object
-
#unfavorite(id, options = {}) ⇒ Twitter::Status
(also: #favorite_destroy)
Un-favorites the specified status as the authenticating user.
Instance Method Details
#favorite(id, options = {}) ⇒ Twitter::Status Also known as: favorite_create
Favorites the specified status as the authenticating user
56 57 58 59 |
# File 'lib/twitter/client/favorites.rb', line 56 def favorite(id, ={}) status = post("/1/favorites/create/#{id}.json", ) Twitter::Status.new(status) end |
#favorites(options = {}) ⇒ Array<Twitter::Status> #favorites(user, options = {}) ⇒ Array<Twitter::Status>
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/twitter/client/favorites.rb', line 33 def favorites(*args) = args.last.is_a?(Hash) ? args.pop : {} if user = args.first get("/1/favorites/#{user}.json", ) else get("/1/favorites.json", ) end.map do |status| Twitter::Status.new(status) end end |
#unfavorite(id, options = {}) ⇒ Twitter::Status Also known as: favorite_destroy
Un-favorites the specified status as the authenticating user
74 75 76 77 |
# File 'lib/twitter/client/favorites.rb', line 74 def unfavorite(id, ={}) status = delete("/1/favorites/destroy/#{id}.json", ) Twitter::Status.new(status) end |