Class: Sportradar::Api::Football::GameStats
- Defined in:
- lib/sportradar/api/football/game_stats.rb
Instance Attribute Summary collapse
-
#alias ⇒ Object
Returns the value of attribute alias.
-
#avg_gain ⇒ Object
Returns the value of attribute avg_gain.
-
#efficiency ⇒ Object
Returns the value of attribute efficiency.
-
#first_downs ⇒ Object
Returns the value of attribute first_downs.
-
#id ⇒ Object
Returns the value of attribute id.
-
#interceptions ⇒ Object
Returns the value of attribute interceptions.
-
#lost_fumbles ⇒ Object
Returns the value of attribute lost_fumbles.
-
#market ⇒ Object
Returns the value of attribute market.
-
#name ⇒ Object
Returns the value of attribute name.
-
#penalty_yards ⇒ Object
Returns the value of attribute penalty_yards.
-
#play_count ⇒ Object
Returns the value of attribute play_count.
-
#possession_time ⇒ Object
Returns the value of attribute possession_time.
-
#reference ⇒ Object
Returns the value of attribute reference.
-
#response ⇒ Object
Returns the value of attribute response.
-
#return_yards ⇒ Object
Returns the value of attribute return_yards.
-
#rush_plays ⇒ Object
Returns the value of attribute rush_plays.
-
#safeties ⇒ Object
Returns the value of attribute safeties.
-
#total_yards ⇒ Object
Returns the value of attribute total_yards.
-
#touchdowns ⇒ Object
Returns the value of attribute touchdowns.
-
#turnovers ⇒ Object
Returns the value of attribute turnovers.
Instance Method Summary collapse
- #defense ⇒ Object
- #dig(*args) ⇒ Object
- #extra_points ⇒ Object
- #field_goals ⇒ Object
- #fumbles ⇒ Object
-
#initialize(data) ⇒ GameStats
constructor
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.
- #int_returns ⇒ Object
- #kick_returns ⇒ Object
- #kickoffs ⇒ Object
- #misc_returns ⇒ Object
- #passing ⇒ Object
- #penalties ⇒ Object
- #punt_returns ⇒ Object
- #punts ⇒ Object
- #receiving ⇒ Object
-
#rushing ⇒ Object
:skip_test_coverage: These are in methods rather than attributes to use them lazily.
Methods inherited from Data
#all_attributes, #attributes, #create_data, #parse_into_array, #parse_into_array_with_options, #parse_out_hashes, #structure_links, #update_data
Constructor Details
#initialize(data) ⇒ GameStats
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
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/sportradar/api/football/game_stats.rb', line 9 def initialize(data) @response = data @id = data["id"] @name = data["name"] @market = data["market"] @alias = data["alias"] @reference = data["reference"] @efficiency = data["efficiency"] @first_downs = data["first_downs"] @interceptions = data["interceptions"] @touchdowns = data["touchdowns"] @possession_time = data.dig('summary', "possession_time") @avg_gain = data.dig('summary', "avg_gain") @safeties = data.dig('summary', "safeties") @turnovers = data.dig('summary', "turnovers") @play_count = data.dig('summary', "play_count") @rush_plays = data.dig('summary', "rush_plays") @total_yards = data.dig('summary', "total_yards") @lost_fumbles = data.dig('summary', "lost_fumbles") @penalty_yards = data.dig('summary', "penalty_yards") @return_yards = data.dig('summary', "return_yards") end |
Instance Attribute Details
#alias ⇒ Object
Returns the value of attribute alias.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def alias @alias end |
#avg_gain ⇒ Object
Returns the value of attribute avg_gain.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def avg_gain @avg_gain end |
#efficiency ⇒ Object
Returns the value of attribute efficiency.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def efficiency @efficiency end |
#first_downs ⇒ Object
Returns the value of attribute first_downs.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def first_downs @first_downs end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def id @id end |
#interceptions ⇒ Object
Returns the value of attribute interceptions.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def interceptions @interceptions end |
#lost_fumbles ⇒ Object
Returns the value of attribute lost_fumbles.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def lost_fumbles @lost_fumbles end |
#market ⇒ Object
Returns the value of attribute market.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def market @market end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def name @name end |
#penalty_yards ⇒ Object
Returns the value of attribute penalty_yards.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def penalty_yards @penalty_yards end |
#play_count ⇒ Object
Returns the value of attribute play_count.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def play_count @play_count end |
#possession_time ⇒ Object
Returns the value of attribute possession_time.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def possession_time @possession_time end |
#reference ⇒ Object
Returns the value of attribute reference.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def reference @reference end |
#response ⇒ Object
Returns the value of attribute response.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def response @response end |
#return_yards ⇒ Object
Returns the value of attribute return_yards.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def return_yards @return_yards end |
#rush_plays ⇒ Object
Returns the value of attribute rush_plays.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def rush_plays @rush_plays end |
#safeties ⇒ Object
Returns the value of attribute safeties.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def safeties @safeties end |
#total_yards ⇒ Object
Returns the value of attribute total_yards.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def total_yards @total_yards end |
#touchdowns ⇒ Object
Returns the value of attribute touchdowns.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def touchdowns @touchdowns end |
#turnovers ⇒ Object
Returns the value of attribute turnovers.
5 6 7 |
# File 'lib/sportradar/api/football/game_stats.rb', line 5 def turnovers @turnovers end |
Instance Method Details
#defense ⇒ Object
133 134 135 136 137 138 |
# File 'lib/sportradar/api/football/game_stats.rb', line 133 def defense @defense ||= if response["defense"] response["defense"] = parse_out_hashes response["defense"] Sportradar::Api::Football::StatPack::Defense.new(response["defense"]) end end |
#dig(*args) ⇒ Object
32 33 34 |
# File 'lib/sportradar/api/football/game_stats.rb', line 32 def dig(*args) args.inject(self) { |memo, arg| memo.public_send(arg) } end |
#extra_points ⇒ Object
126 127 128 129 130 131 |
# File 'lib/sportradar/api/football/game_stats.rb', line 126 def extra_points @extra_points ||= if (data = response["extra_points"] || response["extra_point"]) data = parse_out_hashes data Sportradar::Api::Football::StatPack::ExtraPoints.new(data) end end |
#field_goals ⇒ Object
119 120 121 122 123 124 |
# File 'lib/sportradar/api/football/game_stats.rb', line 119 def field_goals @field_goals ||= if (data = response["field_goals"] || response["field_goal"]) data = parse_out_hashes data Sportradar::Api::Football::StatPack::FieldGoals.new(data) end end |
#fumbles ⇒ Object
112 113 114 115 116 117 |
# File 'lib/sportradar/api/football/game_stats.rb', line 112 def fumbles @fumbles ||= if response["fumbles"] response["fumbles"] = parse_out_hashes response["fumbles"] Sportradar::Api::Football::StatPack::Fumbles.new(response["fumbles"]) end end |
#int_returns ⇒ Object
105 106 107 108 109 110 |
# File 'lib/sportradar/api/football/game_stats.rb', line 105 def int_returns @int_returns ||= if response["int_returns"] response["int_returns"] = parse_out_hashes response["int_returns"] Sportradar::Api::Football::StatPack::IntReturns.new(response["int_returns"]) end end |
#kick_returns ⇒ Object
98 99 100 101 102 103 |
# File 'lib/sportradar/api/football/game_stats.rb', line 98 def kick_returns @kick_returns ||= if (data = response["kick_returns"] || response["kick_return"]) data = parse_out_hashes data Sportradar::Api::Football::StatPack::KickReturns.new(data) end end |
#kickoffs ⇒ Object
91 92 93 94 95 96 |
# File 'lib/sportradar/api/football/game_stats.rb', line 91 def kickoffs @kickoffs ||= if response["kickoffs"] response["kickoffs"] = parse_out_hashes response["kickoffs"] Sportradar::Api::Football::StatPack::Kickoffs.new(response["kickoffs"]) end end |
#misc_returns ⇒ Object
84 85 86 87 88 89 |
# File 'lib/sportradar/api/football/game_stats.rb', line 84 def misc_returns @misc_returns ||= if response["misc_returns"] response["misc_returns"] = parse_out_hashes response["misc_returns"] Sportradar::Api::Football::StatPack::MiscReturns.new(response["misc_returns"]) end end |
#passing ⇒ Object
77 78 79 80 81 82 |
# File 'lib/sportradar/api/football/game_stats.rb', line 77 def passing @passing ||= if response["passing"] response["passing"] = parse_out_hashes response["passing"] Sportradar::Api::Football::StatPack::Passing.new(response["passing"]) end end |
#penalties ⇒ Object
70 71 72 73 74 75 |
# File 'lib/sportradar/api/football/game_stats.rb', line 70 def penalties @penalties ||= if (data = response["penalties"] || response["penalty"]) data = parse_out_hashes data Sportradar::Api::Football::StatPack::Penalties.new(data) end end |
#punt_returns ⇒ Object
63 64 65 66 67 68 |
# File 'lib/sportradar/api/football/game_stats.rb', line 63 def punt_returns @punt_returns ||= if (data = response["punt_returns"] || response["punt_return"]) data = parse_out_hashes data Sportradar::Api::Football::StatPack::PuntReturns.new(data) end end |
#punts ⇒ Object
56 57 58 59 60 61 |
# File 'lib/sportradar/api/football/game_stats.rb', line 56 def punts @punts ||= if (data = response["punts"] || response["punting"]) data = parse_out_hashes data Sportradar::Api::Football::StatPack::Punts.new(data) end end |
#receiving ⇒ Object
49 50 51 52 53 54 |
# File 'lib/sportradar/api/football/game_stats.rb', line 49 def receiving @receiving ||= if response["receiving"] response["receiving"] = parse_out_hashes response["receiving"] Sportradar::Api::Football::StatPack::Receiving.new(response["receiving"]) end end |
#rushing ⇒ Object
:skip_test_coverage: These are in methods rather than attributes to use them lazily. Each one is tested in it’s respective class
42 43 44 45 46 47 |
# File 'lib/sportradar/api/football/game_stats.rb', line 42 def rushing @rushing ||= if response["rushing"] response["rushing"] = parse_out_hashes response["rushing"] Sportradar::Api::Football::StatPack::Rushing.new(response["rushing"]) end end |