Module: Instagram::Client::Media

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

Overview

Defines methods related to media items

Instance Method Summary collapse

Instance Method Details

#media_item(id) ⇒ Hashie::Mash

Returns extended information of a given media item

Returns The requested media item.

Examples:

Return extended information for media item 1234

Instagram.media_item(1324)

Parameters:

  • user (Integer)

    An Instagram media item ID

Returns:

  • (Hashie::Mash)

    The requested media item.

See Also:

Supported formats:

  • :json

Requires Authentication:

  • 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



18
19
20
21
22
# File 'lib/instagram/client/media.rb', line 18

def media_item(*args)
  id = args.first || 'self'
  response = get("media/#{id}")
  response
end

Returns a list of the overall most popular media

Examples:

Returns a list of the overall most popular media

Instagram.media_popular

Parameters:

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

    A customizable set of options.

Returns:

  • (Hashie::Mash)

See Also:

Supported formats:

  • :json

Requires Authentication:

  • 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



37
38
39
40
41
42
# File 'lib/instagram/client/media.rb', line 37

def media_popular(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  id = args.first || "self"
  response = get("media/popular", options)
  response
end

#media_search(lat, lng, options = {}) ⇒ Hashie::Mash

Returns media items within proximity of given lat,lng

Examples:

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

Instagram.media_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:

  • (Hashie::Mash)

    A list of matching media

See Also:

Supported formats:

  • :json

Requires Authentication:

  • false

Rate Limited:

  • true



57
58
59
60
# File 'lib/instagram/client/media.rb', line 57

def media_search(lat, lng, options={})
  response = get('media/search', options.merge(:lat => lat, :lng => lng))
  response
end