Class: SC2Achievements::CategoryPage

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

Class Method Summary collapse

Methods inherited from Page

get_categories_for

Class Method Details

.get_achievements_for(user_path, category) ⇒ Object



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

def self.get_achievements_for(user_path, category)
  page = fetch_page_of user_path, :category => category
  page.css('.achievement.earned', '.series-tiles .series-tile:not(.tile-locked)').inject({}) do |achievements, achievement|
    achievements[key_for(achievement)] = {
      :title       => title_of(achievement),
      :description => description_of(achievement),
      :category    => category_of(achievement),
      :points      => points_of(achievement),
      :date        => date_of(achievement) }
    achievements
  end
end