Sha256: cc099e37ff6b73fbe311bd602965d7e0111d4d479d8fd1fea83f01cd08b4f68e

Contents?: true

Size: 772 Bytes

Versions: 116

Compression:

Stored size: 772 Bytes

Contents

module Sportradar
  module Api
    module Football
      class StatPack < Data
        attr_accessor :response, :player, :name, :id, :position, :yards, :players

        def initialize(data)
          if data['name']
            @response = data
            @player = Sportradar::Api::Football::Nfl::Player.new(data) # need to handle ncaa/nfl, although it may not matter
          else
            @response = data['team'] || data['totals'] || data['kicks']
            @players = parse_into_array(selector: data["players"], klass: self.class) if data["players"]
          end
          set_stats
        end

        private

        def set_stats
          raise NotImplementedError, "Please implement `#{self.class}#set_stats`"
        end

      end
    end
  end
end

Version data entries

116 entries across 116 versions & 1 rubygems

Version Path
sportradar-api-0.18.1 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.18.0 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.17.6 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.17.5 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.17.5.pre lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.17.4 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.17.3 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.17.2 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.17.1 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.17.0 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.17.0.pre lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.16.1 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.16.0 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.15.1 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.15.0 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.14.0 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.13.26 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.13.25 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.13.24 lib/sportradar/api/football/stat_pack.rb
sportradar-api-0.13.23 lib/sportradar/api/football/stat_pack.rb