Class: SportsDataApi::Nfl::PlayByPlay
- Inherits:
-
Object
- Object
- SportsDataApi::Nfl::PlayByPlay
- Defined in:
- lib/sports_data_api/nfl/play_by_play.rb
Instance Attribute Summary collapse
-
#away ⇒ Object
readonly
Returns the value of attribute away.
-
#away_team ⇒ Object
readonly
Returns the value of attribute away_team.
-
#completed ⇒ Object
readonly
Returns the value of attribute completed.
-
#home ⇒ Object
readonly
Returns the value of attribute home.
-
#home_team ⇒ Object
readonly
Returns the value of attribute home_team.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#quarters ⇒ Object
readonly
Returns the value of attribute quarters.
-
#scheduled ⇒ Object
readonly
Returns the value of attribute scheduled.
-
#season ⇒ Object
readonly
Returns the value of attribute season.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#week ⇒ Object
readonly
Returns the value of attribute week.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#boxscore ⇒ Object
Wrapper for Nfl.boxscore these helper methods are used to provide similar functionality as the links attribute found in the weekly schedule example.
-
#depthchart ⇒ Object
Wrapper for Nfl.depthchart TODO.
-
#initialize(year, season, week, play_by_play_hash) ⇒ PlayByPlay
constructor
A new instance of PlayByPlay.
-
#injuries ⇒ Object
Wrapper for Nfl.injuries TODO.
-
#pbp ⇒ Object
Wrapper for Nfl.pbp (Nfl.play_by_play) TODO.
-
#roster ⇒ Object
Wrapper for Nfl.roster TODO.
-
#statistics ⇒ Object
Wrapper for Nfl.statistics.
-
#summary ⇒ Object
Wrapper for Nfl.summary TODO.
Constructor Details
#initialize(year, season, week, play_by_play_hash) ⇒ PlayByPlay
Returns a new instance of PlayByPlay.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 7 def initialize(year, season, week, play_by_play_hash) @year = year @season = season @week = week @id = play_by_play_hash['id'] @scheduled = Time.parse play_by_play_hash['scheduled'] @completed = play_by_play_hash['completed'] || Time.parse(play_by_play_hash['scheduled']) @home = play_by_play_hash['home'] || play_by_play_hash['home_team']['id'] @away = play_by_play_hash['away'] || play_by_play_hash['away_team']['id'] @status = play_by_play_hash['status'] @home_team = Team.new(play_by_play_hash['home_team']) @away_team = Team.new(play_by_play_hash['away_team']) @away_team = Team.new(play_by_play_hash['away_team']) @quarters = Quarters.new(play_by_play_hash["quarters"]) end |
Instance Attribute Details
#away ⇒ Object (readonly)
Returns the value of attribute away.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def away @away end |
#away_team ⇒ Object (readonly)
Returns the value of attribute away_team.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def away_team @away_team end |
#completed ⇒ Object (readonly)
Returns the value of attribute completed.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def completed @completed end |
#home ⇒ Object (readonly)
Returns the value of attribute home.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def home @home end |
#home_team ⇒ Object (readonly)
Returns the value of attribute home_team.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def home_team @home_team end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def id @id end |
#quarters ⇒ Object (readonly)
Returns the value of attribute quarters.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def quarters @quarters end |
#scheduled ⇒ Object (readonly)
Returns the value of attribute scheduled.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def scheduled @scheduled end |
#season ⇒ Object (readonly)
Returns the value of attribute season.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def season @season end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def status @status end |
#week ⇒ Object (readonly)
Returns the value of attribute week.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def week @week end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
4 5 6 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 4 def year @year end |
Instance Method Details
#boxscore ⇒ Object
Wrapper for Nfl.boxscore these helper methods are used to provide similar functionality as the links attribute found in the weekly schedule example.
51 52 53 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 51 def boxscore Nfl.boxscore(year, season, week, home, away, 1) end |
#depthchart ⇒ Object
Wrapper for Nfl.depthchart TODO
72 73 74 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 72 def depthchart raise NotImplementedError end |
#injuries ⇒ Object
Wrapper for Nfl.injuries TODO
65 66 67 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 65 def injuries raise NotImplementedError end |
#pbp ⇒ Object
Wrapper for Nfl.pbp (Nfl.play_by_play) TODO
43 44 45 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 43 def pbp raise NotImplementedError end |
#roster ⇒ Object
Wrapper for Nfl.roster TODO
58 59 60 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 58 def roster raise NotImplementedError end |
#statistics ⇒ Object
Wrapper for Nfl.statistics
29 30 31 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 29 def statistics Nfl.game_statistics(year, season, week, home, away, 1) end |
#summary ⇒ Object
Wrapper for Nfl.summary TODO
36 37 38 |
# File 'lib/sports_data_api/nfl/play_by_play.rb', line 36 def summary raise NotImplementedError end |