Class: SportsDataApi::Nfl::PlayerSeasonStats
- Inherits:
-
Object
- Object
- SportsDataApi::Nfl::PlayerSeasonStats
- Defined in:
- lib/sports_data_api/nfl/player_season_stats.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#players ⇒ Object
readonly
Returns the value of attribute players.
-
#stats ⇒ Object
readonly
Returns the value of attribute stats.
Instance Method Summary collapse
-
#initialize(json) ⇒ PlayerSeasonStats
constructor
A new instance of PlayerSeasonStats.
Constructor Details
#initialize(json) ⇒ PlayerSeasonStats
Returns a new instance of PlayerSeasonStats.
5 6 7 8 9 10 11 12 13 |
# File 'lib/sports_data_api/nfl/player_season_stats.rb', line 5 def initialize(json) @players = [] json['players'].each do | p | player = {} player[:id] = p['id'] player[:stats] = p['statistics'] @players << player end end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/sports_data_api/nfl/player_season_stats.rb', line 4 def id @id end |
#players ⇒ Object (readonly)
Returns the value of attribute players.
4 5 6 |
# File 'lib/sports_data_api/nfl/player_season_stats.rb', line 4 def players @players end |
#stats ⇒ Object (readonly)
Returns the value of attribute stats.
4 5 6 |
# File 'lib/sports_data_api/nfl/player_season_stats.rb', line 4 def stats @stats end |