sports_data_api 0.12.1 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/lib/sports_data_api/merged_stats.rb +15 -0
- data/lib/sports_data_api/mlb.rb +0 -1
- data/lib/sports_data_api/nhl/broadcast.rb +1 -9
- data/lib/sports_data_api/nhl/game.rb +44 -30
- data/lib/sports_data_api/nhl/games.rb +16 -13
- data/lib/sports_data_api/nhl/player.rb +4 -25
- data/lib/sports_data_api/nhl/season.rb +15 -10
- data/lib/sports_data_api/nhl/team.rb +38 -17
- data/lib/sports_data_api/nhl/teams.rb +14 -65
- data/lib/sports_data_api/nhl/venue.rb +1 -15
- data/lib/sports_data_api/nhl.rb +9 -9
- data/lib/sports_data_api/version.rb +1 -1
- data/lib/sports_data_api.rb +1 -0
- data/spec/cassettes/sports_data_api_nhl.yml +22186 -18938
- data/spec/cassettes/sports_data_api_nhl_broadcast.yml +209 -193
- data/spec/cassettes/sports_data_api_nhl_game.yml +29397 -23777
- data/spec/cassettes/sports_data_api_nhl_games.yml +210 -194
- data/spec/cassettes/sports_data_api_nhl_league_hierarchy.yml +567 -488
- data/spec/cassettes/sports_data_api_nhl_player.yml +3588 -328
- data/spec/cassettes/sports_data_api_nhl_season.yml +15674 -18921
- data/spec/cassettes/sports_data_api_nhl_team.yml +3901 -2100
- data/spec/cassettes/sports_data_api_nhl_venue.yml +170 -193
- data/spec/lib/sports_data_api/{mlb/merged_stats_spec.rb → merged_stats_spec.rb} +4 -4
- data/spec/lib/sports_data_api/mlb/statistics_spec.rb +5 -5
- data/spec/lib/sports_data_api/nhl/broadcast_spec.rb +7 -4
- data/spec/lib/sports_data_api/nhl/game_spec.rb +65 -38
- data/spec/lib/sports_data_api/nhl/player_spec.rb +92 -40
- data/spec/lib/sports_data_api/nhl/season_spec.rb +1 -1
- data/spec/lib/sports_data_api/nhl/team_spec.rb +94 -182
- data/spec/lib/sports_data_api/nhl/teams_spec.rb +14 -65
- data/spec/lib/sports_data_api/nhl/venue_spec.rb +12 -9
- data/spec/lib/sports_data_api/nhl_spec.rb +94 -12
- metadata +5 -5
- data/lib/sports_data_api/mlb/merged_stats.rb +0 -17
@@ -7,50 +7,102 @@ describe SportsDataApi::Nhl::Player, vcr: {
|
|
7
7
|
} do
|
8
8
|
before do
|
9
9
|
SportsDataApi.set_key(:nhl, api_key(:nhl))
|
10
|
-
SportsDataApi.set_access_level(:nhl, '
|
10
|
+
SportsDataApi.set_access_level(:nhl, 'trial')
|
11
11
|
end
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
expect(
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
expect(
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
expect(
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
expect(
|
34
|
-
|
35
|
-
|
36
|
-
it 'should have an abbr_name' do
|
37
|
-
expect(subject[:abbr_name]).to eq 'B.Flynn'
|
38
|
-
end
|
39
|
-
|
40
|
-
it 'should have a handedness' do
|
41
|
-
expect(subject[:handedness]).to eq 'R'
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should have a position' do
|
45
|
-
expect(subject[:position]).to eq 'F'
|
12
|
+
context 'when from team_roster' do
|
13
|
+
let(:roster) { SportsDataApi::Nhl.team_roster('4416091c-0f24-11e2-8525-18a905767e44') }
|
14
|
+
let(:players) { roster.players }
|
15
|
+
it 'parses out the data' do
|
16
|
+
player = players.find do |x|
|
17
|
+
x.player[:id] == '431e124a-0f24-11e2-8525-18a905767e44'
|
18
|
+
end
|
19
|
+
expect(player[:status]).to eq 'ACT'
|
20
|
+
expect(player[:full_name]).to eq 'Zach Parise'
|
21
|
+
expect(player[:first_name]).to eq 'Zach'
|
22
|
+
expect(player[:last_name]).to eq 'Parise'
|
23
|
+
expect(player[:abbr_name]).to eq 'Z.Parise'
|
24
|
+
expect(player[:height]).to eq 71
|
25
|
+
expect(player[:weight]).to eq 196
|
26
|
+
expect(player[:position]).to eq 'F'
|
27
|
+
expect(player[:primary_position]).to eq 'LW'
|
28
|
+
expect(player[:jersey_number]).to eq '11'
|
29
|
+
expect(player[:experience]).to eq '11'
|
30
|
+
expect(player[:college]).to eq 'North Dakota'
|
31
|
+
expect(player[:birth_place]).to eq 'Minneapolis, MN, USA'
|
32
|
+
expect(player[:birthdate]).to eq '1984-07-28'
|
33
|
+
expect(player[:updated]).to eq '2018-01-02T18:04:00+00:00'
|
34
|
+
expect(player[:reference]).to eq '8470610'
|
35
|
+
expect(player.stats).to be_nil
|
46
36
|
end
|
37
|
+
end
|
47
38
|
|
48
|
-
|
49
|
-
|
50
|
-
|
39
|
+
context 'when from .game_summary' do
|
40
|
+
let(:game_summary) { SportsDataApi::Nhl.game_summary('af285aa3-3d80-4051-9449-5b58e5985a4e') }
|
41
|
+
let(:team) { game_summary.home_team }
|
42
|
+
let(:players) { team.players }
|
51
43
|
|
52
|
-
it '
|
53
|
-
|
44
|
+
it 'parses out the data' do
|
45
|
+
player = players.find do |x|
|
46
|
+
x.player[:id] == '431e124a-0f24-11e2-8525-18a905767e44'
|
47
|
+
end
|
48
|
+
expect(player[:status]).to be_nil
|
49
|
+
expect(player[:full_name]).to eq 'Zach Parise'
|
50
|
+
expect(player[:first_name]).to eq 'Zach'
|
51
|
+
expect(player[:last_name]).to eq 'Parise'
|
52
|
+
expect(player[:position]).to eq 'F'
|
53
|
+
expect(player[:primary_position]).to eq 'LW'
|
54
|
+
expect(player[:jersey_number]).to eq '11'
|
55
|
+
expect(player[:starter]).to eq true
|
56
|
+
expect(player[:played]).to eq true
|
57
|
+
expect(player.stats).to be_a SportsDataApi::MergedStats
|
58
|
+
expect(player.stats[:total_goals]).to eq 0
|
59
|
+
expect(player.stats[:total_assists]).to eq 1
|
60
|
+
expect(player.stats[:total_penalties]).to eq 1
|
61
|
+
expect(player.stats[:total_penalty_minutes]).to eq 2
|
62
|
+
expect(player.stats[:total_shots]).to eq 2
|
63
|
+
expect(player.stats[:total_blocked_att]).to eq 0
|
64
|
+
expect(player.stats[:total_missed_shots]).to eq 2
|
65
|
+
expect(player.stats[:total_hits]).to eq 1
|
66
|
+
expect(player.stats[:total_giveaways]).to eq 0
|
67
|
+
expect(player.stats[:total_takeaways]).to eq 2
|
68
|
+
expect(player.stats[:total_blocked_shots]).to eq 2
|
69
|
+
expect(player.stats[:total_faceoffs_won]).to eq 0
|
70
|
+
expect(player.stats[:total_faceoffs_lost]).to eq 0
|
71
|
+
expect(player.stats[:total_plus_minus]).to eq(-1)
|
72
|
+
expect(player.stats[:total_shooting_pct]).to eq 0
|
73
|
+
expect(player.stats[:total_faceoff_win_pct]).to eq 0
|
74
|
+
expect(player.stats[:total_faceoffs]).to eq 0
|
75
|
+
expect(player.stats[:total_points]).to eq 1
|
76
|
+
expect(player.stats[:powerplay_shots]).to eq 0
|
77
|
+
expect(player.stats[:powerplay_goals]).to eq 0
|
78
|
+
expect(player.stats[:powerplay_missed_shots]).to eq 0
|
79
|
+
expect(player.stats[:powerplay_assists]).to eq 0
|
80
|
+
expect(player.stats[:powerplay_faceoffs]).to eq 0
|
81
|
+
expect(player.stats[:powerplay_faceoffs_won]).to eq 0
|
82
|
+
expect(player.stats[:powerplay_faceoffs_lost]).to eq 0
|
83
|
+
expect(player.stats[:powerplay_faceoff_win_pct]).to eq 0
|
84
|
+
expect(player.stats[:shorthanded_shots]).to eq 0
|
85
|
+
expect(player.stats[:shorthanded_goals]).to eq 0
|
86
|
+
expect(player.stats[:shorthanded_missed_shots]).to eq 0
|
87
|
+
expect(player.stats[:shorthanded_assists]).to eq 0
|
88
|
+
expect(player.stats[:shorthanded_faceoffs]).to eq 0
|
89
|
+
expect(player.stats[:shorthanded_faceoffs_won]).to eq 0
|
90
|
+
expect(player.stats[:shorthanded_faceoffs_lost]).to eq 0
|
91
|
+
expect(player.stats[:shorthanded_faceoff_win_pct]).to eq 0
|
92
|
+
expect(player.stats[:evenstrength_shots]).to eq 2
|
93
|
+
expect(player.stats[:evenstrength_goals]).to eq 0
|
94
|
+
expect(player.stats[:evenstrength_missed_shots]).to eq 2
|
95
|
+
expect(player.stats[:evenstrength_assists]).to eq 1
|
96
|
+
expect(player.stats[:evenstrength_faceoffs]).to eq 0
|
97
|
+
expect(player.stats[:evenstrength_faceoffs_won]).to eq 0
|
98
|
+
expect(player.stats[:evenstrength_faceoffs_lost]).to eq 0
|
99
|
+
expect(player.stats[:evenstrength_faceoff_win_pct]).to eq 0
|
100
|
+
expect(player.stats[:penalty_shots]).to eq 0
|
101
|
+
expect(player.stats[:penalty_goals]).to eq 0
|
102
|
+
expect(player.stats[:penalty_missed_shots]).to eq 0
|
103
|
+
expect(player.stats[:shootout_shots]).to eq 0
|
104
|
+
expect(player.stats[:shootout_goals]).to eq 0
|
105
|
+
expect(player.stats[:shootout_missed_shots]).to eq 0
|
54
106
|
end
|
55
107
|
end
|
56
108
|
end
|
@@ -28,7 +28,7 @@ describe SportsDataApi::Nhl::Season, vcr: {
|
|
28
28
|
end
|
29
29
|
context 'results from schedule fetch' do
|
30
30
|
let(:season) do
|
31
|
-
SportsDataApi.set_access_level(:nhl, '
|
31
|
+
SportsDataApi.set_access_level(:nhl, 'trial')
|
32
32
|
SportsDataApi.set_key(:nhl, api_key(:nhl))
|
33
33
|
SportsDataApi::Nhl.schedule(2013, :reg)
|
34
34
|
end
|
@@ -5,235 +5,147 @@ describe SportsDataApi::Nhl::Team, vcr: {
|
|
5
5
|
record: :new_episodes,
|
6
6
|
match_requests_on: [:host, :path]
|
7
7
|
} do
|
8
|
-
|
8
|
+
before do
|
9
9
|
SportsDataApi.set_key(:nhl, api_key(:nhl))
|
10
|
-
SportsDataApi.set_access_level(:nhl, '
|
11
|
-
SportsDataApi::Nhl.teams
|
12
|
-
end
|
13
|
-
let(:roster) do
|
14
|
-
SportsDataApi.set_key(:nhl, api_key(:nhl))
|
15
|
-
SportsDataApi.set_access_level(:nhl, 'ot')
|
16
|
-
SportsDataApi::Nhl.team_roster('44151f7a-0f24-11e2-8525-18a905767e44')
|
17
|
-
end
|
18
|
-
let(:game_summary) do
|
19
|
-
SportsDataApi.set_key(:nhl, api_key(:nhl))
|
20
|
-
SportsDataApi.set_access_level(:nhl, 'ot')
|
21
|
-
SportsDataApi::Nhl.game_summary('f0f7e327-3a3a-410b-be75-0956c90c4988')
|
10
|
+
SportsDataApi.set_access_level(:nhl, 'trial')
|
22
11
|
end
|
23
12
|
|
24
13
|
context 'results from teams fetch' do
|
25
|
-
|
14
|
+
let(:teams) { SportsDataApi::Nhl.teams }
|
15
|
+
subject { teams.find { |t| t.alias == 'MIN' } }
|
16
|
+
|
26
17
|
it { should be_an_instance_of(SportsDataApi::Nhl::Team) }
|
27
|
-
its(:id) { should eq
|
28
|
-
its(:alias) { should eq 'LA' }
|
18
|
+
its(:id) { should eq '4416091c-0f24-11e2-8525-18a905767e44' }
|
29
19
|
its(:conference) { should eq 'WESTERN' }
|
30
|
-
its(:division) { should eq '
|
31
|
-
its(:market) { should eq '
|
32
|
-
its(:name) { should eq '
|
20
|
+
its(:division) { should eq 'CENTRAL' }
|
21
|
+
its(:market) { should eq 'Minnesota' }
|
22
|
+
its(:name) { should eq 'Wild' }
|
33
23
|
its(:players) { should eq [] }
|
34
24
|
its(:points) { should be_nil }
|
35
25
|
end
|
26
|
+
|
36
27
|
context 'results from team roster fetch' do
|
28
|
+
let(:roster) { SportsDataApi::Nhl.team_roster('4416091c-0f24-11e2-8525-18a905767e44') }
|
37
29
|
subject { roster }
|
30
|
+
|
38
31
|
it { should be_an_instance_of(SportsDataApi::Nhl::Team) }
|
39
|
-
its(:id) { should eq
|
40
|
-
its(:
|
41
|
-
its(:
|
42
|
-
its(:
|
43
|
-
its(:
|
32
|
+
its(:id) { should eq '4416091c-0f24-11e2-8525-18a905767e44' }
|
33
|
+
its(:conference) { should eq 'WESTERN' }
|
34
|
+
its(:division) { should eq 'CENTRAL' }
|
35
|
+
its(:market) { should eq 'Minnesota' }
|
36
|
+
its(:name) { should eq 'Wild' }
|
44
37
|
its(:points) { should be_nil }
|
45
|
-
|
46
|
-
subject
|
47
|
-
|
38
|
+
it 'parses players' do
|
39
|
+
expect(subject.players.count).to eq 24
|
40
|
+
expect(subject.players.first).to be_a SportsDataApi::Nhl::Player
|
48
41
|
end
|
49
42
|
end
|
43
|
+
|
50
44
|
context 'results from game_summary fetch' do
|
45
|
+
let(:game_summary) { SportsDataApi::Nhl.game_summary('af285aa3-3d80-4051-9449-5b58e5985a4e') }
|
51
46
|
subject { game_summary.home_team }
|
47
|
+
|
52
48
|
it { should be_an_instance_of(SportsDataApi::Nhl::Team) }
|
53
|
-
its(:id) { should eq '
|
54
|
-
its(:market) { should eq 'Montreal' }
|
55
|
-
its(:name) { should eq 'Canadiens' }
|
56
|
-
its(:points) { should eq 3 }
|
57
|
-
its(:alias) { should be_nil }
|
49
|
+
its(:id) { should eq '4416091c-0f24-11e2-8525-18a905767e44' }
|
58
50
|
its(:conference) { should be_nil }
|
59
51
|
its(:division) { should be_nil }
|
60
|
-
its(:
|
52
|
+
its(:market) { should eq 'Minnesota' }
|
53
|
+
its(:name) { should eq 'Wild' }
|
54
|
+
its(:points) { should eq 4 }
|
55
|
+
its(:alias) { should be_nil }
|
61
56
|
|
62
57
|
context 'players' do
|
63
58
|
subject { game_summary.home_team.players }
|
64
|
-
its(:count) { should eq
|
59
|
+
its(:count) { should eq 22 }
|
65
60
|
end
|
66
61
|
|
67
62
|
context 'player' do
|
68
|
-
|
63
|
+
let(:team) { game_summary.home_team }
|
64
|
+
let(:players) { team.players }
|
65
|
+
subject { players.find{ |x| x[:id] == '431e124a-0f24-11e2-8525-18a905767e44' } }
|
69
66
|
it { should be_an_instance_of(SportsDataApi::Nhl::Player) }
|
70
67
|
it 'should have an id' do
|
71
|
-
expect(subject.player[:id]).to eq
|
68
|
+
expect(subject.player[:id]).to eq '431e124a-0f24-11e2-8525-18a905767e44'
|
72
69
|
end
|
73
70
|
it 'should have a full_name' do
|
74
|
-
expect(subject.player[:full_name]).to eq
|
71
|
+
expect(subject.player[:full_name]).to eq 'Zach Parise'
|
75
72
|
end
|
76
73
|
it 'should have a first_name' do
|
77
|
-
expect(subject.player[:first_name]).to eq
|
74
|
+
expect(subject.player[:first_name]).to eq 'Zach'
|
78
75
|
end
|
79
76
|
it 'should have a last_name' do
|
80
|
-
expect(subject.player[:last_name]).to eq
|
77
|
+
expect(subject.player[:last_name]).to eq 'Parise'
|
81
78
|
end
|
82
79
|
it 'should have a position' do
|
83
|
-
expect(subject.player[:position]).to eq
|
80
|
+
expect(subject.player[:position]).to eq 'F'
|
84
81
|
end
|
85
82
|
it 'should have a primary_position' do
|
86
|
-
expect(subject.player[:primary_position]).to eq
|
83
|
+
expect(subject.player[:primary_position]).to eq 'LW'
|
87
84
|
end
|
88
85
|
it 'should have a jersey_number' do
|
89
|
-
expect(subject.player[:jersey_number]).to eq
|
86
|
+
expect(subject.player[:jersey_number]).to eq '11'
|
90
87
|
end
|
91
88
|
it 'should have a played' do
|
92
|
-
expect(subject.player[:played]).to eq
|
93
|
-
end
|
94
|
-
it 'should not be scratched' do
|
95
|
-
expect(subject.player[:scratched]).to eq nil
|
89
|
+
expect(subject.player[:played]).to eq true
|
96
90
|
end
|
97
|
-
it 'should
|
98
|
-
expect(subject.
|
91
|
+
it 'should have an starter' do
|
92
|
+
expect(subject.player[:starter]).to eq true
|
99
93
|
end
|
94
|
+
its(:stats){ should be_an_instance_of(SportsDataApi::MergedStats) }
|
100
95
|
|
101
|
-
its(:stats){ should be_an_instance_of(SportsDataApi::Stats) }
|
102
96
|
context 'stats' do
|
103
|
-
subject { game_summary.
|
104
|
-
it 'should have goals' do
|
105
|
-
expect(subject[:goals]).to eq '0'
|
106
|
-
end
|
107
|
-
it 'should have assists' do
|
108
|
-
expect(subject[:assists]).to eq '0'
|
109
|
-
end
|
110
|
-
it 'should have penalties' do
|
111
|
-
expect(subject[:penalties]).to eq '1'
|
112
|
-
end
|
113
|
-
it 'should have penalty_minutes' do
|
114
|
-
expect(subject[:penalty_minutes]).to eq '2'
|
115
|
-
end
|
116
|
-
it 'should have shots' do
|
117
|
-
expect(subject[:shots]).to eq '2'
|
118
|
-
end
|
119
|
-
it 'should have blocked_att' do
|
120
|
-
expect(subject[:blocked_att]).to eq '1'
|
121
|
-
end
|
122
|
-
it 'should have missed_shots' do
|
123
|
-
expect(subject[:missed_shots]).to eq '1'
|
124
|
-
end
|
125
|
-
it 'should have hits' do
|
126
|
-
expect(subject[:hits]).to eq '4'
|
127
|
-
end
|
128
|
-
it 'should have blocked_att' do
|
129
|
-
expect(subject[:giveaways]).to eq '0'
|
130
|
-
end
|
131
|
-
it 'should have takeaways' do
|
132
|
-
expect(subject[:takeaways]).to eq '1'
|
133
|
-
end
|
134
|
-
it 'should have blocked_shots' do
|
135
|
-
expect(subject[:blocked_shots]).to eq '1'
|
136
|
-
end
|
137
|
-
it 'should have faceoffs_won' do
|
138
|
-
expect(subject[:faceoffs_won]).to eq '4'
|
139
|
-
end
|
140
|
-
it 'should have faceoffs_lost' do
|
141
|
-
expect(subject[:faceoffs_lost]).to eq '4'
|
142
|
-
end
|
143
|
-
it 'should have winning_goal' do
|
144
|
-
expect(subject[:winning_goal]).to be_falsy
|
145
|
-
end
|
146
|
-
it 'should have shooting_pct' do
|
147
|
-
expect(subject[:shooting_pct]).to eq '0.0'
|
148
|
-
end
|
149
|
-
it 'should have faceoffs' do
|
150
|
-
expect(subject[:faceoffs]).to eq '8'
|
151
|
-
end
|
152
|
-
it 'should have faceoff_win_pct' do
|
153
|
-
expect(subject[:faceoff_win_pct]).to eq '50.0'
|
154
|
-
end
|
155
|
-
it 'should have points' do
|
156
|
-
expect(subject[:points]).to eq '0'
|
157
|
-
end
|
158
|
-
it 'should have powerplay_shots' do
|
159
|
-
expect(subject[:powerplay_shots]).to eq '0'
|
160
|
-
end
|
161
|
-
it 'should have powerplay_goals' do
|
162
|
-
expect(subject[:powerplay_goals]).to eq '0'
|
163
|
-
end
|
164
|
-
it 'should have powerplay_missed_shots' do
|
165
|
-
expect(subject[:powerplay_missed_shots]).to eq '0'
|
166
|
-
end
|
167
|
-
it 'should have powerplay_assists' do
|
168
|
-
expect(subject[:powerplay_assists]).to eq '0'
|
169
|
-
end
|
170
|
-
it 'should have shorthanded_shots' do
|
171
|
-
expect(subject[:shorthanded_shots]).to eq '0'
|
172
|
-
end
|
173
|
-
it 'should have shorthanded_goals' do
|
174
|
-
expect(subject[:shorthanded_goals]).to eq '0'
|
175
|
-
end
|
176
|
-
it 'should have shorthanded_missed_shots' do
|
177
|
-
expect(subject[:shorthanded_missed_shots]).to eq '0'
|
178
|
-
end
|
179
|
-
it 'should have shorthanded_assists' do
|
180
|
-
expect(subject[:shorthanded_assists]).to eq '0'
|
181
|
-
end
|
182
|
-
it 'should have eventstrength_shots' do
|
183
|
-
expect(subject[:evenstrength_shots]).to eq '2'
|
184
|
-
end
|
185
|
-
it 'should have eventstrength_goals' do
|
186
|
-
expect(subject[:evenstrength_goals]).to eq '0'
|
187
|
-
end
|
188
|
-
it 'should have eventstrength_missed_shots' do
|
189
|
-
expect(subject[:evenstrength_missed_shots]).to eq '1'
|
190
|
-
end
|
191
|
-
it 'should have eventstrength_assists' do
|
192
|
-
expect(subject[:evenstrength_assists]).to eq '0'
|
193
|
-
end
|
194
|
-
it 'should have penalty_shots' do
|
195
|
-
expect(subject[:penalty_shots]).to eq '0'
|
196
|
-
end
|
197
|
-
it 'should have penalty_goals' do
|
198
|
-
expect(subject[:penalty_goals]).to eq '0'
|
199
|
-
end
|
200
|
-
it 'should have penalty_missed_shots' do
|
201
|
-
expect(subject[:penalty_missed_shots]).to eq '0'
|
202
|
-
end
|
203
|
-
it 'should have shootout_shots' do
|
204
|
-
expect(subject[:shootout_shots]).to eq '0'
|
205
|
-
end
|
206
|
-
it 'should have shootout_goals' do
|
207
|
-
expect(subject[:shootout_goals]).to eq '0'
|
208
|
-
end
|
209
|
-
it 'should have shootout_missed_shots' do
|
210
|
-
expect(subject[:shootout_missed_shots]).to eq '0'
|
211
|
-
end
|
212
|
-
end
|
213
|
-
end
|
97
|
+
subject { game_summary.home_team.players.first.stats }
|
214
98
|
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
99
|
+
it 'parses the stats' do
|
100
|
+
expect(subject[:total_goals]).to eq 0
|
101
|
+
expect(subject[:total_assists]).to eq 1
|
102
|
+
expect(subject[:total_penalties]).to eq 0
|
103
|
+
expect(subject[:total_penalty_minutes]).to eq 0
|
104
|
+
expect(subject[:total_shots]).to eq 0
|
105
|
+
expect(subject[:total_blocked_att]).to eq 2
|
106
|
+
expect(subject[:total_missed_shots]).to eq 0
|
107
|
+
expect(subject[:total_hits]).to eq 0
|
108
|
+
expect(subject[:total_giveaways]).to eq 0
|
109
|
+
expect(subject[:total_takeaways]).to eq 0
|
110
|
+
expect(subject[:total_blocked_shots]).to eq 0
|
111
|
+
expect(subject[:total_faceoffs_won]).to eq 0
|
112
|
+
expect(subject[:total_faceoffs_lost]).to eq 0
|
113
|
+
expect(subject[:total_plus_minus]).to eq 1
|
114
|
+
expect(subject[:total_shooting_pct]).to eq 0
|
115
|
+
expect(subject[:total_faceoff_win_pct]).to eq 0
|
116
|
+
expect(subject[:total_faceoffs]).to eq 0
|
117
|
+
expect(subject[:total_points]).to eq 1
|
118
|
+
expect(subject[:powerplay_shots]).to eq 0
|
119
|
+
expect(subject[:powerplay_goals]).to eq 0
|
120
|
+
expect(subject[:powerplay_missed_shots]).to eq 0
|
121
|
+
expect(subject[:powerplay_assists]).to eq 0
|
122
|
+
expect(subject[:powerplay_faceoffs]).to eq 0
|
123
|
+
expect(subject[:powerplay_faceoffs_won]).to eq 0
|
124
|
+
expect(subject[:powerplay_faceoffs_lost]).to eq 0
|
125
|
+
expect(subject[:powerplay_faceoff_win_pct]).to eq 0
|
126
|
+
expect(subject[:shorthanded_shots]).to eq 0
|
127
|
+
expect(subject[:shorthanded_goals]).to eq 0
|
128
|
+
expect(subject[:shorthanded_missed_shots]).to eq 0
|
129
|
+
expect(subject[:shorthanded_assists]).to eq 0
|
130
|
+
expect(subject[:shorthanded_faceoffs]).to eq 0
|
131
|
+
expect(subject[:shorthanded_faceoffs_won]).to eq 0
|
132
|
+
expect(subject[:shorthanded_faceoffs_lost]).to eq 0
|
133
|
+
expect(subject[:shorthanded_faceoff_win_pct]).to eq 0
|
134
|
+
expect(subject[:evenstrength_shots]).to eq 0
|
135
|
+
expect(subject[:evenstrength_goals]).to eq 0
|
136
|
+
expect(subject[:evenstrength_missed_shots]).to eq 0
|
137
|
+
expect(subject[:evenstrength_assists]).to eq 1
|
138
|
+
expect(subject[:evenstrength_faceoffs]).to eq 0
|
139
|
+
expect(subject[:evenstrength_faceoffs_won]).to eq 0
|
140
|
+
expect(subject[:evenstrength_faceoffs_lost]).to eq 0
|
141
|
+
expect(subject[:evenstrength_faceoff_win_pct]).to eq 0
|
142
|
+
expect(subject[:penalty_shots]).to eq 0
|
143
|
+
expect(subject[:penalty_goals]).to eq 0
|
144
|
+
expect(subject[:penalty_missed_shots]).to eq 0
|
145
|
+
expect(subject[:shootout_shots]).to eq 0
|
146
|
+
expect(subject[:shootout_goals]).to eq 0
|
147
|
+
expect(subject[:shootout_missed_shots]).to eq 0
|
148
|
+
end
|
237
149
|
end
|
238
150
|
end
|
239
151
|
end
|
@@ -5,72 +5,21 @@ describe SportsDataApi::Nhl::Teams, vcr: {
|
|
5
5
|
record: :new_episodes,
|
6
6
|
match_requests_on: [:host, :path]
|
7
7
|
} do
|
8
|
-
|
8
|
+
before do
|
9
9
|
SportsDataApi.set_key(:nhl, api_key(:nhl))
|
10
|
-
SportsDataApi.set_access_level(:nhl, '
|
11
|
-
SportsDataApi::Nhl.teams
|
10
|
+
SportsDataApi.set_access_level(:nhl, 'trial')
|
12
11
|
end
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
subject { teams }
|
26
|
-
its(:conferences) { should eq %w(WESTERN EASTERN).map { |str| str.to_sym } }
|
27
|
-
its(:divisions) { should eq %w(PACIFIC CENTRAL ATLANTIC METROPOLITAN).map { |str| str.to_sym } }
|
28
|
-
its(:count) { should eq 30 }
|
29
|
-
|
30
|
-
it { subject[:"44151f7a-0f24-11e2-8525-18a905767e44"].should eq kings }
|
31
|
-
|
32
|
-
describe 'meta methods' do
|
33
|
-
it { should respond_to :EASTERN }
|
34
|
-
it { should respond_to :WESTERN }
|
35
|
-
it { should respond_to :eastern }
|
36
|
-
it { should respond_to :western }
|
37
|
-
it { should respond_to :ATLANTIC }
|
38
|
-
it { should respond_to :atlantic }
|
39
|
-
it { should respond_to :PACIFIC }
|
40
|
-
|
41
|
-
its(:EASTERN) { should be_a Array }
|
42
|
-
its(:WESTERN) { should be_a Array }
|
43
|
-
|
44
|
-
context '#EASTERN' do
|
45
|
-
subject { teams.EASTERN }
|
46
|
-
its(:count) { should eq 16 }
|
47
|
-
end
|
48
|
-
|
49
|
-
context '#eastern' do
|
50
|
-
subject { teams.eastern }
|
51
|
-
its(:count) { should eq 16 }
|
52
|
-
end
|
53
|
-
|
54
|
-
context '#WESTERN' do
|
55
|
-
subject { teams.WESTERN }
|
56
|
-
its(:count) { should eq 14 }
|
57
|
-
end
|
58
|
-
|
59
|
-
context '#western' do
|
60
|
-
subject { teams.western }
|
61
|
-
its(:count) { should eq 14 }
|
62
|
-
end
|
63
|
-
|
64
|
-
context '#pacific' do
|
65
|
-
subject { teams.pacific }
|
66
|
-
its(:count) { should eq 7 }
|
67
|
-
it { should include kings }
|
68
|
-
end
|
69
|
-
|
70
|
-
context '#PACIFIC' do
|
71
|
-
subject { teams.PACIFIC }
|
72
|
-
its(:count) { should eq 7 }
|
73
|
-
it { should include kings }
|
74
|
-
end
|
12
|
+
subject { SportsDataApi::Nhl.teams }
|
13
|
+
|
14
|
+
its(:count) { should eq 31 }
|
15
|
+
it 'parses outs the specific team' do
|
16
|
+
team = subject.find { |t| t.name == 'Red Wings' }
|
17
|
+
expect(team.id).to eq '44169bb9-0f24-11e2-8525-18a905767e44'
|
18
|
+
expect(team.market).to eq 'Detroit'
|
19
|
+
expect(team.alias).to eq 'DET'
|
20
|
+
expect(team.conference).to eq 'EASTERN'
|
21
|
+
expect(team.division).to eq 'ATLANTIC'
|
22
|
+
expect(team.venue).to be_a SportsDataApi::Nhl::Venue
|
23
|
+
expect(team.players).to be_empty
|
75
24
|
end
|
76
25
|
end
|
@@ -6,19 +6,22 @@ describe SportsDataApi::Nhl::Venue, vcr: {
|
|
6
6
|
match_requests_on: [:host, :path]
|
7
7
|
} do
|
8
8
|
let(:daily_schedule) do
|
9
|
-
SportsDataApi.set_access_level(:nhl, '
|
9
|
+
SportsDataApi.set_access_level(:nhl, 'trial')
|
10
10
|
SportsDataApi.set_key(:nhl, api_key(:nhl))
|
11
11
|
SportsDataApi::Nhl.daily(2013, 12, 12)
|
12
12
|
end
|
13
13
|
context 'results from weekly schedule fetch' do
|
14
14
|
subject { daily_schedule.first.venue }
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
15
|
+
it 'parses the data' do
|
16
|
+
expect(subject[:id]).to eq '0a162e5b-8d59-42d8-b173-a131bf632ffb'
|
17
|
+
expect(subject[:name]).to eq 'Wells Fargo Center'
|
18
|
+
expect(subject[:capacity]).to eq 19543
|
19
|
+
expect(subject[:address]).to eq '3601 S. Broad St.'
|
20
|
+
expect(subject[:city]).to eq 'Philadelphia'
|
21
|
+
expect(subject[:state]).to eq 'PA'
|
22
|
+
expect(subject[:zip]).to eq '19148'
|
23
|
+
expect(subject[:country]).to eq 'USA'
|
24
|
+
expect(subject[:time_zone]).to eq 'US/Eastern'
|
25
|
+
end
|
23
26
|
end
|
24
27
|
end
|