Skip to content

Commit e95b006

Browse files
committed
ProfileScraper#achievements => achievement_points
1 parent 53d567e commit e95b006

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

lib/bnet_scraper/starcraft2/profile_scraper.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ module Starcraft2
2020
# the URL and have to make do with a bnet_id and account. This is the bare minimum needed,
2121
# unless the account is in a region other than 'na'. In such cases, region all needs to be passed.
2222
class ProfileScraper < BaseScraper
23+
attr_reader :achievement_points, :wins, :race, :leagues
2324
def scrape
2425
get_profile_data
2526
get_league_list
@@ -31,7 +32,7 @@ def get_profile_data
3132

3233
@race = response.css("#season-snapshot .module-footer a").first().inner_html()
3334
@wins = response.css("#career-stats h2").inner_html()
34-
@achievements = response.css("#profile-header h3").inner_html()
35+
@achievement_points = response.css("#profile-header h3").inner_html()
3536
end
3637

3738
def get_league_list
@@ -53,7 +54,7 @@ def output
5354
bnet_index: @bnet_index,
5455
race: @race,
5556
wins: @wins,
56-
achievements: @achievements,
57+
achievement_points: @achievement_points,
5758
leagues: @leagues
5859
}
5960
end

spec/starcraft2/profile_scraper_spec.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@
1111
describe '#get_profile_data' do
1212
it 'should set the race, wins, and achievements attributes' do
1313
subject.instance_variable_get(:@race).should be_nil
14-
subject.instance_variable_get(:@achievements).should be_nil
14+
subject.instance_variable_get(:@achievement_points).should be_nil
1515
subject.instance_variable_get(:@wins).should be_nil
1616

1717
subject.get_profile_data
1818

1919
subject.instance_variable_get(:@race).should == 'Protoss'
20-
subject.instance_variable_get(:@achievements).should == '3630'
20+
subject.instance_variable_get(:@achievement_points).should == '3630'
2121
subject.instance_variable_get(:@wins).should == '684'
2222
end
2323
end
@@ -55,7 +55,7 @@
5555
bnet_index: 1,
5656
race: 'Protoss',
5757
wins: '684',
58-
achievements: '3630',
58+
achievement_points: '3630',
5959
leagues: [
6060
{
6161
name: "1v1 Platinum Rank 95",
@@ -120,7 +120,7 @@
120120
]
121121
}
122122

123-
subject.output.should == { bnet_id: '2377239', account: 'Demon', bnet_index: 1, race: nil, wins: nil, achievements: nil, leagues: nil }
123+
subject.output.should == { bnet_id: '2377239', account: 'Demon', bnet_index: 1, race: nil, wins: nil, achievement_points: nil, leagues: nil }
124124
subject.scrape
125125
subject.output.should == expected
126126
end

spec/starcraft2_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
:bnet_index=>1,
1010
:race=>"Protoss",
1111
:wins=>"684",
12-
:achievements=>"3630",
12+
:achievement_points=>"3630",
1313
:leagues=>[
1414
{:season=>"6", :size=>"4v4", :name=>"Aleksander Pepper", :division=>"Diamond", :random=>false, :bnet_id=>"2377239", :account=>"Demon"},
1515
{:season=>"6", :size=>"4v4", :name=>"Aleksander Pepper", :division=>"Diamond", :random=>false, :bnet_id=>"2377239", :account=>"Demon"},

0 commit comments

Comments
 (0)