Class: SC2Achievements::Page

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

Direct Known Subclasses

CategoryPage, Homepage

Class Method Summary collapse

Class Method Details

.get_achievements_for(user_path, options = {}) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/sc2_achievements/page.rb', line 11

def self.get_achievements_for(user_path, options = {})
  if options.has_key? :category
    CategoryPage.get_achievements_for user_path, options[:category]
  else
    Homepage.get_achievements_for user_path
  end
end

.get_categories_for(user_path, options = {}) ⇒ Object



19
20
21
22
23
24
# File 'lib/sc2_achievements/page.rb', line 19

def self.get_categories_for(user_path, options = {})
  page = fetch_page_of user_path, options
  page.css('#profile-menu a[href*=category]').collect do |achievement|
    achievement.attr('href')[/category\/(.*)/, 1]
  end
end