Sha256: 9cb7926db091d14290dd7281d688d4503d5cfc4c35f619df18a692a2a088b19b

Contents?: true

Size: 632 Bytes

Versions: 8

Compression:

Stored size: 632 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']
        # this is causing a problem in some scenarios, receiving ['1', 'id-hash']
      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

8 entries across 8 versions & 1 rubygems

Version Path
sportradar-api-0.1.38 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.37 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.36 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.35 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.34 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.33 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.32 lib/sportradar/api/nfl/scoring.rb
sportradar-api-0.1.31 lib/sportradar/api/nfl/scoring.rb