Sha256: cd7a03612e7532473d5792c2fd72567b6838f30af6c71501f0c8fbe138143583
Contents?: true
Size: 699 Bytes
Versions: 22
Compression:
Stored size: 699 Bytes
Contents
module SportsDataApi module Ncaamb class Season attr_reader :id, :year, :type, :games 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 ## # Check if the requested season is a valid # NCAAMB season type. # # The only valid types are: :reg, :pst, :ct def self.valid?(season) [:REG, :PST, :CT].include?(season) end end end end
Version data entries
22 entries across 22 versions & 1 rubygems