Skip to content

Commit bc99351

Browse files
committed
Adds MatchHistory documentation
1 parent 7192443 commit bc99351

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

lib/bnet_scraper/starcraft2/match_history_scraper.rb

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
module BnetScraper
22
module Starcraft2
3-
# MatchHistoryScraper
3+
## BnetScraper::Starcraft2::MatchHistoryScraper
4+
#
5+
# This pulls the 25 most recent matches played for an account. Note that this is only as up-to-date as battle.net is, and
6+
# will likely not be as fast as in-game.
47
#
5-
# Scrapes the 25 most recent matches played by an account and returns it
6-
# as an array of match hashes.
8+
# scraper = BnetScraper::Starcraft2::MatchHistoryScraper.new(url: 'http://us.battle.net/sc2/en/profile/2377239/1/Demon/')
9+
# scraper.scrape
10+
# # => {
11+
# wins: '15',
12+
# losses: '10',
13+
# matches: [
14+
# { map_name: 'Bx Monobattle - Sand Canyon (Fix)', outcome: :win, type: 'Custom', date: '3/12/2012' },
15+
# { map_name: 'Deadlock Ridge', outcome: :loss, type: '4v4', date: '3/12/2012' },
16+
# { map_name: 'District 10', outcome: :win, type: '4v4', date: '3/12/2012' },
17+
# # ...
18+
# ]
19+
# }
720
class MatchHistoryScraper < BaseScraper
821
attr_reader :matches, :wins, :losses, :response
9-
22+
1023
def match_url
1124
profile_url + "matches"
1225
end

0 commit comments

Comments
 (0)