sports_data_api 0.15.0 → 0.15.1
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/CHANGELOG.md +4 -0
- data/lib/sports_data_api/merged_stats.rb +5 -0
- data/lib/sports_data_api/nfl/team.rb +19 -5
- data/lib/sports_data_api/version.rb +1 -1
- data/spec/cassettes/sports_data_api_nfl_team.yml +1176 -0
- data/spec/lib/sports_data_api/merged_stats_spec.rb +14 -0
- data/spec/lib/sports_data_api/nfl/team_spec.rb +29 -19
- metadata +2 -2
@@ -11,6 +11,20 @@ describe SportsDataApi::MergedStats, vcr: {
|
|
11
11
|
SportsDataApi::Mlb.game('4f46825d-8172-47bc-9f06-2a162c330ffb')
|
12
12
|
}
|
13
13
|
|
14
|
+
describe '#fetch' do
|
15
|
+
let(:player) do
|
16
|
+
game.away.players.find do |p|
|
17
|
+
p[:first_name] == 'Elvis' && p[:last_name] == 'Andrus'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
subject { player.statistics.fielding }
|
21
|
+
|
22
|
+
it 'delegates to the stats hash' do
|
23
|
+
expect(subject.fetch(:po)).to eq 1.0
|
24
|
+
expect(subject.fetch(:po, 2)).to eq 1.0
|
25
|
+
expect(subject.fetch(:unknown, 2)).to eq 2
|
26
|
+
end
|
27
|
+
end
|
14
28
|
context 'when fielding' do
|
15
29
|
let(:player) do
|
16
30
|
game.away.players.find do |p|
|
@@ -196,7 +196,7 @@ describe SportsDataApi::Nfl::Team, vcr: {
|
|
196
196
|
end
|
197
197
|
|
198
198
|
describe 'when team comes from .game_statistics' do
|
199
|
-
let(:game_id) { '
|
199
|
+
let(:game_id) { 'cd2bd061-0acd-4f3b-97e4-9b2ca04f99b1' }
|
200
200
|
let(:base) { SportsDataApi::Nfl.game_statistics(game_id) }
|
201
201
|
|
202
202
|
context 'when home team' do
|
@@ -204,19 +204,21 @@ describe SportsDataApi::Nfl::Team, vcr: {
|
|
204
204
|
|
205
205
|
it 'parses out the data' do
|
206
206
|
expect(team).to be_a SportsDataApi::Nfl::Team
|
207
|
-
expect(team.id).to eq '
|
207
|
+
expect(team.id).to eq 'cb2f9f1f-ac67-424e-9e72-1475cb0ed398'
|
208
208
|
expect(team.conference).to be_nil
|
209
209
|
expect(team.division).to be_nil
|
210
|
-
expect(team.alias).to eq '
|
211
|
-
expect(team.name).to eq '
|
212
|
-
expect(team.market).to eq '
|
210
|
+
expect(team.alias).to eq 'PIT'
|
211
|
+
expect(team.name).to eq 'Steelers'
|
212
|
+
expect(team.market).to eq 'Pittsburgh'
|
213
213
|
expect(team.remaining_challenges).to be_nil
|
214
|
-
expect(team.remaining_timeouts).to eq
|
215
|
-
expect(team.points).to eq
|
214
|
+
expect(team.remaining_timeouts).to eq 0
|
215
|
+
expect(team.points).to eq 24
|
216
216
|
players = team.players
|
217
|
-
expect(players.size).to eq
|
218
|
-
player = players.detect { |p| p[:name] == '
|
219
|
-
expect(player.stats[:
|
217
|
+
expect(players.size).to eq 33
|
218
|
+
player = players.detect { |p| p[:name] == "Le'Veon Bell" }
|
219
|
+
expect(player.stats[:rushing_yards]).to eq 117
|
220
|
+
expect(player.stats[:receiving_yards]).to eq 48
|
221
|
+
expect(player.stats[:rushing_touchdowns]).to eq 1
|
220
222
|
expect(team.statistics).to be_a Hash
|
221
223
|
expect(team.venue).to be_nil
|
222
224
|
end
|
@@ -227,19 +229,27 @@ describe SportsDataApi::Nfl::Team, vcr: {
|
|
227
229
|
|
228
230
|
it 'parses out the data' do
|
229
231
|
expect(team).to be_a SportsDataApi::Nfl::Team
|
230
|
-
expect(team.id).to eq '
|
232
|
+
expect(team.id).to eq '97354895-8c77-4fd4-a860-32e62ea7382a'
|
231
233
|
expect(team.conference).to be_nil
|
232
234
|
expect(team.division).to be_nil
|
233
|
-
expect(team.alias).to eq '
|
234
|
-
expect(team.name).to eq '
|
235
|
-
expect(team.market).to eq '
|
235
|
+
expect(team.alias).to eq 'NE'
|
236
|
+
expect(team.name).to eq 'Patriots'
|
237
|
+
expect(team.market).to eq 'New England'
|
236
238
|
expect(team.remaining_challenges).to be_nil
|
237
|
-
expect(team.remaining_timeouts).to eq
|
238
|
-
expect(team.points).to eq
|
239
|
+
expect(team.remaining_timeouts).to eq 2
|
240
|
+
expect(team.points).to eq 27
|
239
241
|
players = team.players
|
240
|
-
expect(players.size).to eq
|
241
|
-
|
242
|
-
expect(
|
242
|
+
expect(players.size).to eq 35
|
243
|
+
player1 = players.detect { |p| p[:name] == 'Tom Brady' }
|
244
|
+
expect(player1.stats[:extra_points_pass_attempts]).to eq 1
|
245
|
+
expect(player1.stats[:extra_points_pass_successes]).to eq 1
|
246
|
+
expect(player1.stats[:passing_yards]).to eq 298
|
247
|
+
player2 = players.detect { |p| p[:name] == 'Rob Gronkowski' }
|
248
|
+
expect(player2.stats[:extra_points_receive_attempts]).to eq 1
|
249
|
+
expect(player2.stats[:extra_points_receive_successes]).to eq 1
|
250
|
+
player3 = players.detect { |p| p[:name] == 'Stephen Gostkowski' }
|
251
|
+
expect(player3.stats[:extra_points_kicks_attempts]).to eq 2
|
252
|
+
expect(player3.stats[:extra_points_kicks_made]).to eq 1
|
243
253
|
expect(team.statistics).to be_a Hash
|
244
254
|
expect(team.venue).to be_nil
|
245
255
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sports_data_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Lovelett
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-06-
|
12
|
+
date: 2018-06-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|