Class: Sportradar::Api::Football::Nfl::Game

Inherits:
Game
  • Object
show all
Defined in:
lib/sportradar/api/football/nfl/game.rb

Instance Attribute Summary

Attributes inherited from Game

#attendance, #away_id, #broadcast, #changes, #clock, #coverage, #duration, #home_id, #id, #lineup, #player_stats, #quarter, #response, #scheduled, #score, #status, #team_stats, #title, #type, #venue, #week, #week_number, #year

Instance Method Summary collapse

Methods inherited from Game

#assign_away, #assign_home, #away, #away_alias, #box, #cancelled?, #changed?, #check_newness, #clock_display, #closed?, #completed?, #current_possession_team_id, #delayed?, #drives, #drives_with_events, #events, #finished?, #future?, #generate_title, #get_box, #get_pbp, #get_statistics, #half_quarters, #halftime?, #home, #home_alias, #ingest_box, #ingest_pbp, #ingest_statistics, #initialize, #leading_team, #leading_team_id, #next_possession_team_id, #not_updated?, #parse_score, #path_box, #path_extended_box, #path_pbp, #path_roster, #path_statistics, #path_summary, #pbp, #period, #plays, #postponed?, #quarter_display, #quarters, #queue_pbp, #queue_statistics, #realtime_state, #remember, #scoring, #sim!, #started?, #stats, #summary_stat, #team, #team_ids, #tied?, #timeouts, #unnecessary?, #update, #update_drives, #update_player_stats, #update_score, #update_stats

Methods inherited from Data

#all_attributes, #attributes, #create_data, #parse_into_array, #parse_into_array_with_options, #parse_out_hashes, #structure_links, #update_data

Constructor Details

This class inherits a constructor from Sportradar::Api::Football::Game

Instance Method Details

#apiObject



44
45
46
# File 'lib/sportradar/api/football/nfl/game.rb', line 44

def api
  @api ||= Sportradar::Api::Football::Nfl::Api.new
end

#drive_classObject



40
41
42
# File 'lib/sportradar/api/football/nfl/game.rb', line 40

def drive_class
  Sportradar::Api::Football::Nfl::Drive
end

#path_baseObject



21
22
23
# File 'lib/sportradar/api/football/nfl/game.rb', line 21

def path_base
  "games/#{ id }"
end

#period_classObject



28
29
30
# File 'lib/sportradar/api/football/nfl/game.rb', line 28

def period_class
  Quarter
end

#period_keyObject



32
33
34
# File 'lib/sportradar/api/football/nfl/game.rb', line 32

def period_key
  'periods'
end

#quarter_classObject



36
37
38
# File 'lib/sportradar/api/football/nfl/game.rb', line 36

def quarter_class
  Sportradar::Api::Football::Nfl::Quarter
end

#team_classObject



25
26
27
# File 'lib/sportradar/api/football/nfl/game.rb', line 25

def team_class
  Team
end

#update_teams(data) ⇒ Object



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

def update_teams(data)
  if data['summary']
    @home.update(data.dig('summary', 'home'), game: self)
    @away.update(data.dig('summary', 'away'), game: self)
  else
    @home.update(data['home'], api: api, game: self) if data['home'].is_a?(Hash)
    @away.update(data['away'], api: api, game: self) if data['away'].is_a?(Hash)
    @home_alias    = data['home'] if data['home'].is_a?(String) # this might actually be team ID and not alias. check in NFL
    @away_alias    = data['away'] if data['away'].is_a?(String) # this might actually be team ID and not alias. check in NFL
  end
end