sportradar-api 0.9.11 → 0.9.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/sportradar/api.rb +1 -0
- data/lib/sportradar/api/football/stat_pack/passing.rb +1 -2
- data/lib/sportradar/api/nfl/.play_statistics.rb.swo +0 -0
- data/lib/sportradar/api/nfl/play.rb +2 -2
- data/lib/sportradar/api/nfl/play_statistics.rb +247 -0
- data/lib/sportradar/api/nfl/quarter.rb +10 -1
- data/lib/sportradar/api/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71c91c23d7e05f2b38d3b002b1fdecdec75977cb
|
4
|
+
data.tar.gz: 83862ccd02b6ed0f68431078d0ec4ca114e27ff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05b62cf6aef180cd13604a3006d7645784b816a4651290614833685b2079ae3351e9cb66930d1d383a8f92605f4c614e58b1ec152369b4913dc954ba1aca3461
|
7
|
+
data.tar.gz: 450de389a1b2283b27c5379893c094bf0651681c6e9a3d9c42cfbcb495bb2ceef96444a3c24f59814f47b4df4eca8628cf4ba38dbca789d1990a3d362cbbdbff
|
data/Gemfile.lock
CHANGED
data/lib/sportradar/api.rb
CHANGED
@@ -46,6 +46,7 @@ require "sportradar/api/nfl/hierarchy"
|
|
46
46
|
require "sportradar/api/nfl/injury"
|
47
47
|
require "sportradar/api/nfl/league_depth_chart"
|
48
48
|
require "sportradar/api/nfl/play"
|
49
|
+
require "sportradar/api/nfl/play_statistics"
|
49
50
|
require "sportradar/api/nfl/player"
|
50
51
|
require "sportradar/api/nfl/position"
|
51
52
|
require "sportradar/api/nfl/quarter"
|
@@ -7,7 +7,7 @@ module Sportradar
|
|
7
7
|
@attempts = response["attempts"]
|
8
8
|
@completions = response["completions"]
|
9
9
|
@cmp_pct = response["cmp_pct"]
|
10
|
-
|
10
|
+
@yards = response["yards"] # 'yards' is air yards, which does not include sack yardage. air_yards is for college, net_yards for NFL
|
11
11
|
@avg_yards = response["avg_yards"]
|
12
12
|
@sacks = response["sacks"]
|
13
13
|
@sack_yards = response["sack_yards"]
|
@@ -18,7 +18,6 @@ module Sportradar
|
|
18
18
|
@longest_touchdown = response["longest_touchdown"]
|
19
19
|
@air_yards = response["air_yards"]
|
20
20
|
@net_yards = response["net_yards"] # passing net_yards is the correct measure for team stats, as it includes sack yardage
|
21
|
-
@yards = response["net_yards"] # should look further into this, make sure this isn't a bad idea
|
22
21
|
@redzone_attempts = response["redzone_attempts"]
|
23
22
|
end
|
24
23
|
end
|
Binary file
|
@@ -19,7 +19,7 @@ module Sportradar
|
|
19
19
|
@scoring_play = data["scoring_play"]
|
20
20
|
@sequence = data["sequence"]
|
21
21
|
@start_situation = Sportradar::Api::Nfl::Situation.new data["start_situation"] if data["start_situation"]
|
22
|
-
@statistics =
|
22
|
+
@statistics = Sportradar::Api::Nfl::PlayStatistics.new data["statistics"] if data["statistics"]
|
23
23
|
parse_player if @statistics
|
24
24
|
@type = data["type"]
|
25
25
|
@wall_clock = data["wall_clock"]
|
@@ -31,7 +31,7 @@ module Sportradar
|
|
31
31
|
if play_stats.is_a?(Array)
|
32
32
|
play_stats = play_stats.first
|
33
33
|
end
|
34
|
-
@player_id = play_stats
|
34
|
+
@player_id = play_stats&.player&.id
|
35
35
|
end
|
36
36
|
|
37
37
|
end
|
@@ -0,0 +1,247 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Nfl::PlayStatistics < Data
|
4
|
+
attr_accessor :response, :kick, :return, :rush, :defense, :receive, :punt, :penalty, :pass, :first_down, :field_goal, :extra_point, :defense, :down_conversion
|
5
|
+
def initialize(data)
|
6
|
+
@response = data
|
7
|
+
@kick = Nfl::PlayKickStatistics.new(data['kick']) if data['kick']
|
8
|
+
@return = parse_into_array(selector: data['return'], klass: Nfl::PlayReturnStatistics) if data['return']
|
9
|
+
@rush = parse_into_array(selector: data['rush'], klass: Nfl::PlayRushStatistics) if data['rush']
|
10
|
+
@defense = parse_into_array(selector: data['defense'], klass: Nfl::PlayDefenseStatistics) if data['defense']
|
11
|
+
@receive = parse_into_array(selector: data['receive'], klass: Nfl::PlayReceiveStatistics) if data['receive']
|
12
|
+
@punt = Nfl::PlayPuntStatistics.new(data['punt']) if data['punt']
|
13
|
+
@penalty = parse_into_array(selector: data['penalty'], klass: Nfl::PlayPenaltyStatistics) if data['penalty']
|
14
|
+
@pass = Nfl::PlayPassingStatistics.new(data['pass']) if data['pass']
|
15
|
+
@first_down = parse_into_array(selector: data['first_down'], klass: Nfl::PlayFirstDownStatistics) if data['first_down']
|
16
|
+
@field_goal = Nfl::PlayFieldGoalStatistics.new(data['field_goal']) if data['field_goal']
|
17
|
+
@extra_point = Nfl::PlayExtraPointStatistics.new(data['extra_point']) if data['extra_point']
|
18
|
+
@down_conversion = Nfl::PlayDownConversionStatistics.new(data['down_conversion']) if data['down_conversion']
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Nfl::PlayDownConversionStatistics < Data
|
23
|
+
attr_accessor :attempt, :complete, :down, :nullified, :team
|
24
|
+
def initialize(data)
|
25
|
+
@attempt = data['attempt']
|
26
|
+
@complete = data['complete']
|
27
|
+
@down = data['down']
|
28
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
29
|
+
@nullified = data['nullified']
|
30
|
+
end
|
31
|
+
|
32
|
+
def nullified?
|
33
|
+
@nullified.to_s == 'true'
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
class Nfl::PlayDefenseStatistics < Data
|
38
|
+
attr_accessor :ast_tackle, :interception, :int_yards, :nullified, :pass_defended, :primary, :qb_hit, :sack, :sack_yards, :tlost, :tlost_yards, :team, :player, :tackle, :int_touchdown
|
39
|
+
def initialize(data)
|
40
|
+
@ast_tackle = data['ast_tackle']
|
41
|
+
@interception = data['interception']
|
42
|
+
@int_yards = data['int_yards']
|
43
|
+
@int_touchdown = data['int_touchdown']
|
44
|
+
@nullified = data['nullified']
|
45
|
+
@pass_defended = data['pass_defended']
|
46
|
+
@primary = data['primary']
|
47
|
+
@qb_hit = data['qb_hit']
|
48
|
+
@sack = data['sack']
|
49
|
+
@sack_yards = data['sack_yards']
|
50
|
+
@tlost = data['tlost']
|
51
|
+
@tlost_yards = data['tlost_yards']
|
52
|
+
@tackle = data['tackle']
|
53
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
54
|
+
@player = Nfl::Player.new(data['player']) if data['player']
|
55
|
+
@nullified = data['nullified']
|
56
|
+
end
|
57
|
+
|
58
|
+
def nullified?
|
59
|
+
@nullified.to_s == 'true'
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class Nfl::PlayExtraPointStatistics < Data
|
64
|
+
attr_accessor :attempt, :nullified
|
65
|
+
def initialize(data)
|
66
|
+
@attempt = data['attempt']
|
67
|
+
@nullified = data['nullified']
|
68
|
+
end
|
69
|
+
|
70
|
+
def nullified?
|
71
|
+
@nullified.to_s == 'true'
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class Nfl::PlayFieldGoalStatistics < Data
|
76
|
+
attr_accessor :attempt, :att_yards, :missed, :yards, :nullified, :blocked, :team, :player
|
77
|
+
def initialize(data)
|
78
|
+
@attempt = data['attempt']
|
79
|
+
@att_yards = data['att_yards']
|
80
|
+
@missed = data['missed']
|
81
|
+
@blocked = data['blocked']
|
82
|
+
@yards = data['yards']
|
83
|
+
@nullified = data['nullified']
|
84
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
85
|
+
@player = Nfl::Player.new(data['player']) if data['player']
|
86
|
+
end
|
87
|
+
|
88
|
+
def nullified?
|
89
|
+
@nullified.to_s == 'true'
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
class Nfl::PlayFirstDownStatistics < Data
|
94
|
+
attr_accessor :category, :nullified, :team
|
95
|
+
def initialize(data)
|
96
|
+
@category = data['category']
|
97
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
98
|
+
@nullified = data['nullified']
|
99
|
+
end
|
100
|
+
|
101
|
+
def nullified?
|
102
|
+
@nullified.to_s == 'true'
|
103
|
+
end
|
104
|
+
end
|
105
|
+
|
106
|
+
class Nfl::PlayPassingStatistics < Data
|
107
|
+
attr_accessor :attempt, :att_yards, :complete, :firstdown, :goaltogo, :inside_20, :interception, :sack, :sack_yards, :touchdown, :yards, :nullified, :team, :player
|
108
|
+
def initialize(data)
|
109
|
+
@attempt = data['attempt']
|
110
|
+
@att_yards = data['att_yards']
|
111
|
+
@complete = data['complete']
|
112
|
+
@firstdown = data['firstdown']
|
113
|
+
@goaltogo = data['goaltogo']
|
114
|
+
@inside_20 = data['inside_20']
|
115
|
+
@interception = data['interception']
|
116
|
+
@sack = data['sack']
|
117
|
+
@sack_yards = data['sack_yards']
|
118
|
+
@touchdown = data['touchdown']
|
119
|
+
@yards = data['yards']
|
120
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
121
|
+
@player = Nfl::Player.new(data['player']) if data['player']
|
122
|
+
@nullified = data['nullified']
|
123
|
+
end
|
124
|
+
|
125
|
+
def nullified?
|
126
|
+
@nullified.to_s == 'true'
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
class Nfl::PlayPenaltyStatistics < Data
|
131
|
+
attr_accessor :penalty, :yards, :nullified, :team, :player
|
132
|
+
def initialize(data)
|
133
|
+
@penalty = data['penalty'] if data['penalty']
|
134
|
+
@yards = data['yards'] if data['yards']
|
135
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
136
|
+
@player = Nfl::Player.new(data['player']) if data['player']
|
137
|
+
@nullified = data['nullified']
|
138
|
+
end
|
139
|
+
|
140
|
+
def nullified?
|
141
|
+
@nullified.to_s == 'true'
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
145
|
+
class Nfl::PlayPuntStatistics < Data
|
146
|
+
attr_accessor :attempt, :downed, :faircatch, :inside_20, :out_of_bounds, :touchback, :yards, :nullified, :team, :player
|
147
|
+
def initialize(data)
|
148
|
+
@attempt = data['attempt']
|
149
|
+
@downed = data['downed']
|
150
|
+
@inside_20 = data['inside_20']
|
151
|
+
@out_of_bounds = data['out_of_bounds']
|
152
|
+
@touchback = data['touchback']
|
153
|
+
@yards = data['yards']
|
154
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
155
|
+
@player = Nfl::Player.new(data['player']) if data['player']
|
156
|
+
@nullified = data['nullified']
|
157
|
+
end
|
158
|
+
|
159
|
+
def nullified?
|
160
|
+
@nullified.to_s == 'true'
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
class Nfl::PlayReceiveStatistics < Data
|
165
|
+
attr_accessor :firstdown, :goaltogo, :inside_20, :reception, :target, :touchdown, :yards, :yards_after_catch, :nullified, :team, :player
|
166
|
+
def initialize(data)
|
167
|
+
@firstdown = data['firstdown']
|
168
|
+
@goaltogo = data['goaltogo']
|
169
|
+
@inside_20 = data['inside_20']
|
170
|
+
@reception = data['reception']
|
171
|
+
@target = data['target']
|
172
|
+
@touchdown = data['touchdown']
|
173
|
+
@yards = data['yards']
|
174
|
+
@yards_after_catch = data['yards_after_catch']
|
175
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
176
|
+
@player = Nfl::Player.new(data['player']) if data['player']
|
177
|
+
@nullified = data['nullified']
|
178
|
+
end
|
179
|
+
|
180
|
+
def nullified?
|
181
|
+
@nullified.to_s == 'true'
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
class Nfl::PlayRushStatistics < Data
|
186
|
+
attr_accessor :attempt, :firstdown, :tlost, :tlost_yards, :yards, :inside_20, :goal_to_go, :team, :player, :nullified, :touchdown
|
187
|
+
def initialize(data)
|
188
|
+
@attempt = data['attempt']
|
189
|
+
@firstdown = data['firstdown']
|
190
|
+
@goal_to_go = data['goal_to_go']
|
191
|
+
@inside_20 = data['inside_20']
|
192
|
+
@tlost = data['tlost']
|
193
|
+
@tlost_yards = data['tlost_yards']
|
194
|
+
@touchdown = data['touchdown']
|
195
|
+
@yards = data['yards']
|
196
|
+
|
197
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
198
|
+
@player = Nfl::Player.new(data['player']) if data['player']
|
199
|
+
@nullified = data['nullified']
|
200
|
+
end
|
201
|
+
|
202
|
+
def nullified?
|
203
|
+
@nullified.to_s == 'true'
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
|
208
|
+
class Nfl::PlayKickStatistics < Data
|
209
|
+
attr_accessor :attempt, :yards, :gross_yards, :touchback, :team, :player, :endzone, :inside_20, :nullified
|
210
|
+
def initialize(data)
|
211
|
+
@endzone = data['endzone']
|
212
|
+
@inside_20 = data['inside_20']
|
213
|
+
@attempt = data['attempt']
|
214
|
+
@yards = data['yards']
|
215
|
+
@gross_yards = data['gross_yards']
|
216
|
+
@touchback = data['touchback']
|
217
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
218
|
+
@player = Nfl::Player.new(data['player']) if data['player']
|
219
|
+
@nullified = data['nullified']
|
220
|
+
end
|
221
|
+
|
222
|
+
def nullified?
|
223
|
+
@nullified.to_s == 'true'
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
class Nfl::PlayReturnStatistics < Data
|
228
|
+
attr_accessor :category, :downed, :faircatch, :out_of_bounds, :return, :touchback, :yards, :team, :nullified, :player
|
229
|
+
def initialize(data)
|
230
|
+
@category = data['category']
|
231
|
+
@downed = data['downed']
|
232
|
+
@faircatch = data['faircatch']
|
233
|
+
@out_of_bounds = data['out_of_bounds']
|
234
|
+
@return = data['return']
|
235
|
+
@touchback = data['touchback']
|
236
|
+
@yards = data['yards']
|
237
|
+
@team = Sportradar::Api::Nfl::Team.new(data['team']) if data['team']
|
238
|
+
@player = Nfl::Player.new(data['player']) if data['player']
|
239
|
+
@nullified = data['nullified']
|
240
|
+
end
|
241
|
+
|
242
|
+
def nullified?
|
243
|
+
@nullified.to_s == 'true'
|
244
|
+
end
|
245
|
+
end
|
246
|
+
end
|
247
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sportradar
|
2
2
|
module Api
|
3
3
|
class Nfl::Quarter < Data
|
4
|
-
attr_accessor :response, :id, :number, :sequence, :home_points, :away_points, :drives
|
4
|
+
attr_accessor :response, :id, :number, :sequence, :home_points, :away_points, :drives, :scoring
|
5
5
|
|
6
6
|
def initialize(data)
|
7
7
|
@response = data
|
@@ -13,8 +13,17 @@ module Sportradar
|
|
13
13
|
@away_points = data["away_points"]
|
14
14
|
# @away_points = response['scoring']['away']['points'] # from play_by_play
|
15
15
|
@drives = parse_into_array(selector: response["play_by_play"]["drive"], klass: Sportradar::Api::Nfl::Drive) if response["play_by_play"] && response["play_by_play"]["drive"]
|
16
|
+
@scoring = Nfl::QuarterScoring.new(data['scoring']) if data['scoring']
|
16
17
|
end
|
17
18
|
|
18
19
|
end
|
20
|
+
|
21
|
+
class Nfl::QuarterScoring < Data
|
22
|
+
attr_accessor :home, :away
|
23
|
+
def initialize(data)
|
24
|
+
@home = OpenStruct.new(data['home'])
|
25
|
+
@away = OpenStruct.new(data['away'])
|
26
|
+
end
|
27
|
+
end
|
19
28
|
end
|
20
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sportradar-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eggett
|
@@ -270,6 +270,7 @@ files:
|
|
270
270
|
- lib/sportradar/api/images/tag.rb
|
271
271
|
- lib/sportradar/api/live_images.rb
|
272
272
|
- lib/sportradar/api/nfl.rb
|
273
|
+
- lib/sportradar/api/nfl/.play_statistics.rb.swo
|
273
274
|
- lib/sportradar/api/nfl/broadcast.rb
|
274
275
|
- lib/sportradar/api/nfl/changelog.rb
|
275
276
|
- lib/sportradar/api/nfl/coach.rb
|
@@ -286,6 +287,7 @@ files:
|
|
286
287
|
- lib/sportradar/api/nfl/injury.rb
|
287
288
|
- lib/sportradar/api/nfl/league_depth_chart.rb
|
288
289
|
- lib/sportradar/api/nfl/play.rb
|
290
|
+
- lib/sportradar/api/nfl/play_statistics.rb
|
289
291
|
- lib/sportradar/api/nfl/player.rb
|
290
292
|
- lib/sportradar/api/nfl/position.rb
|
291
293
|
- lib/sportradar/api/nfl/quarter.rb
|