Module: NBA::CumeStatsTeam::TotalAttributes Private

Defined in:
lib/nba/cume_stats_team.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Extracts total attributes from data

Class Method Summary collapse

Class Method Details

.extract(data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extracts all total attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    extracted attributes



274
275
276
# File 'lib/nba/cume_stats_team.rb', line 274

def self.extract(data)
  identity(data).merge(record(data)).merge(stats(data))
end

.games(data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extracts game attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    game attributes



298
299
300
# File 'lib/nba/cume_stats_team.rb', line 298

def self.games(data)
  {gp: data["GP"], gs: data["GS"]}
end

.identity(data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extracts identity attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    identity attributes



282
283
284
# File 'lib/nba/cume_stats_team.rb', line 282

def self.identity(data)
  {team_id: data["TEAM_ID"], city: data["CITY"], nickname: data["NICKNAME"]}
end

.other(data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extracts other stat attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    other stat attributes



342
343
344
345
346
# File 'lib/nba/cume_stats_team.rb', line 342

def self.other(data)
  {oreb: data["OREB"], dreb: data["DREB"], tot_reb: data["TOT_REB"],
   ast: data["AST"], pf: data["PF"], stl: data["STL"],
   tov: data["TOV"], blk: data["BLK"], pts: data["PTS"]}
end

.other_record(data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extracts other record attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    other record attributes



316
317
318
# File 'lib/nba/cume_stats_team.rb', line 316

def self.other_record(data)
  {team_turnovers: data["TEAM_TURNOVERS"], team_rebounds: data["TEAM_REBOUNDS"]}
end

.record(data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extracts record attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    record attributes



290
291
292
# File 'lib/nba/cume_stats_team.rb', line 290

def self.record(data)
  games(data).merge(wins_losses(data)).merge(other_record(data))
end

.shooting(data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extracts shooting attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    shooting attributes



332
333
334
335
336
# File 'lib/nba/cume_stats_team.rb', line 332

def self.shooting(data)
  {fgm: data["FGM"], fga: data["FGA"], fg_pct: data["FG_PCT"],
   fg3m: data["FG3M"], fg3a: data["FG3A"], fg3_pct: data["FG3_PCT"],
   ftm: data["FTM"], fta: data["FTA"], ft_pct: data["FT_PCT"]}
end

.stats(data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extracts stat attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    stat attributes



324
325
326
# File 'lib/nba/cume_stats_team.rb', line 324

def self.stats(data)
  shooting(data).merge(other(data))
end

.wins_losses(data) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Extracts win and loss attributes from data

Parameters:

  • data (Hash)

    the row data

Returns:

  • (Hash)

    win and loss attributes



306
307
308
309
310
# File 'lib/nba/cume_stats_team.rb', line 306

def self.wins_losses(data)
  {w: data["W"], l: data["L"],
   w_home: data["W_HOME"], l_home: data["L_HOME"],
   w_road: data["W_ROAD"], l_road: data["L_ROAD"]}
end