Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

64 lines (61 sloc) 2.404 kb
module Instagram
class Client
# Defines methods related to media items
module Media
# Returns extended information of a given media item
#
# @overload media_item(id)
# @param user [Integer] An Instagram media item ID
# @return [Hashie::Mash] The requested media item.
# @example Return extended information for media item 1234
# Instagram.media_item(1324)
# @format :json
# @authenticated false unless requesting media from a protected user
#
# If getting this data of a protected user, you must authenticate (and be allowed to see that user).
# @rate_limited true
# @see TODO:docs url
def media_item(*args)
id = args.first || 'self'
response = get("media/#{id}")
response
end
# Returns a list of the overall most popular media
#
# @overload media_popular(options={})
# @param options [Hash] A customizable set of options.
# @return [Hashie::Mash]
# @example Returns a list of the overall most popular media
# Instagram.media_popular
# @see TODO:docs url
# @format :json
# @authenticated false unless requesting it from a protected user
#
# If getting this data of a protected user, you must authenticate (and be allowed to see that user).
# @rate_limited true
def media_popular(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
id = args.first || "self"
response = get("media/popular", options)
response
end
# Returns media items within proximity of given lat,lng
#
# @param lat [String] A given latitude in decimal format
# @param lng [String] A given longitude in decimal format
# @param options [Hash] A customizable set of options.
# @option options [Integer] :count The number of media items to retrieve.
# @return [Hashie::Mash] A list of matching media
# @example Return media around 37.7808851, -122.3948632 (164 S Park, SF, CA USA)
# Instagram.media_search("37.7808851", "-122.3948632")
# @see TODO:doc url
# @format :json
# @authenticated false
# @rate_limited true
def media_search(lat, lng, options={})
response = get('media/search', options.merge(:lat => lat, :lng => lng))
response
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.