Class: SportsDataApi::Nfl::PlayerSeasonStats

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_data_api/nfl/player_season_stats.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#idObject (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

#playersObject (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

#statsObject (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