Class: NbaRb::Team::Summary

Inherits:
BaseClass show all
Defined in:
lib/nba_rb/team/summary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from StatsRequest

#stats_request

Methods included from StatsHash

#create_stats_hash

Constructor Details

#initialize(*args) ⇒ Summary

Returns a new instance of Summary.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/nba_rb/team/summary.rb', line 10

def initialize(*args)
  super(*args)

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

  res = stats_request('teaminfocommon', 'TeamID' => team_id,
                                        'Season' => season,
                                        'LeagueID' => league_id,
                                        'SeasonType' => season_type)

  @data = res['resultSets']
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



4
5
6
# File 'lib/nba_rb/team/summary.rb', line 4

def data
  @data
end

#league_idObject

Returns the value of attribute league_id.



4
5
6
# File 'lib/nba_rb/team/summary.rb', line 4

def league_id
  @league_id
end

#seasonObject

Returns the value of attribute season.



4
5
6
# File 'lib/nba_rb/team/summary.rb', line 4

def season
  @season
end

#season_typeObject

Returns the value of attribute season_type.



4
5
6
# File 'lib/nba_rb/team/summary.rb', line 4

def season_type
  @season_type
end

#team_idObject

Returns the value of attribute team_id.



4
5
6
# File 'lib/nba_rb/team/summary.rb', line 4

def team_id
  @team_id
end

Instance Method Details

#infoObject



25
26
27
# File 'lib/nba_rb/team/summary.rb', line 25

def info
  create_stats_hash(@data[0])
end

#season_ranksObject



29
30
31
# File 'lib/nba_rb/team/summary.rb', line 29

def season_ranks
  create_stats_hash(@data[1])
end