Skip to content

Commit

Permalink
Add Statuses#media_timeline method
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Sep 1, 2011
1 parent eecb4ef commit f1a78ea
Show file tree
Hide file tree
Showing 6 changed files with 1,123 additions and 5 deletions.
27 changes: 27 additions & 0 deletions lib/twitter/client/timeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,33 @@ def retweets_of_me(options={})
response = get('statuses/retweets_of_me', options)
format.to_s.downcase == 'xml' ? response['statuses'] : response
end

# Returns the 20 most recent images posted by the specified user
#
# @see https://support.twitter.com/articles/20169409
# @note This method can only return up to the 100 most recent images.
# @note Images will not be returned from tweets posted before January 1, 2010.
# @rate_limited Yes
# @requires_authentication No unless the user whose timeline you're trying to view is protected
# @response_format `json`
# @response_format `xml`
# @overload media_timeline(user, options={})
# @param user [Integer, String] A Twitter user ID or screen name.
# @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 200.
# @option options [Integer] :page Specifies the page of results to retrieve.
# @option options [Boolean] :filter Include possibly sensitive media when set to false, 'f' or 0.
# @option options [Boolean, String, Integer] :include_entities Include {https://dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, 't' or 1.
# @return [Array]
# @example Return the 20 most recent statuses posted by @sferik
# Twitter.media_timeline("sferik")
def media_timeline(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
user = args.first || get_screen_name
merge_user_into_options!(user, options)
response = get('statuses/media_timeline', options)
format.to_s.downcase == 'xml' ? response['statuses'] : response
end
end
end
end
4 changes: 2 additions & 2 deletions lib/twitter/client/tweets.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ def update(status, options={})
# Updates with media the authenticating user's status
#
# @note A status update with text/media identical to the authenticating user's current status will NOT be ignored
# @authenticated true
# @rate_limited false
# @requires_authentication Yes
# @rate_limited No
# @response_format `json`
# @response_format `xml`
# @param status [String] The text of your status update, up to 140 characters.
Expand Down
7 changes: 4 additions & 3 deletions lib/twitter/client/urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ module Urls
# @rate_limited Yes
# @requires_authentication Yes
# @response_format `json`
# @param urls [String] A list of shortened URLs
# @param options [Hash] A customizable set of options.
# @return [Hashie::Mash] A hash of URLs with the shortened URLs as the key
# @overload resolve(urls, options={})
# @param urls [String] A list of shortened URLs
# @param options [Hash] A customizable set of options.
# @return [Hashie::Mash] A hash of URLs with the shortened URLs as the key
# @example Return the canonical version of a URL shortened by Twitter
# Twitter.resolve('http://t.co/uw5bn1w', 'http://t.co/dXvMz9i')
# Twitter.resolve(['http://t.co/uw5bn1w', 'http://t.co/dXvMz9i']) # Same as above
Expand Down
1 change: 1 addition & 0 deletions spec/fixtures/media_timeline.json

Large diffs are not rendered by default.

Loading

0 comments on commit f1a78ea

Please sign in to comment.