Permalink
Browse files

Adding users/self/media/liked endpoint

  • Loading branch information...
shayne committed Jun 2, 2011
1 parent ccf1f56 commit 6e3efd925aab6eb2c7fffbde0e4ea23f3028f4be
Showing with 37 additions and 2 deletions.
  1. +20 −2 lib/instagram/client/users.rb
  2. +1 −0 spec/fixtures/liked_media.json
  3. +16 −0 spec/instagram/client/users_spec.rb
@@ -136,7 +136,7 @@ def user_media_feed(*args)
# Returns a list of recent media items for a given user
#
- # @overload user_recent_media(id=nil, options={})
+ # @overload user_recent_media(options={})
# @param options [Hash] A customizable set of options.
# @return [Hashie::Mash]
# @example Returns a list of recent media items for the currently authenticated user
@@ -149,7 +149,7 @@ def user_media_feed(*args)
# @return [Hashie::Mash]
# @example Return a list of media items taken by @mikeyk
# Instagram.user_recent_media(4) # @mikeyk user ID being 4
- # @see TODO:docs url
+ # @see http://instagram.com/developer/endpoints/users/#get_users_media_recent
# @format :json
# @authenticated false unless requesting it from a protected user
#
@@ -162,6 +162,24 @@ def user_recent_media(*args)
response["data"]
end
+ # Returns a list of media items liked by the current user
+ #
+ # @overload user_liked_media(options={})
+ # @param options [Hash] A customizable set of options.
+ # @option options [Integer] :max_like_id (nil) Returns results with an ID less than (that is, older than) or equal to the specified ID.
+ # @option options [Integer] :count (nil) Limits the number of results returned per page.
+ # @return [Hashie::Mash]
+ # @example Returns a list of media items liked by the currently authenticated user
+ # Instagram.user_liked_media
+ # @see http://instagram.com/developer/endpoints/users/#get_users_liked_feed
+ # @format :json
+ # @authenticated true
+ # @rate_limited true
+ def user_liked_media(options={})
+ response = get("users/self/media/liked", options)
+ response["data"]
+ end
+
# Returns information about the current user's relationship (follow/following/etc) to another user
#
# @overload user_relationship(id, options={})

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -170,6 +170,22 @@
end
end
+ describe ".user_liked_media" do
+
+ before do
+ stub_get("users/self/media/liked.#{format}").
+ with(:query => {:access_token => @client.access_token}).
+ to_return(:body => fixture("liked_media.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"})
+ end
+
+ it "should get the correct resource" do
+ @client.user_liked_media
+ a_get("users/self/media/liked.#{format}").
+ with(:query => {:access_token => @client.access_token}).
+ should have_been_made
+ end
+ end
+
describe ".user_recent_media" do
context "with user ID passed" do

0 comments on commit 6e3efd9

Please sign in to comment.