Class: SportsDataApi::Ncaamb::Tournament

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_data_api/ncaamb/tournament.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_dateObject (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

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 4

def id
  @id
end

#locationObject (readonly)

Returns the value of attribute location.



4
5
6
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 4

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 4

def name
  @name
end

#seasonObject (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_dateObject (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

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 4

def status
  @status
end

#yearObject (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

#scheduleObject



24
25
26
# File 'lib/sports_data_api/ncaamb/tournament.rb', line 24

def schedule
  Ncaamb.tournament_schedule(year, season, id)
end