Module: Twitter::REST::Trends

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

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

Parameters:

  • id (Integer) (defaults to: 1)

    The Yahoo! Where On Earth ID of the location to return trending information for. WOEIDs can be retrieved by calling #trends_available. Global information is available by using 1 as the WOEID.

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

    A customizable set of options.

Options Hash (options):

  • :exclude (String)

    Setting this equal to 'hashtags' will remove all hashtags from the trends list.

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



21
22
23
24
25
26
# File 'lib/twitter/rest/trends.rb', line 21

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

Returns the locations that Twitter has trending topic information for

Parameters:

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

    A customizable set of options.

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



38
39
40
# File 'lib/twitter/rest/trends.rb', line 38

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

Returns the locations that Twitter has trending topic information for, closest to a specified location.

Parameters:

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

    A customizable set of options.

Options Hash (options):

  • :lat (Float)

    If provided with a :long option the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for latitude are -90.0 to +90.0 (North is positive) inclusive.

  • :long (Float)

    If provided with a :lat option the available trend locations will be sorted by distance, nearest to furthest, to the co-ordinate pair. The valid ranges for longitude are -180.0 to +180.0 (East is positive) inclusive.

Returns:

Raises:

See Also:

Rate Limited?:

  • Yes

Authentication:

  • Requires user context



53
54
55
# File 'lib/twitter/rest/trends.rb', line 53

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