Sha256: e3c7e28ac889b41833283889b69f256fccfe63155bd5b8aac8e479d47daecc8e

Contents?: true

Size: 752 Bytes

Versions: 105

Compression:

Stored size: 752 Bytes

Contents

module Sportradar
  module Api
    module Football
      class Nfl
        class Drive < Sportradar::Api::Football::Drive

          def handle_plays_and_events(data, **opts)
            things = (Array(data['events']) + Array(data['actions'])).group_by { |hash| hash['type'] }

            create_data(@plays_hash,  things['play'],  klass: Play,  api: api, drive: self) if things['play']
            create_data(@events_hash, things['event'], klass: Event, api: api, drive: self) if things['setup']
            create_data(@events_hash, things['event'], klass: Event, api: api, drive: self) if things['event']
          end

          def team_id
            plays.last&.start_situation&.team_id
          end

        end
      end
    end
  end
end

Version data entries

105 entries across 105 versions & 1 rubygems

Version Path
sportradar-api-0.20.2 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.20.1 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.20.0 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.20.0.pre2 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.20.0.pre lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.19.6 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.19.5 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.19.4 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.19.3 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.19.2 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.19.1 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.19.0 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.18.1 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.18.0 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.17.6 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.17.5 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.17.5.pre lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.17.4 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.17.3 lib/sportradar/api/football/nfl/drive.rb
sportradar-api-0.17.2 lib/sportradar/api/football/nfl/drive.rb