Class: NbaRb::Player::GameLogs

Inherits:
Object
  • Object
show all
Includes:
Initializable, StatsHash, StatsRequest
Defined in:
lib/nba_rb/player/game_logs.rb,
lib/nba_rb/player/player_game_logs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StatsHash

#create_stats_hash

Methods included from StatsRequest

#stats_request

Constructor Details

#initialize(*args) ⇒ GameLogs

Returns a new instance of GameLogs.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/nba_rb/player/game_logs.rb', line 14

def initialize(*args)
  super(*args)

  @league_id ||= NbaRb::League.NBA
  @season ||= NbaRb::CURRENT_SEASON
  @season_type ||= NbaRb::SeasonType.regular

  res = stats_request('playergamelog', 'PlayerID' => player_id,
                                       'LeagueID' => league_id,
                                       'Season' => season,
                                       'SeasonType' => season_type)

  @data = res['resultSets']
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



8
9
10
# File 'lib/nba_rb/player/game_logs.rb', line 8

def data
  @data
end

#league_idObject

Returns the value of attribute league_id.



8
9
10
# File 'lib/nba_rb/player/game_logs.rb', line 8

def league_id
  @league_id
end

#player_idObject

Returns the value of attribute player_id.



8
9
10
# File 'lib/nba_rb/player/game_logs.rb', line 8

def player_id
  @player_id
end

#seasonObject

Returns the value of attribute season.



8
9
10
# File 'lib/nba_rb/player/game_logs.rb', line 8

def season
  @season
end

#season_typeObject

Returns the value of attribute season_type.



8
9
10
# File 'lib/nba_rb/player/game_logs.rb', line 8

def season_type
  @season_type
end

Instance Method Details

#infoObject



29
30
31
# File 'lib/nba_rb/player/game_logs.rb', line 29

def info
  create_stats_hash(@data[0])
end