Class: NbaRb::Game::Boxscore

Inherits:
BaseClass show all
Defined in:
lib/nba_rb/game/boxscore.rb

Class Attribute Summary collapse

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) ⇒ Boxscore

Returns a new instance of Boxscore.



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/nba_rb/game/boxscore.rb', line 22

def initialize(*args)
  super(*args)

  @range_type ||= NbaRb::RangeType.default
  @start_period ||= NbaRb::Period.default
  @end_period ||= NbaRb::Period.default
  @start_range ||= NbaRb::StartRange.default
  @end_range ||= NbaRb::EndRange.default

  res = stats_request(endpoint, 'GameID' => game_id,
                                'RangeType' => range_type,
                                'StartPeriod' => start_period,
                                'EndPeriod' => end_period,
                                'StartRange' => start_range,
                                'EndRange' => end_range)

  @data = res['resultSets']
end

Class Attribute Details

.endpointObject (readonly)

Returns the value of attribute endpoint.



7
8
9
# File 'lib/nba_rb/game/boxscore.rb', line 7

def endpoint
  @endpoint
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



14
15
16
# File 'lib/nba_rb/game/boxscore.rb', line 14

def data
  @data
end

#end_periodObject

Returns the value of attribute end_period.



14
15
16
# File 'lib/nba_rb/game/boxscore.rb', line 14

def end_period
  @end_period
end

#end_rangeObject

Returns the value of attribute end_range.



14
15
16
# File 'lib/nba_rb/game/boxscore.rb', line 14

def end_range
  @end_range
end

#game_idObject

Returns the value of attribute game_id.



14
15
16
# File 'lib/nba_rb/game/boxscore.rb', line 14

def game_id
  @game_id
end

#range_typeObject

Returns the value of attribute range_type.



14
15
16
# File 'lib/nba_rb/game/boxscore.rb', line 14

def range_type
  @range_type
end

#start_periodObject

Returns the value of attribute start_period.



14
15
16
# File 'lib/nba_rb/game/boxscore.rb', line 14

def start_period
  @start_period
end

#start_rangeObject

Returns the value of attribute start_range.



14
15
16
# File 'lib/nba_rb/game/boxscore.rb', line 14

def start_range
  @start_range
end

Instance Method Details

#endpointObject



10
11
12
# File 'lib/nba_rb/game/boxscore.rb', line 10

def endpoint
  self.class.endpoint
end

#player_statsObject



41
42
43
# File 'lib/nba_rb/game/boxscore.rb', line 41

def player_stats
  create_stats_hash(@data[0])
end

#team_starter_bench_statsObject



49
50
51
# File 'lib/nba_rb/game/boxscore.rb', line 49

def team_starter_bench_stats
  create_stats_hash(@data[2])
end

#team_statsObject



45
46
47
# File 'lib/nba_rb/game/boxscore.rb', line 45

def team_stats
  create_stats_hash(@data[1])
end