Sha256: 2c898924d77dcbc5632518c4d5bcff05a63b791380730f7a688b3017a9782e21

Contents?: true

Size: 548 Bytes

Versions: 24

Compression:

Stored size: 548 Bytes

Contents

module Sportradar
  module Api
    class Nfl::Scoring < Data
      attr_accessor :response, :quarters

      def initialize(data)
        @response = data
        @quarters = data['quarter'].map { |quarter| Sportradar::Api::Nfl::Quarter.new quarter} if data['quarter']
      end

      def final
        "#{home}-#{away}"
      end

      def home
        quarters.map {|quarter| quarter['home_points'].to_i }.reduce(:+)
      end

      def away
        quarters.map {|quarter| quarter['away_points'].to_i }.reduce(:+)
      end
    end
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
sportradar-api-0.1.8 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.7 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.6 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.5 lib/sportradar/api/nfl/scoring.rb