Module: NBA::SynergyPlayTypes

Defined in:
lib/nba/synergy_play_types.rb

Overview

Provides methods to retrieve Synergy play type data

Constant Summary collapse

SYNERGY_PLAY_TYPE =

Result set name for play types

Returns:

  • (String)

    the result set name

"SynergyPlayType".freeze
REGULAR_SEASON =

Season type constant for regular season

Returns:

  • (String)

    the season type

"Regular Season".freeze
PLAYOFFS =

Season type constant for playoffs

Returns:

  • (String)

    the season type

"Playoffs".freeze
OFFENSIVE =

Type grouping for offensive

Returns:

  • (String)

    the type grouping

"offensive".freeze
DEFENSIVE =

Type grouping for defensive

Returns:

  • (String)

    the type grouping

"defensive".freeze
PER_GAME =

Per mode constant for per game stats

Returns:

  • (String)

    the per mode

"PerGame".freeze
TOTALS =

Per mode constant for totals

Returns:

  • (String)

    the per mode

"Totals".freeze
ISOLATION =

Play type constant for isolation plays

Returns:

  • (String)

    the play type

"Isolation".freeze
TRANSITION =

Play type constant for transition plays

Returns:

  • (String)

    the play type

"Transition".freeze
PICK_AND_ROLL_BALL_HANDLER =

Play type constant for pick and roll ball handler plays

Returns:

  • (String)

    the play type

"PRBallHandler".freeze
PICK_AND_ROLL_ROLL_MAN =

Play type constant for pick and roll roll man plays

Returns:

  • (String)

    the play type

"PRRollman".freeze
POST_UP =

Play type constant for post up plays

Returns:

  • (String)

    the play type

"Postup".freeze
SPOT_UP =

Play type constant for spot up plays

Returns:

  • (String)

    the play type

"Spotup".freeze
HANDOFF =

Play type constant for handoff plays

Returns:

  • (String)

    the play type

"Handoff".freeze
CUT =

Play type constant for cut plays

Returns:

  • (String)

    the play type

"Cut".freeze
OFF_SCREEN =

Play type constant for off screen plays

Returns:

  • (String)

    the play type

"OffScreen".freeze
PUTBACKS =

Play type constant for putback plays

Returns:

  • (String)

    the play type

"OffRebound".freeze
MISCELLANEOUS =

Play type constant for miscellaneous plays

Returns:

  • (String)

    the play type

"Misc".freeze

Class Method Summary collapse

Class Method Details

.player_stats(play_type:, type_grouping: OFFENSIVE, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT) ⇒ Collection

Retrieves synergy play type stats for players

Examples:

stats = NBA::SynergyPlayTypes.player_stats(play_type: "Isolation", type_grouping: "offensive")
stats.each { |s| puts "#{s.player_name}: #{s.ppp} PPP" }

Parameters:

  • play_type (String)

    the play type

  • type_grouping (String) (defaults to: OFFENSIVE)

    offensive or defensive

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of play type stats



86
87
88
89
90
91
# File 'lib/nba/synergy_play_types.rb', line 86

def self.player_stats(play_type:, type_grouping: OFFENSIVE, season: Utils.current_season,
  season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT)
  path = build_path("player", play_type, type_grouping, season, season_type: season_type, per_mode: per_mode)
  response = client.get(path)
  parse_response(response, play_type, type_grouping)
end

.team_stats(play_type:, type_grouping: OFFENSIVE, season: Utils.current_season, season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT) ⇒ Collection

Retrieves synergy play type stats for teams

Examples:

stats = NBA::SynergyPlayTypes.team_stats(play_type: "Transition", type_grouping: "offensive")
stats.each { |s| puts "#{s.team_abbreviation}: #{s.ppp} PPP" }

Parameters:

  • play_type (String)

    the play type

  • type_grouping (String) (defaults to: OFFENSIVE)

    offensive or defensive

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

    the season year

  • season_type (String) (defaults to: REGULAR_SEASON)

    the season type

  • per_mode (String) (defaults to: PER_GAME)

    the per mode

  • client (Client) (defaults to: CLIENT)

    the API client to use

Returns:

  • (Collection)

    a collection of play type stats



106
107
108
109
110
111
# File 'lib/nba/synergy_play_types.rb', line 106

def self.team_stats(play_type:, type_grouping: OFFENSIVE, season: Utils.current_season,
  season_type: REGULAR_SEASON, per_mode: PER_GAME, client: CLIENT)
  path = build_path("team", play_type, type_grouping, season, season_type: season_type, per_mode: per_mode)
  response = client.get(path)
  parse_response(response, play_type, type_grouping)
end