Class: Sportradar::Nfl::WeeklyPlayByPlay

Inherits:
WeeklySchedule show all
Defined in:
lib/sportradar/nfl/weekly_play_by_play.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from WeeklySchedule

#initialize, #path, #week_path

Methods inherited from LeagueSchedule

#fetch, games, #path

Methods inherited from Feeds::LeagueSchedule

#initialize, #path

Methods inherited from ApiRequest

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

Constructor Details

This class inherits a constructor from Sportradar::Nfl::WeeklySchedule

Class Method Details

.perform(year: nil, interval_type: nil, week: 1) ⇒ Object



4
5
6
# File 'lib/sportradar/nfl/weekly_play_by_play.rb', line 4

def self.perform(year: nil, interval_type: nil, week: 1)
  new(year: year, interval_type: interval_type, week: week).perform
end

Instance Method Details

#performObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/sportradar/nfl/weekly_play_by_play.rb', line 8

def perform
  games.each do |game|
    PlayByPlay.new(week: week,
                   year: year,
                   interval_type: interval_type,
                   away_team_abbreviation: game['away'],
                   home_team_abbreviation: game['home']).save
  end

  nil
end