Sha256: b20f04c8cb56c44a7076b4d128cedcbdb38dcfa630e0ef3503d95dcf03e75f74
Contents?: true
Size: 975 Bytes
Versions: 3
Compression:
Stored size: 975 Bytes
Contents
module Sportradar module Api class Nfl::LeagueDepthChart < Data include Enumerable attr_accessor :response, :season, :charts def initialize(data) @response = data depth_chart_data = data["season"].delete('depth_charts') @season = Sportradar::Api::Nfl::Season.new data["season"] if data["season"] # @teams = depth_chart_data["team"].map {|team| Sportradar::Api::Nfl::Team.new team } if depth_chart_data["team"] @charts = depth_chart_data["team"].map {|team| Sportradar::Api::Nfl::TeamDepthChart.new(team, season) } if depth_chart_data["team"] rescue => e puts e.message # binding.pry end # id is preferred search, but we allow for team abbreviation too def team(id = nil, abbrev: nil) @charts.detect { |chart| chart.team_id == id || chart.abbrev == abbrev } end def each self.charts.each { |chart| yield chart } end end end end
Version data entries
3 entries across 3 versions & 1 rubygems