Module: Instagram::Client::Users

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

Overview

Defines methods related to users

Instance Method Summary collapse

Instance Method Details

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

Returns extended information of a given user

Returns The requested user.

Examples:

Return extended information for @shayne

Instagram.user(20)

See Also:

Rate Limited:

  • true

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).

Supported formats:

  • :json


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

def user(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  id = args.first || 'self'
  response = get("users/#{id}", options)
  response
end

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

Returns a list of users whom a given user follows

Overloads:

  • #user_follows(id = nil, options = {}) ⇒ Hashie::Mash

    Examples:

    Returns a list of users the authenticated user follows

    Instagram.user_follows
  • #user_follows(id = nil, options = {}) ⇒ Hashie::Mash

    Examples:

    Return a list of users @mikeyk follows

    Instagram.user_follows(4) # @mikeyk user ID being 4

    Options Hash (options):

    • :cursor (Integer) — default: nil

      Breaks the results into pages. Provide values as returned in the response objects's next_cursor attribute to page forward in the list.

    • :count (Integer) — default: nil

      Limits the number of results returned per page.

See Also:

Rate Limited:

  • true

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).

Supported formats:

  • :json


63
64
65
66
67
68
# File 'lib/instagram/client/users.rb', line 63

def user_follows(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  id = args.first || "self"
  response = get("users/#{id}/follows", options)
  response
end

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

Returns users that match the given query

Examples:

Return users that match "Shayne Sweeney"

Instagram.user_search("Shayne Sweeney")

Options Hash (options):

  • :count (Integer)

    The number of users to retrieve.

See Also:

Rate Limited:

  • true

Requires Authentication:

  • false

Supported formats:

  • :json


37
38
39
40
# File 'lib/instagram/client/users.rb', line 37

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