Class: Sportradar::Nfl::PlaySummary

Inherits:
PlayByPlay show all
Defined in:
lib/sportradar/nfl/play_summary.rb

Instance Method Summary collapse

Methods inherited from GameRequest

#game_path

Methods inherited from WeeklySchedule

#week_path

Methods inherited from LeagueSchedule

#fetch, games

Methods inherited from ApiRequest

#client, #endpoint, fetch, #fetch, #league, save, #save

Constructor Details

#initialize(year: nil, interval_type: nil, week: 1, away_team_abbreviation: nil, home_team_abbreviation: nil, play_id: nil, details: nil) ⇒ PlaySummary

Returns a new instance of PlaySummary.

Raises:

  • (ArgumentError)


4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/sportradar/nfl/play_summary.rb', line 4

def initialize(year: nil,
               interval_type: nil,
               week: 1,
               away_team_abbreviation: nil,
               home_team_abbreviation: nil,
               play_id: nil,
               details: nil)
  super(year: year,
        interval_type: interval_type,
        week: week,
        away_team_abbreviation: away_team_abbreviation,
        home_team_abbreviation: home_team_abbreviation)
  @play_id = play_id
  @details = details

  raise ArgumentError.new('A play_id or details path is required.') unless play_id || details
end

Instance Method Details

#pathObject



22
23
24
25
26
27
28
# File 'lib/sportradar/nfl/play_summary.rb', line 22

def path
  if details
    details
  else
    "#{game_path}/plays/#{play_id}.json"
  end
end