Module: NBA::BoxScoreSimilarityScore

Defined in:
lib/nba/box_score_similarity_score.rb

Overview

Provides methods to retrieve G League Alum box score similarity scores

Constant Summary collapse

RESULT_SET_NAME =

Result set name for similarity scores

Returns:

  • (String)

    the result set name

"GLeagueAlumBoxScoreSimilarityScores".freeze
REGULAR_SEASON =

Regular season type constant

Returns:

  • (String)

    the season type

"Regular Season".freeze
PLAYOFFS =

Playoffs season type constant

Returns:

  • (String)

    the season type

"Playoffs".freeze

Class Method Summary collapse

Class Method Details

.find(first_person:, second_person:, first_season: Utils.current_season, second_season: Utils.current_season, first_season_type: REGULAR_SEASON, second_season_type: REGULAR_SEASON, client: CLIENT) ⇒ Collection

Retrieves box score similarity scores for two players

Examples:

stats = NBA::BoxScoreSimilarityScore.find(first_person: 201939, second_person: 203507)
stats.first.similarity_score #=> 0.85

Parameters:

  • first_person (Integer, Player)

    the first player ID or Player object

  • second_person (Integer, Player)

    the second player ID or Player object

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

    the season year for first player

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

    the season year for second player

  • first_season_type (String) (defaults to: REGULAR_SEASON)

    the season type for first player

  • second_season_type (String) (defaults to: REGULAR_SEASON)

    the season type for second player

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of similarity stats



37
38
39
40
41
42
43
44
45
# File 'lib/nba/box_score_similarity_score.rb', line 37

def self.find(first_person:, second_person:, first_season: Utils.current_season, second_season: Utils.current_season,
  first_season_type: REGULAR_SEASON, second_season_type: REGULAR_SEASON, client: CLIENT)
  first_id = Utils.extract_id(first_person)
  second_id = Utils.extract_id(second_person)
  path = build_path(first_id: first_id, second_id: second_id, first_season: first_season, second_season: second_season,
    first_season_type: first_season_type, second_season_type: second_season_type)
  response = client.get(path)
  parse_response(response, first_id)
end