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.30 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.29 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.28 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.27 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.26 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.25 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.24 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.23 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.22 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.21 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.19 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.18 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.17 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.16 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.15 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.14 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.13 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.12 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.11 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.10 lib/sportradar/api/nfl/scoring.rb