Class: SportsDataApi::Ncaamb::Tournament
- Inherits:
-
Object
- Object
- SportsDataApi::Ncaamb::Tournament
- Defined in:
- lib/sports_data_api/ncaamb/tournament.rb
Instance Attribute Summary collapse
-
#end_date ⇒ Object
readonly
Returns the value of attribute end_date.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#season ⇒ Object
readonly
Returns the value of attribute season.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#year ⇒ Object
readonly
Returns the value of attribute year.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Tournament
constructor
A new instance of Tournament.
- #schedule ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Tournament
Returns a new instance of Tournament.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 7 def initialize(args={}) xml = args.fetch(:xml) @year = args[:year] ? args[:year].to_i : nil @season = args[:season] ? args[:season].to_sym : nil xml = xml.first if xml.is_a? Nokogiri::XML::NodeSet if xml.is_a? Nokogiri::XML::Element @id = xml['id'] @start_date = Time.parse xml['start_date'] @end_date = Time.parse xml['end_date'] @status = xml['status'] @name = xml['name'] @location = xml['location'] @status = xml['status'] end end |
Instance Attribute Details
#end_date ⇒ Object (readonly)
Returns the value of attribute end_date.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 4 def end_date @end_date end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 4 def id @id end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 4 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament.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.rb', line 4 def season @season end |
#start_date ⇒ Object (readonly)
Returns the value of attribute start_date.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 4 def start_date @start_date end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 4 def status @status end |
#year ⇒ Object (readonly)
Returns the value of attribute year.
4 5 6 |
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 4 def year @year end |
Instance Method Details
#schedule ⇒ Object
24 25 26 |
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 24 def schedule Ncaamb.tournament_schedule(year, season, id) end |