Class: Sportradar::Nfl::PlaySummaries
- Inherits:
-
PlayByPlay
- Object
- ApiRequest
- Feeds::LeagueSchedule
- LeagueSchedule
- WeeklySchedule
- GameRequest
- PlayByPlay
- Sportradar::Nfl::PlaySummaries
- Defined in:
- lib/sportradar/nfl/play_summaries.rb
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from PlayByPlay
Methods inherited from GameRequest
Methods inherited from WeeklySchedule
#initialize, #path, #week_path
Methods inherited from LeagueSchedule
Methods inherited from Feeds::LeagueSchedule
Methods inherited from ApiRequest
#client, #endpoint, fetch, #fetch, #league, #path, save, #save
Constructor Details
This class inherits a constructor from Sportradar::Nfl::GameRequest
Class Method Details
.perform(year: nil, interval_type: nil, week: 1, away_team_abbreviation:, home_team_abbreviation:) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/sportradar/nfl/play_summaries.rb', line 4 def self.perform(year: nil, interval_type: nil, week: 1, away_team_abbreviation:, home_team_abbreviation:) new(year: year, interval_type: interval_type, week: week, away_team_abbreviation: away_team_abbreviation, home_team_abbreviation: home_team_abbreviation).perform end |
Instance Method Details
#perform ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/sportradar/nfl/play_summaries.rb', line 16 def perform (quarters || []).each do |quarter| (quarter['pbp'] || []).each do |pbp| (pbp['actions'] || []).each do |action| next unless action['type'] == 'play' PlaySummary.new(week: @week, year: @year, interval_type: @interval_type, away_team_abbreviation: @away_team_abbreviation, home_team_abbreviation: @home_team_abbreviation, play_id: action['id']).save end end end nil end |