class SportsDataApi::Ncaamb::Season

Attributes

games[R]
id[R]
type[R]
year[R]

Public Class Methods

new(xml) click to toggle source
# File lib/sports_data_api/ncaamb/season.rb, line 6
def initialize(xml)
  if xml.is_a? Nokogiri::XML::NodeSet
    @id = xml.first["id"]
    @year = xml.first["year"].to_i
    @type = xml.first["type"].to_sym

    @games = xml.first.xpath("games/game").map do |game_xml|
      Game.new(year: @year, season: @type, xml: game_xml)
    end
  end
end
valid?(season) click to toggle source

Check if the requested season is a valid NCAAMB season type.

The only valid types are: :reg, :pst, :ct

# File lib/sports_data_api/ncaamb/season.rb, line 23
def self.valid?(season)
  [:REG, :PST, :CT].include?(season)
end