Module: Twitter::REST::Trends

Includes:
Utils
Included in:
API
Defined in:
lib/twitter/rest/trends.rb

Overview

Methods for accessing trending topics

Constant Summary

Constants included from Utils

Utils::DEFAULT_CURSOR

Instance Method Summary collapse

Methods included from Utils

flat_pmap, pmap

Instance Method Details

Returns the top 50 trending topics for a specific WOEID

Examples:

client.trends

Parameters:

  • id (Integer) (defaults to: 1)

    The Yahoo! Where On Earth ID of the location.

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

    A customizable set of options.

Options Hash (options):

  • :exclude (String)

    Setting this equal to ‘hashtags’ excludes hashtags.

Returns:

Raises:

See Also:



25
26
27
28
29
30
# File 'lib/twitter/rest/trends.rb', line 25

def trends(id = 1, options = {})
  options = options.dup
  options[:id] = id
  response, = perform_get("/1.1/trends/place.json", options)
  TrendResults.new(response)
end

Returns locations with trending topic information

Examples:

client.trends_available

Parameters:

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

    A customizable set of options.

Returns:

Raises:

See Also:



51
52
53
# File 'lib/twitter/rest/trends.rb', line 51

def trends_available(options = {})
  perform_get_with_objects("/1.1/trends/available.json", options, Place)
end

Returns trend locations closest to a specified location

Examples:

client.trends_closest(lat: 37.7821, long: -122.4093)

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :lat (Float)

    The latitude to search around.

  • :long (Float)

    The longitude to search around.

Returns:

Raises:

See Also:



72
73
74
# File 'lib/twitter/rest/trends.rb', line 72

def trends_closest(options = {})
  perform_get_with_objects("/1.1/trends/closest.json", options, Place)
end