Sha256: 3be735c127808e6a51c6cd4a527eb79f877e61ab71928a74e4fb969b65363f19

Contents?: true

Size: 1.97 KB

Versions: 18

Compression:

Stored size: 1.97 KB

Contents

module SportsDataApi
  module Ncaafb
    class PlayByPlay
      attr_reader :id, :scheduled, :completed, :home, :home_team, :away,
        :away_team, :status, :year, :season, :week, :quarters

      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

      ##
      # Wrapper for Nfl.statistics
      def statistics
        Nfl.game_statistics(year, season, week, home, away, 1)
      end

      ##
      # Wrapper for Nfl.summary
      # TODO
      def summary
        raise NotImplementedError
      end

      ##
      # Wrapper for Nfl.pbp (Nfl.play_by_play)
      # TODO
      def pbp
        raise NotImplementedError
      end

      ##
      # Wrapper for Nfl.boxscore these helper methods are used
      # to provide similar functionality as the links attribute
      # found in the weekly schedule example.
      def boxscore
        Nfl.boxscore(year, season, week, home, away, 1)
      end

      ##
      # Wrapper for Nfl.roster
      # TODO
      def roster
        raise NotImplementedError
      end

      ##
      # Wrapper for Nfl.injuries
      # TODO
      def injuries
        raise NotImplementedError
      end

      ##
      # Wrapper for Nfl.depthchart
      # TODO
      def depthchart
        raise NotImplementedError
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
sports_data_api-0.15.3 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.15.2 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.15.1 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.15.0 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.14.1 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.14.0 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.13.0 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.12.1 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.12.0 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.11.6 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.11.5 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.11.3 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.11.2 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.11.1 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.11.0 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.10.1 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.10.0 lib/sports_data_api/ncaafb/play_by_play.rb
sports_data_api-0.9.2 lib/sports_data_api/ncaafb/play_by_play.rb