g = Sportradar::Api::Nfl.new('o').game_statistics 'game_id'
team = g.home
team.stats.first_downs['total']
team.stats.first_downs['pass']
team.stats.first_downs['rush']
team.stats.first_downs['penalty']
team.stats.play_count
team.stats.passing.net_yards # passing net_yards is the correct measure, as it includes sack yardage
team.stats.rushing.yards
team.stats.penalties.formatted
g.home.stats.punts
# =>
#<Sportradar::Api::Nfl::Stat::Punts:0x007f9deb740618
@attempts="4",
@avg_net_yards="37.0",
@avg_yards="36.3",
@blocked="0",
@inside_20="2",
@longest="45",
@net_yards="148",
@players=
[#<Sportradar::Api::Nfl::Stat::Punts:0x007f9deb7405f0
@attempts="4",
@avg_net_yards="37.0",
@avg_yards="36.3",
@blocked="0",
@inside_20="2",
@longest="45",
@net_yards="148",
@player=
#<Sportradar::Api::Nfl::Player:0x007f9deb7405c8
@id="9aec0e35-cef7-4093-8de6-49868ca8644b",
@jersey="06",
@last_name=nil,
@name="Brett Kern",
@position="P",
@preferred_name=nil,
@reference="00-0025825",
@references=nil,
@response= <truncated>,
@response= <truncated>,
@return_yards="-3",
@touchbacks="0",
@yards="145">],
@response= <truncated>,
@return_yards="-3",
@touchbacks="0",
@yards="145">
I'm contemplating flipping the API around a bit, so that #players is an array of Player instead of stat objects, but it is much easier to do it this way.
To access stats for a team in a game:
I'm contemplating flipping the API around a bit, so that
#players
is an array ofPlayer
instead of stat objects, but it is much easier to do it this way.Any other thoughts/questions are welcome.