sportradar-api 0.1.31 → 0.1.32
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/football/stat_pack/defense.rb +34 -0
- data/lib/sportradar/api/football/stat_pack/extra_points.rb +51 -0
- data/lib/sportradar/api/football/stat_pack/field_goals.rb +17 -0
- data/lib/sportradar/api/football/stat_pack/fumbles.rb +23 -0
- data/lib/sportradar/api/football/stat_pack/int_returns.rb +17 -0
- data/lib/sportradar/api/football/stat_pack/kick_returns.rb +18 -0
- data/lib/sportradar/api/football/stat_pack/kickoffs.rb +18 -0
- data/lib/sportradar/api/football/stat_pack/misc_returns.rb +18 -0
- data/lib/sportradar/api/football/stat_pack/passing.rb +26 -0
- data/lib/sportradar/api/football/stat_pack/penalties.rb +37 -0
- data/lib/sportradar/api/football/stat_pack/punt_returns.rb +18 -0
- data/lib/sportradar/api/football/stat_pack/punts.rb +21 -0
- data/lib/sportradar/api/football/stat_pack/receiving.rb +21 -0
- data/lib/sportradar/api/football/stat_pack/rushing.rb +20 -0
- data/lib/sportradar/api/football/stat_pack.rb +36 -0
- data/lib/sportradar/api/football.rb +15 -0
- data/lib/sportradar/api/nfl/game.rb +6 -1
- data/lib/sportradar/api/nfl/game_statistic.rb +75 -0
- data/lib/sportradar/api/nfl/quarter.rb +4 -1
- data/lib/sportradar/api/nfl/stat.rb +7 -0
- data/lib/sportradar/api/nfl/team.rb +1 -1
- data/lib/sportradar/api/version.rb +1 -1
- data/lib/sportradar/api.rb +4 -0
- metadata +20 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31f8cd988efb0a39c926b9f74d1aa0c2cc1d85e5
|
4
|
+
data.tar.gz: 2dc85ad01a1223ac08915aad3b52d1f40c140943
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b52ea1b015c3bbd292d9409a3c976ac6dc0f1f3cd179d5481c5bbe09b5a40a2f638dd4d0bde183c800adf9eebddf553d8c71961d0f99912db2625226ea212383
|
7
|
+
data.tar.gz: 9452cd537323867326a3c7ff606c837fb53646ae16ab571ce6560d9c0997e2a36a7fa4cca02979588ef16252eef3bb65011923a8a2ff1ba96a9119188bf99459
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::Defense < Football::StatPack
|
4
|
+
attr_accessor :tackles, :assists, :combined, :sacks, :sack_yards, :interceptions, :passes_defended, :forced_fumbles, :fumble_recoveries, :qb_hits, :tloss, :tloss_yards, :safeties, :sp_tackles, :sp_assists, :sp_forced_fumbles, :sp_fumble_recoveries, :sp_blocks, :misc_tackles, :misc_assists, :misc_forced_fumbles, :misc_fumble_recoveries, :missed_tackles
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@tackles = response["tackles"]
|
8
|
+
@assists = response["assists"]
|
9
|
+
@combined = response["combined"]
|
10
|
+
@sacks = response["sacks"]
|
11
|
+
@sack_yards = response["sack_yards"]
|
12
|
+
@interceptions = response["interceptions"]
|
13
|
+
@passes_defended = response["passes_defended"]
|
14
|
+
@forced_fumbles = response["forced_fumbles"]
|
15
|
+
@fumble_recoveries = response["fumble_recoveries"]
|
16
|
+
@qb_hits = response["qb_hits"]
|
17
|
+
@tloss = response["tloss"]
|
18
|
+
@tloss_yards = response["tloss_yards"]
|
19
|
+
@safeties = response["safeties"]
|
20
|
+
@sp_tackles = response["sp_tackles"]
|
21
|
+
@sp_assists = response["sp_assists"]
|
22
|
+
@sp_forced_fumbles = response["sp_forced_fumbles"]
|
23
|
+
@sp_fumble_recoveries = response["sp_fumble_recoveries"]
|
24
|
+
@sp_blocks = response["sp_blocks"]
|
25
|
+
@misc_tackles = response["misc_tackles"]
|
26
|
+
@misc_assists = response["misc_assists"]
|
27
|
+
@misc_forced_fumbles = response["misc_forced_fumbles"]
|
28
|
+
@misc_fumble_recoveries = response["misc_fumble_recoveries"]
|
29
|
+
@missed_tackles = response["missed_tackles"]
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::ExtraPoints < Football::StatPack
|
4
|
+
attr_accessor :attempts, :made, :blocked, :pass_attempts, :pass_successes, :rush_attempts, :rush_successes, :defense_attempts, :defense_successes, :turnover_successes
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
kick_data = response['kicks'] || response
|
8
|
+
@attempts = kick_response["attempts"]
|
9
|
+
@made = kick_response["made"]
|
10
|
+
@blocked = kick_response["blocked"]
|
11
|
+
if response['conversions']
|
12
|
+
@pass_attempts = response["pass_attempts"]
|
13
|
+
@pass_successes = response["pass_successes"]
|
14
|
+
@rush_attempts = response["rush_attempts"]
|
15
|
+
@rush_successes = response["rush_successes"]
|
16
|
+
@defense_attempts = response["defense_attempts"]
|
17
|
+
@defense_successes = response["defense_successes"]
|
18
|
+
@turnover_successes = response["turnover_successes"]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# # sample response
|
27
|
+
# extra_points =
|
28
|
+
# {"kicks"=>
|
29
|
+
# {"player"=>
|
30
|
+
# [
|
31
|
+
# {"name"=>"Aldrick Rosas",
|
32
|
+
# "jersey"=>"03",
|
33
|
+
# "reference"=>"00-0032870",
|
34
|
+
# "id"=>"8fb2ca06-3d13-4552-98e0-7b913b4ab5b9",
|
35
|
+
# "position"=>"K",
|
36
|
+
# "attempts"=>"1",
|
37
|
+
# "made"=>"1",
|
38
|
+
# "blocked"=>"0"}],
|
39
|
+
# "attempts"=>"3",
|
40
|
+
# "blocked"=>"0",
|
41
|
+
# "made"=>"3"},
|
42
|
+
# "conversions"=> {
|
43
|
+
# "pass_attempts"=>"0",
|
44
|
+
# "pass_successes"=>"0",
|
45
|
+
# "rush_attempts"=>"0",
|
46
|
+
# "rush_successes"=>"0",
|
47
|
+
# "defense_attempts"=>"0",
|
48
|
+
# "defense_successes"=>"0",
|
49
|
+
# "turnover_successes"=>"0"
|
50
|
+
# }
|
51
|
+
# }
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::FieldGoals < Football::StatPack
|
4
|
+
attr_accessor :attempts, :made, :blocked, :yards, :avg_yards, :longest
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@attempts = response["attempts"]
|
8
|
+
@made = response["made"]
|
9
|
+
@blocked = response["blocked"]
|
10
|
+
@yards = response["yards"]
|
11
|
+
@avg_yards = response["avg_yards"]
|
12
|
+
@longest = response["longest"]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::Fumbles < Football::StatPack
|
4
|
+
attr_accessor :response, :fumbles, :lost_fumbles, :own_rec, :own_rec_yards, :opp_rec, :opp_rec_yards, :out_of_bounds, :forced_fumbles, :own_rec_tds, :opp_rec_tds, :ez_rec_tds
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@response = response[1] if response.is_a? Array
|
8
|
+
@fumbles = response["fumbles"]
|
9
|
+
@lost_fumbles = response["lost_fumbles"]
|
10
|
+
@own_rec = response["own_rec"]
|
11
|
+
@own_rec_yards = response["own_rec_yards"]
|
12
|
+
@opp_rec = response["opp_rec"]
|
13
|
+
@opp_rec_yards = response["opp_rec_yards"]
|
14
|
+
@out_of_bounds = response["out_of_bounds"]
|
15
|
+
@forced_fumbles = response["forced_fumbles"]
|
16
|
+
@own_rec_tds = response["own_rec_tds"]
|
17
|
+
@opp_rec_tds = response["opp_rec_tds"]
|
18
|
+
@ez_rec_tds = response["ez_rec_tds"]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::IntReturns < Football::StatPack
|
4
|
+
attr_accessor :returns, :yards, :avg_yards, :touchdowns, :longest, :longest_touchdown
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@returns = response["returns"]
|
8
|
+
@yards = response["yards"]
|
9
|
+
@avg_yards = response["avg_yards"]
|
10
|
+
@touchdowns = response["touchdowns"]
|
11
|
+
@longest = response["longest"]
|
12
|
+
@longest_touchdown = response["longest_touchdown"]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::KickReturns < Football::StatPack
|
4
|
+
attr_accessor :returns, :yards, :avg_yards, :touchdowns, :longest, :faircatches, :longest_touchdown
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@returns = response["returns"]
|
8
|
+
@yards = response["yards"]
|
9
|
+
@avg_yards = response["avg_yards"]
|
10
|
+
@touchdowns = response["touchdowns"]
|
11
|
+
@longest = response["longest"]
|
12
|
+
@faircatches = response["faircatches"]
|
13
|
+
@longest_touchdown = response["longest_touchdown"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::Kickoffs < Football::StatPack
|
4
|
+
attr_accessor :kickoffs, :endzone, :inside_20, :return_yards, :touchbacks, :yards, :out_of_bounds
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@kickoffs = response["kickoffs"]
|
8
|
+
@endzone = response["endzone"]
|
9
|
+
@inside_20 = response["inside_20"]
|
10
|
+
@return_yards = response["return_yards"]
|
11
|
+
@touchbacks = response["touchbacks"]
|
12
|
+
@yards = response["yards"]
|
13
|
+
@out_of_bounds = response["out_of_bounds"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::MiscReturns < Football::StatPack
|
4
|
+
attr_accessor :returns, :yards, :touchdowns, :blk_fg_touchdowns, :blk_punt_touchdowns, :fg_return_touchdowns, :ez_rec_touchdowns
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@returns = response["returns"]
|
8
|
+
@yards = response["yards"]
|
9
|
+
@touchdowns = response["touchdowns"]
|
10
|
+
@blk_fg_touchdowns = response["blk_fg_touchdowns"]
|
11
|
+
@blk_punt_touchdowns = response["blk_punt_touchdowns"]
|
12
|
+
@fg_return_touchdowns = response["fg_return_touchdowns"]
|
13
|
+
@ez_rec_touchdowns = response["ez_rec_touchdowns"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::Passing < Football::StatPack
|
4
|
+
attr_accessor :attempts, :completions, :cmp_pct, :yards, :avg_yards, :sacks, :sack_yards, :touchdowns, :longest, :interceptions, :rating, :longest_touchdown, :air_yards, :net_yards, :redzone_attempts
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@attempts = response["attempts"]
|
8
|
+
@completions = response["completions"]
|
9
|
+
@cmp_pct = response["cmp_pct"]
|
10
|
+
@yards = response["yards"]
|
11
|
+
@avg_yards = response["avg_yards"]
|
12
|
+
@sacks = response["sacks"]
|
13
|
+
@sack_yards = response["sack_yards"]
|
14
|
+
@touchdowns = response["touchdowns"]
|
15
|
+
@longest = response["longest"]
|
16
|
+
@interceptions = response["interceptions"]
|
17
|
+
@rating = response["rating"]
|
18
|
+
@longest_touchdown = response["longest_touchdown"]
|
19
|
+
@air_yards = response["air_yards"]
|
20
|
+
@net_yards = response["net_yards"] # passing net_yards is the correct measure for team stats, as it includes sack yardage. that is how NFL counts team yardage
|
21
|
+
@redzone_attempts = response["redzone_attempts"]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::Penalties < Football::StatPack
|
4
|
+
attr_accessor :penalties, :yards
|
5
|
+
|
6
|
+
alias :count :penalties
|
7
|
+
|
8
|
+
def set_stats
|
9
|
+
@response = response[1] if response.is_a? Array
|
10
|
+
@penalties = response['penalties']
|
11
|
+
@yards = response['yards']
|
12
|
+
end
|
13
|
+
def formatted
|
14
|
+
"#{count}-#{yards}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# # sample response
|
22
|
+
# example_penalty_hash =
|
23
|
+
# ["7",
|
24
|
+
# {"player"=>
|
25
|
+
# [{"name"=>"Curtis Grant",
|
26
|
+
# "jersey"=>"58",
|
27
|
+
# "reference"=>"00-0032084",
|
28
|
+
# "id"=>"b807020d-d9c8-4fd0-9acb-fb61ddffae50",
|
29
|
+
# "position"=>"LB",
|
30
|
+
# "penalties"=>"1",
|
31
|
+
# "yards"=>"5"},
|
32
|
+
# # ...
|
33
|
+
# ],
|
34
|
+
# "penalties"=>"7",
|
35
|
+
# "yards"=>"58"
|
36
|
+
# }
|
37
|
+
# ]
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::PuntReturns < Football::StatPack
|
4
|
+
attr_accessor :returns, :yards, :avg_yards, :touchdowns, :longest, :faircatches, :longest_touchdown
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@returns = response["returns"]
|
8
|
+
@yards = response["yards"]
|
9
|
+
@avg_yards = response["avg_yards"]
|
10
|
+
@touchdowns = response["touchdowns"]
|
11
|
+
@longest = response["longest"]
|
12
|
+
@faircatches = response["faircatches"]
|
13
|
+
@longest_touchdown = response["longest_touchdown"]
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::Punts < Football::StatPack
|
4
|
+
attr_accessor :avg_yards, :yards, :attempts, :blocked, :longest, :touchbacks, :inside_20, :avg_net_yards, :return_yards, :net_yards
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@avg_yards = response["avg_yards"]
|
8
|
+
@yards = response["yards"]
|
9
|
+
@attempts = response["attempts"]
|
10
|
+
@blocked = response["blocked"]
|
11
|
+
@longest = response["longest"]
|
12
|
+
@touchbacks = response["touchbacks"]
|
13
|
+
@inside_20 = response["inside_20"]
|
14
|
+
@avg_net_yards = response["avg_net_yards"]
|
15
|
+
@return_yards = response["return_yards"]
|
16
|
+
@net_yards = response["net_yards"]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::Receiving < Football::StatPack
|
4
|
+
attr_accessor :avg_yards, :yards, :touchdowns, :longest, :longest_touchdown, :targets, :receptions, :yards_after_catch, :redzone_targets, :air_yards
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@avg_yards = response["avg_yards"]
|
8
|
+
@yards = response["yards"]
|
9
|
+
@touchdowns = response["touchdowns"]
|
10
|
+
@longest = response["longest"]
|
11
|
+
@longest_touchdown = response["longest_touchdown"]
|
12
|
+
@targets = response["targets"]
|
13
|
+
@receptions = response["receptions"]
|
14
|
+
@yards_after_catch = response["yards_after_catch"]
|
15
|
+
@redzone_targets = response["redzone_targets"]
|
16
|
+
@air_yards = response["air_yards"]
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Football::StatPack::Rushing < Football::StatPack
|
4
|
+
attr_accessor :avg_yards, :yards, :touchdowns, :longest, :longest_touchdown, :attempts, :tlost, :tlost_yards, :redzone_attempts
|
5
|
+
|
6
|
+
def set_stats
|
7
|
+
@avg_yards = response["avg_yards"]
|
8
|
+
@yards = response["yards"]
|
9
|
+
@touchdowns = response["touchdowns"]
|
10
|
+
@longest = response["longest"]
|
11
|
+
@longest_touchdown = response["longest_touchdown"]
|
12
|
+
@attempts = response["attempts"]
|
13
|
+
@tlost = response["tlost"]
|
14
|
+
@tlost_yards = response["tlost_yards"]
|
15
|
+
@redzone_attempts = response["redzone_attempts"]
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
module Football
|
4
|
+
class StatPack < Data
|
5
|
+
attr_accessor :response, :player, :name, :id, :position, :yards
|
6
|
+
|
7
|
+
def initialize(data)
|
8
|
+
@response = data
|
9
|
+
set_stats
|
10
|
+
# @player = Sportradar::Api::Nfl::Player.new(response) if response['name'] # this isn't used yet, and we need to determine a better solution
|
11
|
+
end
|
12
|
+
|
13
|
+
def players
|
14
|
+
@players ||= set_players
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def set_stats
|
20
|
+
raise NotImplementedError, "Please implement `#{self.class}#set_stats`"
|
21
|
+
end
|
22
|
+
|
23
|
+
def set_players
|
24
|
+
if response["player"]
|
25
|
+
if response["player"].is_a? Hash
|
26
|
+
@players = [ self.class.new(response["player"]) ]
|
27
|
+
else
|
28
|
+
@players = response["player"].map{ |hash| self.class.new(hash) }
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require "sportradar/api/football/stat_pack"
|
2
|
+
require "sportradar/api/football/stat_pack/defense"
|
3
|
+
require "sportradar/api/football/stat_pack/extra_points"
|
4
|
+
require "sportradar/api/football/stat_pack/field_goals"
|
5
|
+
require "sportradar/api/football/stat_pack/fumbles"
|
6
|
+
require "sportradar/api/football/stat_pack/int_returns"
|
7
|
+
require "sportradar/api/football/stat_pack/kickoffs"
|
8
|
+
require "sportradar/api/football/stat_pack/kick_returns"
|
9
|
+
require "sportradar/api/football/stat_pack/misc_returns"
|
10
|
+
require "sportradar/api/football/stat_pack/passing"
|
11
|
+
require "sportradar/api/football/stat_pack/penalties"
|
12
|
+
require "sportradar/api/football/stat_pack/punt_returns"
|
13
|
+
require "sportradar/api/football/stat_pack/punts"
|
14
|
+
require "sportradar/api/football/stat_pack/receiving"
|
15
|
+
require "sportradar/api/football/stat_pack/rushing"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sportradar
|
2
2
|
module Api
|
3
3
|
class Nfl::Game < Data
|
4
|
-
attr_accessor :response, :id, :status, :reference, :number, :scheduled, :entry_mode, :venue, :home, :away, :broadcast, :number, :attendance, :utc_offset, :weather, :clock, :quarter, :summary, :situation, :last_event, :scoring, :scoring_drives, :quarters
|
4
|
+
attr_accessor :response, :id, :status, :reference, :number, :scheduled, :entry_mode, :venue, :home, :away, :broadcast, :number, :attendance, :utc_offset, :weather, :clock, :quarter, :summary, :situation, :last_event, :scoring, :scoring_drives, :quarters, :stats
|
5
5
|
|
6
6
|
def initialize(data)
|
7
7
|
@response = data
|
@@ -35,6 +35,11 @@ module Sportradar
|
|
35
35
|
@home = Sportradar::Api::Nfl::Team.new location["home"] if location["home"]
|
36
36
|
@away = Sportradar::Api::Nfl::Team.new location["away"] if location["away"]
|
37
37
|
@broadcast = Sportradar::Api::Nfl::Broadcast.new data["broadcast"] if data["broadcast"]
|
38
|
+
if data["team"]
|
39
|
+
both_stats = data["team"].map { |hash| [hash["id"], Sportradar::Api::Nfl::GameStatistic.new(hash)] }.to_h
|
40
|
+
@home.stats = both_stats[@home.id]
|
41
|
+
@away.stats = both_stats[@away.id]
|
42
|
+
end
|
38
43
|
end
|
39
44
|
|
40
45
|
def current_score
|
@@ -0,0 +1,75 @@
|
|
1
|
+
module Sportradar
|
2
|
+
module Api
|
3
|
+
class Nfl::GameStatistic < Data
|
4
|
+
attr_accessor :response, :id, :efficiency, :first_downs, :interceptions, :touchdowns, :name, :market, :alias, :reference, :possession_time, :avg_gain, :safeties, :turnovers, :play_count, :rush_plays, :total_yards, :lost_fumbles, :penalty_yards, :return_yards
|
5
|
+
|
6
|
+
# attr_writer :rushing, :receiving, :punts, :punt_returns, :penalties, :passing, :misc_returns, :kickoffs, :kick_returns, :int_returns, :fumbles, :field_goals, :extra_points, :defense # probably not necessary, but leaving here in case we want it later
|
7
|
+
|
8
|
+
def initialize(data)
|
9
|
+
@response = data
|
10
|
+
@id = data["id"]
|
11
|
+
@name = data["name"]
|
12
|
+
@market = data["market"]
|
13
|
+
@alias = data["alias"]
|
14
|
+
@reference = data["reference"]
|
15
|
+
@efficiency = data["efficiency"]
|
16
|
+
@first_downs = data["first_downs"]
|
17
|
+
@interceptions = data["interceptions"]
|
18
|
+
@touchdowns = data["touchdowns"]
|
19
|
+
@possession_time = data["possession_time"]
|
20
|
+
@avg_gain = data["avg_gain"]
|
21
|
+
@safeties = data["safeties"]
|
22
|
+
@turnovers = data["turnovers"]
|
23
|
+
@play_count = data["play_count"]
|
24
|
+
@rush_plays = data["rush_plays"]
|
25
|
+
@total_yards = data["total_yards"]
|
26
|
+
@lost_fumbles = data["lost_fumbles"]
|
27
|
+
@penalty_yards = data["penalty_yards"]
|
28
|
+
@return_yards = data["return_yards"]
|
29
|
+
end
|
30
|
+
def rushing
|
31
|
+
@rushing ||= Sportradar::Api::Football::StatPack::Rushing.new(response["rushing"])
|
32
|
+
end
|
33
|
+
def receiving
|
34
|
+
@receiving ||= Sportradar::Api::Football::StatPack::Receiving.new(response["receiving"])
|
35
|
+
end
|
36
|
+
def punts
|
37
|
+
@punts ||= Sportradar::Api::Football::StatPack::Punts.new(response["punts"])
|
38
|
+
end
|
39
|
+
def punt_returns
|
40
|
+
@punt_returns ||= Sportradar::Api::Football::StatPack::PuntReturns.new(response["punt_returns"])
|
41
|
+
end
|
42
|
+
def penalties
|
43
|
+
@penalties ||= Sportradar::Api::Football::StatPack::Penalties.new(response["penalties"])
|
44
|
+
end
|
45
|
+
def passing
|
46
|
+
@passing ||= Sportradar::Api::Football::StatPack::Passing.new(response["passing"])
|
47
|
+
end
|
48
|
+
def misc_returns
|
49
|
+
@misc_returns ||= Sportradar::Api::Football::StatPack::MiscReturns.new(response["misc_returns"])
|
50
|
+
end
|
51
|
+
def kickoffs
|
52
|
+
@kickoffs ||= Sportradar::Api::Football::StatPack::Kickoffs.new(response["kickoffs"])
|
53
|
+
end
|
54
|
+
def kick_returns
|
55
|
+
@kick_returns ||= Sportradar::Api::Football::StatPack::KickReturns.new(response["kick_returns"])
|
56
|
+
end
|
57
|
+
def int_returns
|
58
|
+
@int_returns ||= Sportradar::Api::Football::StatPack::IntReturns.new(response["int_returns"])
|
59
|
+
end
|
60
|
+
def fumbles
|
61
|
+
@fumbles ||= Sportradar::Api::Football::StatPack::Fumbles.new(response["fumbles"])
|
62
|
+
end
|
63
|
+
def field_goals
|
64
|
+
@field_goals ||= Sportradar::Api::Football::StatPack::FieldGoals.new(response["field_goals"])
|
65
|
+
end
|
66
|
+
def extra_points
|
67
|
+
@extra_points ||= Sportradar::Api::Football::StatPack::ExtraPoints.new(response["extra_points"])
|
68
|
+
end
|
69
|
+
def defense
|
70
|
+
@defense ||= Sportradar::Api::Football::StatPack::Defense.new(response["defense"])
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -12,7 +12,10 @@ module Sportradar
|
|
12
12
|
# @home_points = response['scoring']['home']['points'] # from play_by_play
|
13
13
|
@away_points = data["away_points"]
|
14
14
|
# @away_points = response['scoring']['away']['points'] # from play_by_play
|
15
|
-
|
15
|
+
if (raw_drives = data.dig("play_by_play", 'drive'))
|
16
|
+
raw_drives = raw_drives.is_a?(Hash) ? [ raw_drives ] : raw_drives
|
17
|
+
@drives = raw_drives.map{ |drive| Sportradar::Api::Nfl::Drive.new drive }
|
18
|
+
end
|
16
19
|
end
|
17
20
|
|
18
21
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module Sportradar
|
2
2
|
module Api
|
3
3
|
class Nfl::Team < Data
|
4
|
-
attr_accessor :response, :id, :name, :alias, :game_number, :defense, :special_teams, :offense, :players, :statistics, :team_records, :player_records, :market, :franchise, :venue, :hierarchy, :coaches, :players, :used_timeouts, :remaining_timeouts, :points, :wins, :losses, :ties, :win_pct, :rank
|
4
|
+
attr_accessor :response, :id, :name, :alias, :game_number, :defense, :special_teams, :offense, :players, :statistics, :team_records, :player_records, :market, :franchise, :venue, :hierarchy, :coaches, :players, :used_timeouts, :remaining_timeouts, :points, :wins, :losses, :ties, :win_pct, :rank, :stats
|
5
5
|
|
6
6
|
alias :score :points
|
7
7
|
|
data/lib/sportradar/api.rb
CHANGED
@@ -27,6 +27,8 @@ require "sportradar/api/soccer/tournament"
|
|
27
27
|
require "sportradar/api/soccer/tournament_group"
|
28
28
|
require "sportradar/api/soccer/venue"
|
29
29
|
|
30
|
+
require "sportradar/api/football"
|
31
|
+
|
30
32
|
require "sportradar/api/nfl"
|
31
33
|
require "sportradar/api/nfl/broadcast"
|
32
34
|
require "sportradar/api/nfl/changelog"
|
@@ -39,6 +41,7 @@ require "sportradar/api/nfl/drive"
|
|
39
41
|
require "sportradar/api/nfl/event"
|
40
42
|
require "sportradar/api/nfl/franchise"
|
41
43
|
require "sportradar/api/nfl/game"
|
44
|
+
require "sportradar/api/nfl/game_statistic"
|
42
45
|
require "sportradar/api/nfl/hierarchy"
|
43
46
|
require "sportradar/api/nfl/injury"
|
44
47
|
require "sportradar/api/nfl/play"
|
@@ -54,6 +57,7 @@ require "sportradar/api/nfl/team"
|
|
54
57
|
require "sportradar/api/nfl/venue"
|
55
58
|
require "sportradar/api/nfl/week"
|
56
59
|
|
60
|
+
|
57
61
|
require "sportradar/api/live_images"
|
58
62
|
require "sportradar/api/images"
|
59
63
|
require "sportradar/api/images/asset_list"
|
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.1.
|
4
|
+
version: 0.1.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Eggett
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -229,6 +229,22 @@ files:
|
|
229
229
|
- lib/sportradar/api/content.rb
|
230
230
|
- lib/sportradar/api/data.rb
|
231
231
|
- lib/sportradar/api/error.rb
|
232
|
+
- lib/sportradar/api/football.rb
|
233
|
+
- lib/sportradar/api/football/stat_pack.rb
|
234
|
+
- lib/sportradar/api/football/stat_pack/defense.rb
|
235
|
+
- lib/sportradar/api/football/stat_pack/extra_points.rb
|
236
|
+
- lib/sportradar/api/football/stat_pack/field_goals.rb
|
237
|
+
- lib/sportradar/api/football/stat_pack/fumbles.rb
|
238
|
+
- lib/sportradar/api/football/stat_pack/int_returns.rb
|
239
|
+
- lib/sportradar/api/football/stat_pack/kick_returns.rb
|
240
|
+
- lib/sportradar/api/football/stat_pack/kickoffs.rb
|
241
|
+
- lib/sportradar/api/football/stat_pack/misc_returns.rb
|
242
|
+
- lib/sportradar/api/football/stat_pack/passing.rb
|
243
|
+
- lib/sportradar/api/football/stat_pack/penalties.rb
|
244
|
+
- lib/sportradar/api/football/stat_pack/punt_returns.rb
|
245
|
+
- lib/sportradar/api/football/stat_pack/punts.rb
|
246
|
+
- lib/sportradar/api/football/stat_pack/receiving.rb
|
247
|
+
- lib/sportradar/api/football/stat_pack/rushing.rb
|
232
248
|
- lib/sportradar/api/images.rb
|
233
249
|
- lib/sportradar/api/images/asset.rb
|
234
250
|
- lib/sportradar/api/images/asset_list.rb
|
@@ -247,6 +263,7 @@ files:
|
|
247
263
|
- lib/sportradar/api/nfl/event.rb
|
248
264
|
- lib/sportradar/api/nfl/franchise.rb
|
249
265
|
- lib/sportradar/api/nfl/game.rb
|
266
|
+
- lib/sportradar/api/nfl/game_statistic.rb
|
250
267
|
- lib/sportradar/api/nfl/hierarchy.rb
|
251
268
|
- lib/sportradar/api/nfl/injury.rb
|
252
269
|
- lib/sportradar/api/nfl/play.rb
|
@@ -256,6 +273,7 @@ files:
|
|
256
273
|
- lib/sportradar/api/nfl/scoring.rb
|
257
274
|
- lib/sportradar/api/nfl/season.rb
|
258
275
|
- lib/sportradar/api/nfl/situation.rb
|
276
|
+
- lib/sportradar/api/nfl/stat.rb
|
259
277
|
- lib/sportradar/api/nfl/statistic.rb
|
260
278
|
- lib/sportradar/api/nfl/summary.rb
|
261
279
|
- lib/sportradar/api/nfl/team.rb
|