Sha256: b521a41fc1a3176f015b78cb9d99ef5e5495732d25d0d22da97eb574a3410146

Contents?: true

Size: 772 Bytes

Versions: 24

Compression:

Stored size: 772 Bytes

Contents

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
    
    private
      def self.mashup(response)
        response['trends'].values.flatten.map { |t| Mash.new(t) }
      end
  end
end

Version data entries

24 entries across 24 versions & 13 rubygems

Version Path
arthurgeek-twitter-0.6.15 lib/twitter/trends.rb
codetocustomer-twitter-0.6.14 lib/twitter/trends.rb
ddollar-twitter-0.6.15 lib/twitter/trends.rb
ddollar-twitter-0.6.16 lib/twitter/trends.rb
ddollar-twitter-0.6.17 lib/twitter/trends.rb
ddollar-twitter-0.7.0 lib/twitter/trends.rb
deadprogrammer-twitter-0.6.11 lib/twitter/trends.rb
deadprogrammer-twitter-0.6.12 lib/twitter/trends.rb
egze-twitter-0.6.13 lib/twitter/trends.rb
jnunemaker-twitter-0.6.10 lib/twitter/trends.rb
jnunemaker-twitter-0.6.11 lib/twitter/trends.rb
jnunemaker-twitter-0.6.12 lib/twitter/trends.rb
jnunemaker-twitter-0.6.13 lib/twitter/trends.rb
jnunemaker-twitter-0.6.14 lib/twitter/trends.rb
jnunemaker-twitter-0.6.15 lib/twitter/trends.rb
michaeltaras-twitter-0.6.13 lib/twitter/trends.rb
ministrycentered-twitter-0.6.12 lib/twitter/trends.rb
nobert-twitter-0.6.12 lib/twitter/trends.rb
nobert-twitter-0.6.13 lib/twitter/trends.rb
paulsingh-twitter-0.6.13 lib/twitter/trends.rb