Module: NBA::PlayerFantasyProfileBarGraph

Defined in:
lib/nba/player_fantasy_profile_bar_graph.rb

Overview

Provides methods to retrieve player fantasy profile bar graph statistics

Constant Summary collapse

LAST_FIVE_GAMES_AVG =

Result set name for last five games average

Returns:

  • (String)

    the result set name

"LastFiveGamesAvg".freeze
SEASON_AVG =

Result set name for season average

Returns:

  • (String)

    the result set name

"SeasonAvg".freeze

Class Method Summary collapse

Class Method Details

.last_five_games_avg(player:, season: Utils.current_season, season_type: "Regular Season", client: CLIENT) ⇒ Collection

Retrieves last five games average statistics for a player

Examples:

stats = NBA::PlayerFantasyProfileBarGraph.last_five_games_avg(player: 201939)
stats.first.fan_duel_pts #=> 45.2

Parameters:

  • player (Integer, Player)

    the player ID or Player object

  • season (Integer) (defaults to: Utils.current_season)

    the season year

  • season_type (String) (defaults to: "Regular Season")

    the season type

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of fantasy profile statistics



31
32
33
34
35
36
# File 'lib/nba/player_fantasy_profile_bar_graph.rb', line 31

def self.last_five_games_avg(player:, season: Utils.current_season, season_type: "Regular Season",
  client: CLIENT)
  path = build_path(player, season, season_type)
  response = client.get(path)
  parse_response(response, LAST_FIVE_GAMES_AVG)
end

.season_avg(player:, season: Utils.current_season, season_type: "Regular Season", client: CLIENT) ⇒ Collection

Retrieves season average statistics for a player

Examples:

stats = NBA::PlayerFantasyProfileBarGraph.season_avg(player: 201939)
stats.first.nba_fantasy_pts #=> 52.1

Parameters:

  • player (Integer, Player)

    the player ID or Player object

  • season (Integer) (defaults to: Utils.current_season)

    the season year

  • season_type (String) (defaults to: "Regular Season")

    the season type

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of fantasy profile statistics



49
50
51
52
53
54
# File 'lib/nba/player_fantasy_profile_bar_graph.rb', line 49

def self.season_avg(player:, season: Utils.current_season, season_type: "Regular Season",
  client: CLIENT)
  path = build_path(player, season, season_type)
  response = client.get(path)
  parse_response(response, SEASON_AVG)
end