Module: BnetScraper::Starcraft2

Defined in:
lib/bnet_scraper/starcraft2.rb,
lib/bnet_scraper/starcraft2/match.rb,
lib/bnet_scraper/starcraft2/league.rb,
lib/bnet_scraper/starcraft2/profile.rb,
lib/bnet_scraper/starcraft2/portrait.rb,
lib/bnet_scraper/starcraft2/achievement.rb,
lib/bnet_scraper/starcraft2/base_scraper.rb,
lib/bnet_scraper/starcraft2/league_scraper.rb,
lib/bnet_scraper/starcraft2/status_scraper.rb,
lib/bnet_scraper/starcraft2/profile_scraper.rb,
lib/bnet_scraper/starcraft2/achievement_scraper.rb,
lib/bnet_scraper/starcraft2/grandmaster_scraper.rb,
lib/bnet_scraper/starcraft2/match_history_scraper.rb

Overview

This module contains everything about scraping Starcraft 2 Battle.net accounts. See `BnetScraper::Starcraft2::ProfileScraper` and `BnetScraper::Starcraft2::LeagueScraper` for more details

Defined Under Namespace

Classes: Achievement, AchievementScraper, BaseScraper, GrandmasterScraper, League, LeagueScraper, Match, MatchHistoryScraper, Portrait, Profile, ProfileScraper, Status

Constant Summary

REGIONS =
{
  'na'  => { domain: 'us.battle.net', dir: 'en', label: 'North America' },
  'eu'  => { domain: 'eu.battle.net', dir: 'en', label: 'Europe' },
  'cn'  => { domain: 'www.battlenet.com.cn', dir: 'zh', label: 'China' },
  'sea' => { domain: 'sea.battle.net', dir: 'en', label: 'South-East Asia' },
  'fea' => { domain: 'tw.battle.net', dir: 'zh', label: 'Korea' }
}
REGION_DOMAINS =
{
  'us.battle.net' => 'na',
  'eu.battle.net' => 'eu',
  'www.battlenet.com.cn' => 'cn',
  'sea.battle.net' => 'sea',
  'kr.battle.net' => 'fea',
  'tw.battle.net' => 'fea'
}

Class Method Summary collapse

Class Method Details

.full_profile_scrape(options = {}) ⇒ BnetScraper::Profile

This is a convenience method that chains calls to ProfileScraper, followed by a scrape of each league returned in the `leagues` array in the profile_data. The end result is a fully scraped profile with profile and league data in a hash.

See `BnetScraper::Starcraft2::ProfileScraper` for more information on the parameters being sent to `#full_profile_scrape`.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/bnet_scraper/starcraft2.rb', line 42

def self.full_profile_scrape options = {}
  profile_scraper = ProfileScraper.new options
  profile = profile_scraper.scrape
  profile.leagues.each do |league|
    league.scrape
  end
  profile.achievements
  profile.match_history
  
  return profile
end

.valid_profile?(options) ⇒ TrueClass, FalseClass

Determine if Supplied profile is valid. Useful for validating now before an async scraping later



59
60
61
62
# File 'lib/bnet_scraper/starcraft2.rb', line 59

def self.valid_profile? options
  scraper = BaseScraper.new(options)
  scraper.valid?
end