Class: SportsDataApi::Ncaamb::TournamentSchedule
- Inherits:
-
Object
- Object
- SportsDataApi::Ncaamb::TournamentSchedule
- Defined in:
- lib/sports_data_api/ncaamb/tournament_schedule.rb
Instance Attribute Summary collapse
-
#games ⇒ Object
readonly
Returns the value of attribute games.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#season ⇒ Object
readonly
Returns the value of attribute season.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Class Method Summary collapse
-
.valid?(season) ⇒ Boolean
Check if the requested tournament is a valid NCAAMB tournament type.
Instance Method Summary collapse
-
#initialize(year, season, xml) ⇒ TournamentSchedule
constructor
A new instance of TournamentSchedule.
Constructor Details
#initialize(year, season, xml) ⇒ TournamentSchedule
Returns a new instance of TournamentSchedule.
6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/sports_data_api/ncaamb/tournament_schedule.rb', line 6 def initialize(year, season, xml) if xml.is_a? Nokogiri::XML::NodeSet @id = xml.first["id"] @name = xml.first["name"] @year = year.to_i @season = season @games = xml.first.xpath("round").map { |round_xml| games_from_round(round_xml) }.flatten end end |
Instance Attribute Details
#games ⇒ Object (readonly)
Returns the value of attribute games.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament_schedule.rb', line 4 def games @games end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament_schedule.rb', line 4 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament_schedule.rb', line 4 def name @name end |
#season ⇒ Object (readonly)
Returns the value of attribute season.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament_schedule.rb', line 4 def season @season end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament_schedule.rb', line 4 def year @year end |
Class Method Details
.valid?(season) ⇒ Boolean
Check if the requested tournament is a valid NCAAMB tournament type.
The only valid types are: :reg, :pst, :ct
23 24 25 |
# File 'lib/sports_data_api/ncaamb/tournament_schedule.rb', line 23 def self.valid?(season) [:REG, :PST, :CT].include?(season) end |