sportradar-api 0.11.23 → 0.11.24
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/Gemfile.lock +1 -1
- data/lib/sportradar/api/football/drive.rb +1 -1
- data/lib/sportradar/api/football/game.rb +12 -0
- data/lib/sportradar/api/football/ncaafb/drive.rb +6 -0
- data/lib/sportradar/api/football/ncaafb/play.rb +22 -26
- data/lib/sportradar/api/football/nfl/drive.rb +4 -0
- data/lib/sportradar/api/football/play.rb +27 -0
- data/lib/sportradar/api/football/situation.rb +5 -1
- data/lib/sportradar/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a398d741ca5be02da26c58af0be8b4d0e9d0188
|
|
4
|
+
data.tar.gz: 141df696774e1231d1b211f3e5e2ecb29d44adb4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4659aed911f1b80b8f4d8834c44701d83e6674a3075570db0d252bbf3bd0f3075dd7984df878e8a6f36efa7866bcc825d8897b3f898fbf89c445577e1ae63ace
|
|
7
|
+
data.tar.gz: 25f52b4789c922e1aea14f0909bfdda44da16b2c2486c3d7c7f75d716d3aa45e1657cfbe3cf07c9a0cc8cda59b944539b87ccafe3d3ba04f7694caf3a57a4577
|
data/Gemfile.lock
CHANGED
|
@@ -59,7 +59,7 @@ module Sportradar
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
def over?
|
|
62
|
-
@end_reason != 'UNKNOWN' && !@end_reason.nil?
|
|
62
|
+
@end_reason != 'UNKNOWN' && !@end_reason.nil? && !plays.last.parsed_ending # FIXME - maybe fix this. sim games have inconsistent data
|
|
63
63
|
end
|
|
64
64
|
|
|
65
65
|
def end_reason_possibilities
|
|
@@ -167,6 +167,18 @@ module Sportradar
|
|
|
167
167
|
@teams_hash[leading_team_id] || (@away_id == leading_team_id && away) || (@home_id == leading_team_id && home)
|
|
168
168
|
end
|
|
169
169
|
|
|
170
|
+
def current_possession_team_id
|
|
171
|
+
drives.last.team_id
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
def next_possession_team_id
|
|
175
|
+
(@teams_hash.keys - [current_possession_team_id]).first || (@away_id == current_possession_team_id && @home_id) || (@home_id == current_possession_team_id && @away_id)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
def team_ids
|
|
179
|
+
@teams_hash.keys
|
|
180
|
+
end
|
|
181
|
+
|
|
170
182
|
def team(team_id)
|
|
171
183
|
@teams_hash[team_id]
|
|
172
184
|
end
|
|
@@ -4,6 +4,12 @@ module Sportradar
|
|
|
4
4
|
class Ncaafb
|
|
5
5
|
class Drive < Sportradar::Api::Football::Drive
|
|
6
6
|
|
|
7
|
+
alias :team_id :team
|
|
8
|
+
|
|
9
|
+
def end_reason
|
|
10
|
+
plays.last.parsed_ending || 'UNKNOWN'
|
|
11
|
+
end
|
|
12
|
+
|
|
7
13
|
def over?
|
|
8
14
|
plays.last&.parsed_ending || (overtime? && ['End of Quarter', 'End of Game'].include?(plays.last&.description))
|
|
9
15
|
end
|
|
@@ -5,10 +5,6 @@ module Sportradar
|
|
|
5
5
|
class Play < Sportradar::Api::Football::Play
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def parsed_ending
|
|
9
|
-
@parsed_ending ||= search_for_drive_end
|
|
10
|
-
end
|
|
11
|
-
|
|
12
8
|
def counted_play?
|
|
13
9
|
['rush', 'pass'].include?(self.play_type) && !self.description.include?('No Play')
|
|
14
10
|
end
|
|
@@ -34,28 +30,28 @@ module Sportradar
|
|
|
34
30
|
|
|
35
31
|
private
|
|
36
32
|
|
|
37
|
-
def search_for_drive_end
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
end
|
|
33
|
+
# def search_for_drive_end
|
|
34
|
+
# case @play_type
|
|
35
|
+
# when 'kick'
|
|
36
|
+
# nil
|
|
37
|
+
# when 'rush'
|
|
38
|
+
# # check for fumble
|
|
39
|
+
# parse_description_for_drive_end
|
|
40
|
+
# when 'pass'
|
|
41
|
+
# # check for fumble/interception
|
|
42
|
+
# parse_description_for_drive_end
|
|
43
|
+
# when 'punt'
|
|
44
|
+
# :punt
|
|
45
|
+
# when 'penalty'
|
|
46
|
+
# nil
|
|
47
|
+
# when 'fieldgoal'
|
|
48
|
+
# :fg
|
|
49
|
+
# when 'extrapoint'
|
|
50
|
+
# :pat
|
|
51
|
+
# else
|
|
52
|
+
# parse_description_for_drive_end
|
|
53
|
+
# end
|
|
54
|
+
# end
|
|
59
55
|
|
|
60
56
|
# ["kick", "rush", "pass", "punt", "penalty", nil, "fieldgoal", "extrapoint"]
|
|
61
57
|
def parse_description_for_drive_end
|
|
@@ -79,6 +79,33 @@ module Sportradar
|
|
|
79
79
|
false
|
|
80
80
|
end
|
|
81
81
|
|
|
82
|
+
def parsed_ending
|
|
83
|
+
@parsed_ending ||= search_for_drive_end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def search_for_drive_end
|
|
87
|
+
case @play_type
|
|
88
|
+
when 'kick'
|
|
89
|
+
nil
|
|
90
|
+
when 'rush'
|
|
91
|
+
# check for fumble
|
|
92
|
+
parse_description_for_drive_end
|
|
93
|
+
when 'pass'
|
|
94
|
+
# check for fumble/interception
|
|
95
|
+
parse_description_for_drive_end
|
|
96
|
+
when 'punt'
|
|
97
|
+
:punt
|
|
98
|
+
when 'penalty'
|
|
99
|
+
nil
|
|
100
|
+
when 'fieldgoal'
|
|
101
|
+
:fg
|
|
102
|
+
when 'extrapoint'
|
|
103
|
+
:pat
|
|
104
|
+
else
|
|
105
|
+
parse_description_for_drive_end
|
|
106
|
+
end
|
|
107
|
+
end
|
|
108
|
+
|
|
82
109
|
def parse_player
|
|
83
110
|
# TODO: Currently there is an issue where we are only mapping one player_id to a play, but there are plays with multiple players involved.
|
|
84
111
|
play_stats = @statistics.penalty || @statistics.rush || @statistics.return || @statistics.receive
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sportradar-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.11.
|
|
4
|
+
version: 0.11.24
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ben Eggett
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-08-
|
|
11
|
+
date: 2017-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|