Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 60 lines (57 sloc) 2.381 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
module Instagram
  class Client
    # Defines methods related to media items
    module Locations
      # Returns extended information of a given Instagram location
      #
      # @overload location(id)
      # @param location [Integer] An Instagram location ID
      # @return [Hashie::Mash] The requested location.
      # @example Return extended information for the Instagram office
      # Instagram.location(514276)
      # @format :json
      # @authenticated false
      # @rate_limited true
      # @see TODO:docs url
      def location(id, *args)
        response = get("locations/#{id}")
        response
      end

      # Returns a list of recent media items for a given Instagram location
      #
      # @overload location_recent_media(id, options={})
      # @param user [Integer] An Instagram location ID.
      # @param options [Hash] A customizable set of options.
      # @option options [Integer] :max_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 Return a list of the most recent media items taken at the Instagram office
      # Instagram.location_recent_media(514276)
      # @see TODO:docs url
      # @format :json
      # @authenticated false
      # @rate_limited true
      def location_recent_media(id, *args)
        options = args.last.is_a?(Hash) ? args.pop : {}
        response = get("locations/#{id}/media/recent", options)
        response
      end

      # Returns Instagram locations within proximity of given lat,lng
      #
      # @param lat [String] A given latitude in decimal format
      # @param lng [String] A given longitude in decimal format
      # @option options [Integer] :count The number of media items to retrieve.
      # @return [Hashie::Mash] location results
      # @example Return locations around 37.7808851, -122.3948632 (164 S Park, SF, CA USA)
      # Instagram.location_search("37.7808851", "-122.3948632")
      # @see TODO:doc url
      # @format :json
      # @authenticated false
      # @rate_limited true
      def location_search(lat, lng, options={})
        response = get('locations/search', options.merge(:lat => lat, :lng => lng))
        response
      end
    end
  end
end
Something went wrong with that request. Please try again.