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:

  • url


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

def tag(tag, *args)
  response = get("tags/#{tag}")
  response["data"]
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:

  • user (String)

    An Instagram tag name.

  • 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/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)
  response
end

#tag_search(query, options = {}) ⇒ Array

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:

  • (Array)

See Also:

  • url


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["data"]
end