Sha256: bd4c289e5df8737bbc0639137f966bfcf789165bc4946f4c644da5f03a9c30c0
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
module Sportradar module Api class Nfl::TeamDepthChart < Data include Enumerable attr_accessor :response, :season, :team_id, :abbrev # data.keys => ["offense", "defense", "special_teams", "name", "market", "alias", "id"] def initialize(data, season) @response = data @season = season @team_id = response['id'] @abbrev = response['alias'] end def offense @offense ||= Sportradar::Api::Nfl::DepthChart.new(response['offense']) end def defense @defense ||= Sportradar::Api::Nfl::DepthChart.new(response['defense']) end def special_teams @special_teams ||= Sportradar::Api::Nfl::DepthChart.new(response['special_teams']) end def team @team ||= Sportradar::Api::Nfl::Team.new(response).tap { |team| team.depth_chart = self } end def each [:offense, :defense, :special_teams].each { |type| yield type, send(type) } end private def set_charts [offense, defense, special_teams] end end end end
Version data entries
3 entries across 3 versions & 1 rubygems