Sha256: d9664f52ab90e520e30da5bf3e4d537f9e21eec6aa7f562620398f0b94da1a35

Contents?: true

Size: 988 Bytes

Versions: 5

Compression:

Stored size: 988 Bytes

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), "local_trends")

module Twitter
  class Trends
    include HTTParty
    base_uri "search.twitter.com/trends"
    format :json

    # :exclude => 'hashtags' to exclude hashtags
    def self.current(options={})
      mashup(get("/current.json", :query => options))
    end

    # :exclude => 'hashtags' to exclude hashtags
    # :date => yyyy-mm-dd for specific date
    def self.daily(options={})
      mashup(get("/daily.json", :query => options))
    end

    # :exclude => 'hashtags' to exclude hashtags
    # :date => yyyy-mm-dd for specific date
    def self.weekly(options={})
      mashup(get("/weekly.json", :query => options))
    end

    def self.available(query={})
      LocalTrends.available(query)
    end

    def self.for_location(woeid)
      LocalTrends.for_location(woeid)
    end

    private

    def self.mashup(response)
      response["trends"].values.flatten.map{|t| Twitter.mash(t)}
    end

  end
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
twitter-jruby-0.9.7.2010061001 lib/twitter/trends.rb
twitter-jruby-0.9.5.2010052501 lib/twitter/trends.rb
twitter-jruby-0.9.5.2010050701 lib/twitter/trends.rb
secobarbital-twitter-0.9.2.2 lib/twitter/trends.rb
secobarbital-twitter-0.9.2.1 lib/twitter/trends.rb