Module: Instagram::Client::Media

Included in:
Instagram::Client
Defined in:
lib/instagram_api/client/media.rb

Overview

Methods for the Media API.

Instance Method Summary collapse

Instance Method Details

#media(id) ⇒ Hashie::Mash

Get information about a media object.

Examples:

client.media(5211)

Parameters:

  • id (Integer)

    The ID of the media item.

Returns:

  • (Hashie::Mash)

See Also:



16
17
18
# File 'lib/instagram_api/client/media.rb', line 16

def media(id)
  get "/media/#{id}", auth_params
end

#media_search(options = {}) ⇒ Object

Search for media in a given area.

Examples:

Perform a search based on latitude and longitude.

client.media_search(:lat => "48.858844", :lng => "2.294351")

Search within 2km of a location.

client.media_search(:lat => "48.858844", :lng => "2.294351", :distance => 2000)

Constrain results by timestamp.

client.media_search(
  :lat => "48.858844",
  :lng => "2.294351",
  :min_timestamp => 1357020000,
  :max_timestamp => 1375246800
)

Parameters:

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

    Options.

Options Hash (options):

  • :lat (String) — default: required

    Latitude of the center search coordinate.

  • :lng (String) — default: required

    Longitude of the center search coordinate.

  • :max_timestamp (Integer)

    A unix timestamp. All media returned will be taken earlier than this timestamp.

  • :min_timestamp (Integer)

    A unix timestamp. All media returned will be taken later than this timestamp.

  • :distance (Integer)

    Default is 1km (distance=1000), max distance is 5km.

See Also:



40
41
42
# File 'lib/instagram_api/client/media.rb', line 40

def media_search(options={})
  get '/media/search', auth_params.merge(options)
end

Get a list of what media is most popular at the moment.



48
49
50
# File 'lib/instagram_api/client/media.rb', line 48

def popular_media
  get '/media/popular', auth_params
end