Module: Instagram::Client::Tags

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

Overview

Defines methods related to tags

Instance Method Summary collapse

Instance Method Details

#tag(tag) ⇒ Hashie::Mash

Returns extended information of a given Instagram tag

Returns The requested tag.

Examples:

Return extended information for the tag "cat"

Instagram.tag('cat')

Parameters:

  • tag (String)

    An Instagram tag name

Returns:

  • (Hashie::Mash)

    The requested tag.

See Also:

Requires Authentication:

  • false

Supported formats:

  • :json

Rate Limited:

  • true



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

def tag(tag, *args)
  response = get("tags/#{tag}")
  response
end

#tag_recent_media(tag, options = {}) ⇒ Hashie::Mash

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

Examples:

Return a list of the most recent media items tagged "cat"

Instagram.tag_recent_media('cat')

Parameters:

  • tag-name (String)

    An Instagram tag name.

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

    A customizable set of options.

Options Hash (options):

  • :max_tag_id (Integer) — default: nil

    Returns results with an ID less than (that is, older than) or equal to the specified ID. The value can be retrieved from the returned response via pagination.max_tag_id.

  • :min_tag_id (Integer) — default: nil

    Returns results with an ID greater than (that is, newer than) or equal to the specified ID. The value can be retrieved from the returned response via pagination.min_tag_id.

Returns:

  • (Hashie::Mash)

See Also:

Requires Authentication:

  • false

Supported formats:

  • :json

Rate Limited:

  • true



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

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

#tag_search(query, options = {}) ⇒ Hashie::Mash

Returns a list of tags starting with the given search query

Examples:

Return tags that start with "cat"

Instagram.tag_search("cat")

Parameters:

  • query (String)

    The beginning or complete tag name to search for

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

    A customizable set of options.

Options Hash (options):

  • :count (Integer)

    The number of media items to retrieve.

Returns:

  • (Hashie::Mash)

See Also:

Requires Authentication:

  • false

Supported formats:

  • :json

Rate Limited:

  • true



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

def tag_search(query, options={})
  response = get('tags/search', options.merge(:q => query))
  response
end