Module: Twitter::Client::Trends
- Included in:
- Twitter::Client
- Defined in:
- lib/twitter/client/trends.rb
Overview
Defines methods related to global trends
Instance Method Summary collapse
-
#trends_daily(date = Date.today, options = {}) ⇒ Hash
Returns the top 20 trending topics for each hour in a given day.
-
#trends_weekly(date = Date.today, options = {}) ⇒ Hash
Returns the top 30 trending topics for each day in a given week.
Instance Method Details
#trends_daily(date = Date.today, options = {}) ⇒ Hash
Returns the top 20 trending topics for each hour in a given day
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/twitter/client/trends.rb', line 20 def trends_daily(date=Date.today, ={}) trends = {} get("/1/trends/daily.json", .merge(:date => date.strftime('%Y-%m-%d')))['trends'].each do |key, value| trends[key] = [] value.each do |trend| trends[key] << Twitter::Trend.new(trend) end end trends end |
#trends_weekly(date = Date.today, options = {}) ⇒ Hash
Returns the top 30 trending topics for each day in a given week
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/twitter/client/trends.rb', line 42 def trends_weekly(date=Date.today, ={}) trends = {} get("/1/trends/weekly.json", .merge(:date => date.strftime('%Y-%m-%d')))['trends'].each do |key, value| trends[key] = [] value.each do |trend| trends[key] << Twitter::Trend.new(trend) end end trends end |