Module: Twitter::Client::SuggestedUsers

Included in:
Twitter::Client
Defined in:
lib/twitter/client/suggested_users.rb

Overview

Defines methods related to users

Instance Method Summary collapse

Instance Method Details

#suggest_users(slug, options = {}) ⇒ Array<Twitter::User>

Access the users in a given category of the Twitter suggested user list and return their most recent status if they are not a protected user

Examples:

Return the users in the Art & Design category and their most recent status if they are not a protected user

Twitter.suggest_users("art-design")

Parameters:

  • slug (String)

    The short name of list or a category.

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

    A customizable set of options.

Returns:

See Also:

Rate Limited?:

  • Yes

Requires Authentication?:

  • No



52
53
54
55
56
# File 'lib/twitter/client/suggested_users.rb', line 52

def suggest_users(slug, options={})
  get("/1/users/suggestions/#{slug}/members.json", options).map do |user|
    Twitter::User.new(user)
  end
end

#suggestions(options = {}) ⇒ Array<Twitter::Suggestion> #suggestions(slug, options = {}) ⇒ Array<Twitter::Suggestion>

Overloads:



30
31
32
33
34
35
36
37
38
39
40
# File 'lib/twitter/client/suggested_users.rb', line 30

def suggestions(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  if slug = args.first
    suggestion = get("/1/users/suggestions/#{slug}.json", options)
    Twitter::Suggestion.new(suggestion)
  else
    get("/1/users/suggestions.json", options).map do |suggestion|
      Twitter::Suggestion.new(suggestion)
    end
  end
end