Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Pagination metadata made available on specific endpoints.

This moves relevant response results to the data Arary.
(i.e. Instagram.user_liked_media[0].link => Instagram.user_liked_media.data[0].link)
  • Loading branch information...
commit 4c78111371433a0d86f5b6bb8708d6a030d15210 1 parent e1a476e
@shayne shayne authored
View
4 lib/instagram/client/locations.rb
@@ -35,7 +35,7 @@ def location(id, *args)
def location_recent_media(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("locations/#{id}/media/recent", options)
- response["data"]
+ response
end
# Returns Instagram locations within proximity of given lat,lng
@@ -56,4 +56,4 @@ def location_search(lat, lng, options={})
end
end
end
-end
+end
View
4 lib/instagram/client/media.rb
@@ -56,8 +56,8 @@ def media_popular(*args)
# @rate_limited true
def media_search(lat, lng, options={})
response = get('media/search', options.merge(:lat => lat, :lng => lng))
- response["data"]
+ response
end
end
end
-end
+end
View
4 lib/instagram/client/tags.rb
@@ -35,7 +35,7 @@ def tag(tag, *args)
def tag_recent_media(id, *args)
options = args.last.is_a?(Hash) ? args.pop : {}
response = get("tags/#{id}/media/recent", options)
- response["data"]
+ response
end
# Returns a list of tags starting with the given search query
@@ -56,4 +56,4 @@ def tag_search(query, options={})
end
end
end
-end
+end
View
25 lib/instagram/client/users.rb
@@ -120,18 +120,19 @@ def user_requested_by()
# @overload user_media_feed(options={})
# @param options [Hash] A customizable set of options.
# @option options [Integer] :max_id Returns results with an ID less than (that is, older than) or equal to the specified ID.
- # @option optionsc [Integer] :count Specifies the number of records to retrieve, per page.
+ # @option options [Integer] :min_id Return media later than this min_id
+ # @option options [Integer] :count Specifies the number of records to retrieve, per page.
# @return [Array]
# @example Return most recent media images that would appear on @shayne's feed
# Instagram.user_media_feed() # assuming @shayne is the authorized user
# @format :json
# @authenticated true
# @rate_limited true
- # @see TODO:docs URL
+ # @see http://instagram.com/developer/endpoints/users/#get_users_feed
def user_media_feed(*args)
options = args.first.is_a?(Hash) ? args.pop : {}
response = get('users/self/feed', options)
- response["data"]
+ response
end
# Returns a list of recent media items for a given user
@@ -161,7 +162,7 @@ def user_recent_media(*args)
response = get("users/#{id}/media/recent", options)
response["data"]
end
-
+
# Returns a list of media items liked by the current user
#
# @overload user_liked_media(options={})
@@ -177,9 +178,9 @@ def user_recent_media(*args)
# @rate_limited true
def user_liked_media(options={})
response = get("users/self/media/liked", options)
- response["data"]
+ response
end
-
+
# Returns information about the current user's relationship (follow/following/etc) to another user
#
# @overload user_relationship(id, options={})
@@ -196,7 +197,7 @@ def user_relationship(id, options={})
response = get("users/#{id}/relationship", options)
response["data"]
end
-
+
# Create a follows relationship between the current user and the target user
#
# @overload follow_user(id, options={})
@@ -214,7 +215,7 @@ def follow_user(id, options={})
response = post("users/#{id}/relationship", options)
response["data"]
end
-
+
# Destroy a follows relationship between the current user and the target user
#
# @overload unfollow_user(id, options={})
@@ -232,7 +233,7 @@ def unfollow_user(id, options={})
response = post("users/#{id}/relationship", options)
response["data"]
end
-
+
# Block a relationship between the current user and the target user
#
# @overload unfollow_user(id, options={})
@@ -250,7 +251,7 @@ def block_user(id, options={})
response = post("users/#{id}/relationship", options)
response["data"]
end
-
+
# Remove a relationship block between the current user and the target user
#
# @overload unblock_user(id, options={})
@@ -268,7 +269,7 @@ def unblock_user(id, options={})
response = post("users/#{id}/relationship", options)
response["data"]
end
-
+
# Approve a relationship request between the current user and the target user
#
# @overload approve_user(id, options={})
@@ -286,7 +287,7 @@ def approve_user(id, options={})
response = post("users/#{id}/relationship", options)
response["data"]
end
-
+
# Deny a relationship request between the current user and the target user
#
# @overload deny_user(id, options={})
View
2  lib/instagram/version.rb
@@ -1,3 +1,3 @@
module Instagram
- VERSION = '0.7'.freeze unless defined?(::Instagram::VERSION)
+ VERSION = '0.8'.freeze unless defined?(::Instagram::VERSION)
end
View
6 spec/instagram/client/locations_spec.rb
@@ -45,8 +45,8 @@
it "should return a list of media taken at a given location" do
media = @client.location_recent_media(514276)
- media.should be_a Array
- media.first.user.username.should == "josh"
+ media.data.should be_a Array
+ media.data.first.user.username.should == "josh"
end
end
@@ -75,4 +75,4 @@
end
end
end
-end
+end
View
8 spec/instagram/client/media_spec.rb
@@ -68,11 +68,11 @@
end
it "should return an array of user search results" do
- user_search = @client.media_search("37.7808851", "-122.3948632")
- user_search.should be_a Array
- user_search.first.user.username.should == "mikeyk"
+ media_search = @client.media_search("37.7808851", "-122.3948632")
+ media_search.data.should be_a Array
+ media_search.data.first.user.username.should == "mikeyk"
end
end
end
end
-end
+end
View
6 spec/instagram/client/tags_spec.rb
@@ -45,8 +45,8 @@
it "should return a list of media taken at a given location" do
media = @client.tag_recent_media('cat')
- media.should be_a Array
- media.first.user.username.should == "amandavan"
+ media.data.should be_a Array
+ media.data.first.user.username.should == "amandavan"
end
end
@@ -75,4 +75,4 @@
end
end
end
-end
+end
Please sign in to comment.
Something went wrong with that request. Please try again.