Module: Twitter::Client::LocalTrends

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

Overview

Defines methods related to local trends

See Also:

Instance Method Summary collapse

Instance Method Details

Returns the top 10 trending topics for a specific WOEID

Examples:

Return the top 10 trending topics for San Francisco

Twitter.local_trends(2487956)

Parameters:

  • woeid (Integer) (defaults to: 1)

    The Yahoo! Where On Earth ID of the location to return trending information for. WOEIDs can be retrieved by calling #trend_locations. 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:

See Also:

Rate Limited?:

  • Yes

Requires Authentication?:

  • No



21
22
23
24
25
# File 'lib/twitter/client/local_trends.rb', line 21

def local_trends(woeid=1, options={})
  get("/1/trends/#{woeid}.json", options).first['trends'].map do |trend|
    Twitter::Trend.new(trend)
  end
end

#trend_locations(options = {}) ⇒ Array<Twitter::Place>

Returns the locations that Twitter has trending topic information for

Examples:

Return the locations that Twitter has trending topic information for

Twitter.trend_locations

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:

See Also:

Rate Limited?:

  • Yes

Requires Authentication?:

  • No



38
39
40
41
42
# File 'lib/twitter/client/local_trends.rb', line 38

def trend_locations(options={})
  get("/1/trends/available.json", options).map do |place|
    Twitter::Place.new(place)
  end
end