Sha256: c5b2cd57dd307b43b021055589bf6fcb26ebc5394accb80ba82c2460fd35f2d3
Contents?: true
Size: 924 Bytes
Versions: 5
Compression:
Stored size: 924 Bytes
Contents
module Sportradar module Api module Football class StatPack < Data attr_accessor :response, :player, :name, :id, :position, :yards def initialize(data) @response = data set_stats @player = Sportradar::Api::Nfl::Player.new(response) if response['name'] # this isn't used yet, and we need to determine a better solution end def players @players ||= set_players end private def set_stats raise NotImplementedError, "Please implement `#{self.class}#set_stats`" end def set_players if response["player"] if response["player"].is_a? Hash @players = [ self.class.new(response["player"]) ] else @players = response["player"].map{ |hash| self.class.new(hash) } end end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems