Class: NbaRb::Player::VsPlayer

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

Returns a new instance of VsPlayer.



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/nba_rb/player/player_vs_player.rb', line 35

def initialize(*args)
  super(*args)

  @team_id ||= 0
  @measure_type ||= NbaRb::MeasureType.default
  @per_mode ||= NbaRb::PerMode.default
  @plus_minus ||= NbaRb::PlusMinus.default
  @pace_adjust ||= NbaRb::PaceAdjust.default
  @rank ||= NbaRb::PaceAdjust.default
  @league_id ||= NbaRb::League.default
  @season ||= NbaRb::CURRENT_SEASON
  @season_type ||= NbaRb::SeasonType.default
  @po_round ||= NbaRb::PlayoffRound.default
  @outcome ||= NbaRb::Outcome.default
  @location ||= NbaRb::Location.default
  @month ||= NbaRb::Month.default
  @season_segment ||= NbaRb::SeasonSegment.default
  @date_from ||= NbaRb::DateFrom.default
  @date_to ||= NbaRb::DateTo.default
  @opponent_team_id ||= NbaRb::OpponentTeamID.default
  @vs_conference ||= NbaRb::VsConference.default
  @vs_division ||= NbaRb::VsDivision.default
  @game_segment ||= NbaRb::GameSegment.default
  @period ||= NbaRb::Period.default
  @shot_clock_range ||= NbaRb::ShotClockRange.default
  @last_n_games ||= NbaRb::LastNGames.default

  res = stats_request('playervsplayer', 'PlayerID' => player_id,
                                        'VsPlayerID' => vs_player_id,
                                        'TeamID' => team_id,
                                        'MeasureType' => measure_type,
                                        'PerMode' => per_mode,
                                        'PlusMinus' => plus_minus,
                                        'PaceAdjust' => pace_adjust,
                                        'Rank' => rank,
                                        'LeagueID' => league_id,
                                        'Season' => season,
                                        'SeasonType' => season_type,
                                        'PORound' => po_round,
                                        'Outcome' => outcome,
                                        'Location' => location,
                                        'Month' => month,
                                        'SeasonSegment' => season_segment,
                                        'DateFrom' => date_from,
                                        'DateTo' => date_to,
                                        'OpponentTeamID' => opponent_team_id,
                                        'VsConference' => vs_conference,
                                        'VsDivision' => vs_division,
                                        'GameSegment' => game_segment,
                                        'Period' => period,
                                        'ShotClockRange' => shot_clock_range,
                                        'LastNGames' => last_n_games)

  @data = res['resultSets']
end

Instance Attribute Details

#dataObject

Returns the value of attribute data.



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

def data
  @data
end

#date_fromObject

Returns the value of attribute date_from.



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

def date_from
  @date_from
end

#date_toObject

Returns the value of attribute date_to.



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

def date_to
  @date_to
end

#game_segmentObject

Returns the value of attribute game_segment.



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

def game_segment
  @game_segment
end

#last_n_gamesObject

Returns the value of attribute last_n_games.



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

def last_n_games
  @last_n_games
end

#league_idObject

Returns the value of attribute league_id.



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

def league_id
  @league_id
end

#locationObject

Returns the value of attribute location.



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

def location
  @location
end

#measure_typeObject

Returns the value of attribute measure_type.



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

def measure_type
  @measure_type
end

#monthObject

Returns the value of attribute month.



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

def month
  @month
end

#opponent_team_idObject

Returns the value of attribute opponent_team_id.



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

def opponent_team_id
  @opponent_team_id
end

#outcomeObject

Returns the value of attribute outcome.



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

def outcome
  @outcome
end

#pace_adjustObject

Returns the value of attribute pace_adjust.



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

def pace_adjust
  @pace_adjust
end

#per_modeObject

Returns the value of attribute per_mode.



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

def per_mode
  @per_mode
end

#periodObject

Returns the value of attribute period.



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

def period
  @period
end

#player_idObject

Returns the value of attribute player_id.



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

def player_id
  @player_id
end

#plus_minusObject

Returns the value of attribute plus_minus.



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

def plus_minus
  @plus_minus
end

#po_roundObject

Returns the value of attribute po_round.



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

def po_round
  @po_round
end

#rankObject

Returns the value of attribute rank.



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

def rank
  @rank
end

#seasonObject

Returns the value of attribute season.



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

def season
  @season
end

#season_segmentObject

Returns the value of attribute season_segment.



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

def season_segment
  @season_segment
end

#season_typeObject

Returns the value of attribute season_type.



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

def season_type
  @season_type
end

#shot_clock_rangeObject

Returns the value of attribute shot_clock_range.



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

def shot_clock_range
  @shot_clock_range
end

#team_idObject

Returns the value of attribute team_id.



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

def team_id
  @team_id
end

#vs_conferenceObject

Returns the value of attribute vs_conference.



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

def vs_conference
  @vs_conference
end

#vs_divisionObject

Returns the value of attribute vs_division.



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

def vs_division
  @vs_division
end

#vs_player_idObject

Returns the value of attribute vs_player_id.



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

def vs_player_id
  @vs_player_id
end

Instance Method Details

#on_off_courtObject



95
96
97
# File 'lib/nba_rb/player/player_vs_player.rb', line 95

def on_off_court
  create_stats_hash(@data[1])
end

#overallObject



91
92
93
# File 'lib/nba_rb/player/player_vs_player.rb', line 91

def overall
  create_stats_hash(@data[0])
end

#player_infoObject



123
124
125
# File 'lib/nba_rb/player/player_vs_player.rb', line 123

def player_info
  create_stats_hash(@data[8])
end

#shot_area_off_courtObject



119
120
121
# File 'lib/nba_rb/player/player_vs_player.rb', line 119

def shot_area_off_court
  create_stats_hash(@data[7])
end

#shot_area_on_courtObject



115
116
117
# File 'lib/nba_rb/player/player_vs_player.rb', line 115

def shot_area_on_court
  create_stats_hash(@data[6])
end

#shot_area_overallObject



111
112
113
# File 'lib/nba_rb/player/player_vs_player.rb', line 111

def shot_area_overall
  create_stats_hash(@data[5])
end

#shot_distance_off_courtObject



107
108
109
# File 'lib/nba_rb/player/player_vs_player.rb', line 107

def shot_distance_off_court
  create_stats_hash(@data[4])
end

#shot_distance_on_courtObject



103
104
105
# File 'lib/nba_rb/player/player_vs_player.rb', line 103

def shot_distance_on_court
  create_stats_hash(@data[3])
end

#shot_distance_overallObject



99
100
101
# File 'lib/nba_rb/player/player_vs_player.rb', line 99

def shot_distance_overall
  create_stats_hash(@data[2])
end

#vs_player_infoObject



127
128
129
# File 'lib/nba_rb/player/player_vs_player.rb', line 127

def vs_player_info
  create_stats_hash(@data[9])
end