Class: SC2Achievements::Homepage

Inherits:
Page
  • Object
show all
Defined in:
lib/sc2_achievements/homepage.rb

Class Method Summary collapse

Methods inherited from Page

get_categories_for

Class Method Details

.get_achievements_for(user_path) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/sc2_achievements/homepage.rb', line 6

def self.get_achievements_for(user_path)
  page = fetch_page_of user_path
  page.css('#recent-achievements a').each_with_index.inject({}) do |achievements, (achievement, index)|
    achievements[key_for(achievement)] = {
      :title       => title_of(achievement),
      :description => description_of(achievement),
      :date        => date_of(achievement),
      :recentness  => index + 1 }
    achievements
  end
end