Module: NbaStats::PlayerProfile

Included in:
Client
Defined in:
lib/nba_stats/stats/player_profile.rb

Constant Summary collapse

PLAYER_PROFILE_PATH =

The path of the playerprofile API

'/stats/playerprofile'

Instance Method Summary collapse

Instance Method Details

#player_profile(player_id, season, graph_start_season, graph_end_season, graph_stat = NbaStats::Constants::GRAPH_STAT_POINTS, season_type = NbaStats::Constants::SEASON_TYPE_REGULAR, league_id = NbaStats::Constants::LEAGUE_ID_NBA) ⇒ NbaStats::Resources::PlayerProfile

Calls the playerprofile API and returns a PlayerProfile resource.

Parameters:

  • player_id (Integer)
  • season (String)
  • graph_start_season (String)
  • graph_end_season (String)
  • graph_stat (String) (defaults to: NbaStats::Constants::GRAPH_STAT_POINTS)
  • season_type (String) (defaults to: NbaStats::Constants::SEASON_TYPE_REGULAR)
  • league_id (String) (defaults to: NbaStats::Constants::LEAGUE_ID_NBA)

Returns:



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/nba_stats/stats/player_profile.rb', line 21

def player_profile(
    player_id,
    season,
    graph_start_season,
    graph_end_season,
    graph_stat=NbaStats::Constants::GRAPH_STAT_POINTS,
    season_type=NbaStats::Constants::SEASON_TYPE_REGULAR,
    league_id=NbaStats::Constants::LEAGUE_ID_NBA
)
  NbaStats::Resources::PlayerProfile.new(
      get(PLAYER_PROFILE_PATH, {
          :Season => season,
          :SeasonType => season_type,
          :LeagueID => league_id,
          :PlayerID => player_id,
          :GraphStartSeason => graph_start_season,
          :GraphEndSeason => graph_end_season,
          :GraphStat => graph_stat
      })
  )
end