Sha256: 206f9946e3345229a9c3b0a1b4e973cc867a71087dcfd6c4489869ee9f58db0f
Contents?: true
Size: 1.22 KB
Versions: 112
Compression:
Stored size: 1.22 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']) if response['offense'] end def defense @defense ||= Sportradar::Api::Nfl::DepthChart.new(response['defense']) if response['defense'] end def special_teams @special_teams ||= Sportradar::Api::Nfl::DepthChart.new(response['special_teams']) if 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 # These aren't ever used, but handy if you need to invoke for testing # private # def set_charts # [offense, defense, special_teams] # end end end end
Version data entries
112 entries across 112 versions & 1 rubygems