Class: MostPopular::Trending::TrendingStory
- Inherits:
-
Object
- Object
- MostPopular::Trending::TrendingStory
- Defined in:
- lib/most-popular/trending.rb
Instance Method Summary collapse
-
#initialize(analytics) ⇒ TrendingStory
constructor
A new instance of TrendingStory.
- #trending_stories(date: :last_day, num_results: 10) ⇒ Object
Constructor Details
#initialize(analytics) ⇒ TrendingStory
Returns a new instance of TrendingStory.
5 6 7 |
# File 'lib/most-popular/trending.rb', line 5 def initialize(analytics) @analytics = analytics end |
Instance Method Details
#trending_stories(date: :last_day, num_results: 10) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/most-popular/trending.rb', line 9 def trending_stories(date: :last_day, num_results: 10) start_date, end_date = dates_for(date) rows = @analytics.summarize({start_date: start_date, end_date: end_date, num_results: num_results}) rows.collect do |r| ViewedStory.new(r.first, r.last) end end |