Sha256: 942456d2e1b4c461b4a7312cf1bf1a43d1d438d33cdc9b5c48598afd840d7152
Contents?: true
Size: 743 Bytes
Versions: 22
Compression:
Stored size: 743 Bytes
Contents
module SportsDataApi module Ncaamb class TournamentList attr_reader :id, :year, :season, :tournaments def initialize(xml) if xml.is_a? Nokogiri::XML::NodeSet @id = xml.first["id"] @year = xml.first["year"].to_i @season = xml.first["type"].to_sym @tournaments = xml.first.xpath("tournament").map do |tournament_xml| Tournament.new(year: @year, season: @season, xml: tournament_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