Class: NbaRb::Player::List

Inherits:
Object
  • Object
show all
Includes:
Initializable, StatsHash, StatsRequest
Defined in:
lib/nba_rb/player/list.rb,
lib/nba_rb/player/player_list.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) ⇒ List

Returns a new instance of List.



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

def initialize(*args)
  super(*args)

  @league_id ||= NbaRb::League.NBA
  @season ||= NbaRb::CURRENT_SEASON
  @only_current ||= 1

  res = stats_request('commonallplayers', 'LeagueID' => league_id,
                                          'Season' => season,
                                          'IsOnlyCurrentSeason' => only_current)

  @data = res['resultSets']
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



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

def data
  @data
end

#league_idObject

Returns the value of attribute league_id.



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

def league_id
  @league_id
end

#only_currentObject

Returns the value of attribute only_current.



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

def only_current
  @only_current
end

#seasonObject

Returns the value of attribute season.



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

def season
  @season
end

Instance Method Details

#infoObject



27
28
29
# File 'lib/nba_rb/player/list.rb', line 27

def info
  @data[0]
end