Module: Instagram::Client::Locations

Included in:
Instagram::Client
Defined in:
lib/instagram/client/locations.rb

Overview

Defines methods related to media items

Instance Method Summary collapse

Instance Method Details

#location(id) ⇒ Hashie::Mash

Returns extended information of a given Instagram location

Returns The requested location.

Examples:

Return extended information for the Instagram office

Instagram.location(514276)

Parameters:

  • location (Integer)

    An Instagram location ID

Returns:

  • (Hashie::Mash)

    The requested location.

See Also:

  • url


16
17
18
19
# File 'lib/instagram/client/locations.rb', line 16

def location(id, *args)
  response = get("locations/#{id}")
  response["data"]
end

#location_recent_media(id, options = {}) ⇒ Hashie::Mash

Returns a list of recent media items for a given Instagram location

Examples:

Return a list of the most recent media items taken at the Instagram office

Instagram.location_recent_media(514276)

Parameters:

  • user (Integer)

    An Instagram location ID.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :max_id (Integer) — default: nil

    Returns results with an ID less than (that is, older than) or equal to the specified ID.

  • :count (Integer) — default: nil

    Limits the number of results returned per page.

Returns:

  • (Hashie::Mash)

See Also:

  • url


35
36
37
38
39
# File 'lib/instagram/client/locations.rb', line 35

def location_recent_media(id, *args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  response = get("locations/#{id}/media/recent", options)
  response
end

#location_search(lat, lng, options = {}) ⇒ Array

Returns Instagram locations within proximity of given lat,lng

Examples:

Return locations around 37.7808851, -122.3948632 (164 S Park, SF, CA USA)

Instagram.location_search("37.7808851", "-122.3948632")

Parameters:

  • lat (String)

    A given latitude in decimal format

  • lng (String)

    A given longitude in decimal format

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :count (Integer)

    The number of media items to retrieve.

Returns:

  • (Array)

See Also:

  • url


53
54
55
56
# File 'lib/instagram/client/locations.rb', line 53

def location_search(lat, lng, options={})
  response = get('locations/search', options.merge(:lat => lat, :lng => lng))
  response["data"]
end