Module: NBA::PlayerAwards

Defined in:
lib/nba/player_awards.rb

Overview

Provides methods to retrieve player awards

API:

  • public

Constant Summary collapse

PLAYER_AWARDS =

Result set name for player awards

Returns:

  • the result set name

API:

  • public

"PlayerAwards".freeze

Class Method Summary collapse

Class Method Details

.find(player:, client: CLIENT) ⇒ Collection

Retrieves all awards for a player

Examples:

awards = NBA::PlayerAwards.find(player: 201939)
awards.each { |a| puts "#{a.season}: #{a.description}" }

Parameters:

  • the player ID or Player object

  • (defaults to: CLIENT)

    the API client to use

Returns:

  • a collection of awards

API:

  • public



23
24
25
26
27
28
# File 'lib/nba/player_awards.rb', line 23

def self.find(player:, client: CLIENT)
  player_id = extract_player_id(player)
  path = "playerawards?PlayerID=#{player_id}"
  response = client.get(path)
  parse_response(response, player_id)
end