Class: SportsDataApi::Ncaafb::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_data_api/ncaafb/game.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(year, season, week, game_hash) ⇒ Game

Returns a new instance of Game.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sports_data_api/ncaafb/game.rb', line 8

def initialize(year, season, week, game_hash)
  @year = year
  @season = season
  @week = week

  @id = game_hash['id']
  @scheduled = Time.parse game_hash['scheduled']
  @home = game_hash['home'] || game_hash['home_team']['id']
  @away = game_hash['away'] || game_hash['away_team']['id']
  @home_team_id = @home
  @away_team_id = @away
  @status = game_hash['status']
  @quarter = game_hash['quarter'].to_i
  @clock = game_hash['clock']

  @home_team = Team.new(game_hash['home_team'])
  @away_team = Team.new(game_hash['away_team'])
  @venue = Venue.new(game_hash['venue'])
  @broadcast = Broadcast.new(game_hash['broadcast'])
  @weather = Weather.new(game_hash['weather'])
end

Instance Attribute Details

#awayObject (readonly)

Returns the value of attribute away.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def away
  @away
end

#away_teamObject (readonly)

Returns the value of attribute away_team.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def away_team
  @away_team
end

#away_team_idObject (readonly)

Returns the value of attribute away_team_id.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def away_team_id
  @away_team_id
end

#broadcastObject (readonly)

Returns the value of attribute broadcast.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def broadcast
  @broadcast
end

#clockObject (readonly)

Returns the value of attribute clock.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def clock
  @clock
end

#homeObject (readonly)

Returns the value of attribute home.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def home
  @home
end

#home_teamObject (readonly)

Returns the value of attribute home_team.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def home_team
  @home_team
end

#home_team_idObject (readonly)

Returns the value of attribute home_team_id.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def home_team_id
  @home_team_id
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def id
  @id
end

#quarterObject (readonly)

Returns the value of attribute quarter.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def quarter
  @quarter
end

#scheduledObject (readonly)

Returns the value of attribute scheduled.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def scheduled
  @scheduled
end

#seasonObject (readonly)

Returns the value of attribute season.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def season
  @season
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def status
  @status
end

#venueObject (readonly)

Returns the value of attribute venue.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def venue
  @venue
end

#weatherObject (readonly)

Returns the value of attribute weather.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def weather
  @weather
end

#weekObject (readonly)

Returns the value of attribute week.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def week
  @week
end

#yearObject (readonly)

Returns the value of attribute year.



4
5
6
# File 'lib/sports_data_api/ncaafb/game.rb', line 4

def year
  @year
end

Instance Method Details

#boxscoreObject

Wrapper for Ncaafb.boxscore these helper methods are used to provide similar functionality as the links attribute found in the weekly schedule example.



54
55
56
# File 'lib/sports_data_api/ncaafb/game.rb', line 54

def boxscore
  Ncaafb.boxscore(year, season, week, home, away)
end

#depthchartObject

Wrapper for Ncaafb.depthchart TODO

Raises:

  • (NotImplementedError)


75
76
77
# File 'lib/sports_data_api/ncaafb/game.rb', line 75

def depthchart
  raise NotImplementedError
end

#injuriesObject

Wrapper for Ncaafb.injuries TODO

Raises:

  • (NotImplementedError)


68
69
70
# File 'lib/sports_data_api/ncaafb/game.rb', line 68

def injuries
  raise NotImplementedError
end

#pbpObject

Wrapper for Ncaafb.pbp (Ncaafb.play_by_play) TODO

Raises:

  • (NotImplementedError)


46
47
48
# File 'lib/sports_data_api/ncaafb/game.rb', line 46

def pbp
  raise NotImplementedError
end

#rosterObject

Wrapper for Ncaafb.game_roster TODO



61
62
63
# File 'lib/sports_data_api/ncaafb/game.rb', line 61

def roster
  Ncaafb.game_roster(year, season, week, home, away)
end

#statisticsObject

Wrapper for Ncaafb.statistics



32
33
34
# File 'lib/sports_data_api/ncaafb/game.rb', line 32

def statistics
  Ncaafb.game_statistics(year, season, week, home, away)
end

#summaryObject

Wrapper for Ncaafb.summary TODO

Raises:

  • (NotImplementedError)


39
40
41
# File 'lib/sports_data_api/ncaafb/game.rb', line 39

def summary
  raise NotImplementedError
end