Module: Fantasydata::API::PlayerStat

Includes:
Utils
Included in:
Client
Defined in:
lib/fantasydata/api/player_stat.rb

Constant Summary

Constants included from Utils

Utils::API_KEY_CANNOT_CALL_THIS_METHOD, Utils::INVALID_PARAMETER, Utils::MISSING_OR_INVALID_KEY, Utils::MISSING_PARAMETER, Utils::RATE_LIMIT_EXCEEDED, Utils::SUCCESS

Instance Method Summary collapse

Instance Method Details

#player_game_stat_by_player(year, week, player_id) ⇒ Object



8
9
10
# File 'lib/fantasydata/api/player_stat.rb', line 8

def player_game_stat_by_player year, week, player_id
  object_from_response(Fantasydata::PlayerGameStat, :get, "/nfl/v2/JSON/PlayerGameStatsByPlayerID/#{year}/#{week}/#{player_id}")
end

#player_game_stat_by_player_projection(year, week, player_id) ⇒ Object



12
13
14
# File 'lib/fantasydata/api/player_stat.rb', line 12

def player_game_stat_by_player_projection year, week, player_id
  object_from_response(Fantasydata::PlayerGameStat, :get, "/nfl/v2/JSON/PlayerGameProjectionStatsByPlayerID/#{year}/#{week}/#{player_id}")
end

#player_game_stats_by_delta(minutes) ⇒ Object



28
29
30
# File 'lib/fantasydata/api/player_stat.rb', line 28

def player_game_stats_by_delta minutes
  objects_from_response(Fantasydata::PlayerGameStat, :get, "/nfl/v2/JSON/PlayerGameStatsDelta/#{minutes}")
end

#player_game_stats_by_week(year, week) ⇒ Object



24
25
26
# File 'lib/fantasydata/api/player_stat.rb', line 24

def player_game_stats_by_week year, week
  objects_from_response(Fantasydata::PlayerGameStat, :get, "/nfl/v2/JSON/PlayerGameStatsByWeek/#{year}/#{week}")
end

#player_game_stats_by_week_and_team(year, week, team_name) ⇒ Object



16
17
18
# File 'lib/fantasydata/api/player_stat.rb', line 16

def player_game_stats_by_week_and_team year, week, team_name
  objects_from_response(Fantasydata::PlayerGameStat, :get, "/nfl/v2/JSON/PlayerGameStatsByTeam/#{year}/#{week}/#{team_name}")
end

#player_game_stats_by_week_and_team_projection(year, week, team_name) ⇒ Object



20
21
22
# File 'lib/fantasydata/api/player_stat.rb', line 20

def player_game_stats_by_week_and_team_projection year, week, team_name
  objects_from_response(Fantasydata::PlayerGameStat, :get, "/nfl/v2/JSON/PlayerGameProjectionStatsByTeam/#{year}/#{week}/#{team_name}")
end

#player_season_stat_by_player_id(year, player_id) ⇒ Object



36
37
38
39
40
41
# File 'lib/fantasydata/api/player_stat.rb', line 36

def player_season_stat_by_player_id year, player_id
  # This endpoint returns an array - but there will always only be one.
  # API will just return the first one to have the object and not an array
  items = objects_from_response(Fantasydata::PlayerSeasonStat, :get, "/nfl/v2/JSON/PlayerSeasonStatsByPlayerID/#{year}/#{player_id}")
  items.first
end

#player_season_stat_by_player_id_projection(year, player_id) ⇒ Object



43
44
45
# File 'lib/fantasydata/api/player_stat.rb', line 43

def player_season_stat_by_player_id_projection year, player_id
  object_from_response(Fantasydata::PlayerSeasonStat, :get, "/nfl/v2/JSON/PlayerSeasonProjectionStatsByPlayerID/#{year}/#{player_id}")
end

#player_season_stat_by_team(year, team) ⇒ Object



47
48
49
# File 'lib/fantasydata/api/player_stat.rb', line 47

def player_season_stat_by_team year, team
  objects_from_response(Fantasydata::PlayerSeasonStat, :get, "/nfl/v2/JSON/PlayerSeasonStatsByTeam/#{year}/#{team}")
end

#player_season_stat_by_team_projection(year, team) ⇒ Object



51
52
53
# File 'lib/fantasydata/api/player_stat.rb', line 51

def player_season_stat_by_team_projection year, team
  objects_from_response(Fantasydata::PlayerSeasonStat, :get, "/nfl/v2/JSON/PlayerSeasonProjectionStatsByTeam/#{year}/#{team}")
end

#player_season_stats_by_year_projection(year) ⇒ Object



32
33
34
# File 'lib/fantasydata/api/player_stat.rb', line 32

def player_season_stats_by_year_projection year
  objects_from_response(Fantasydata::PlayerSeasonStat, :get, "/nfl/v2/JSON/PlayerSeasonProjectionStats/#{year}")
end