Sha256: 1840fd01167cf74d2532f5831d80418a876c84e163e433d78d8b67bc6f29cd44
Contents?: true
Size: 882 Bytes
Versions: 12
Compression:
Stored size: 882 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 def for_player(id) @players && @players.detect { |stat| stat.player.id == id } end private def set_stats raise NotImplementedError, "Please implement `#{self.class}#set_stats`" end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems