class SportsDataApi::Ncaamb::Game

Attributes

away[R]
away_team[R]
away_team_id[R]
broadcast[R]
clock[R]
date[R]
half[R]
home[R]
home_team[R]
home_team_id[R]
id[R]
scheduled[R]
season[R]
status[R]
venue[R]
year[R]

Public Class Methods

new(args={}) click to toggle source
# File lib/sports_data_api/ncaamb/game.rb, line 8
def initialize(args={})
  xml = args.fetch(:xml)
  @year = args[:year] ? args[:year].to_i : nil
  @season = args[:season] ? args[:season].to_sym : nil
  @date = args[:date]

  xml = xml.first if xml.is_a? Nokogiri::XML::NodeSet
  if xml.is_a? Nokogiri::XML::Element
    @id = xml['id']
    @scheduled = Time.parse xml['scheduled']
    @home = xml['home_team']
    @away = xml['away_team']
    @home_team_id = xml['home_team']
    @away_team_id = xml['away_team']
    @status = xml['status']
    @clock = xml['clock']
    @half = xml['half'] ? xml['half'].to_i : nil

    team_xml = xml.xpath('team')
    @home_team = Team.new(team_xml.first)
    @away_team = Team.new(team_xml.last)
    @venue = Venue.new(xml.xpath('venue'))
    @broadcast = Broadcast.new(xml.xpath('broadcast'))
  end
end

Public Instance Methods

boxscore() click to toggle source

Wrapper for NCAAMB.boxscore TODO

# File lib/sports_data_api/ncaamb/game.rb, line 48
def boxscore
  raise NotImplementedError
end
pbp() click to toggle source

Wrapper for NCAAMB.pbp (NCAAMB.play_by_play) TODO

# File lib/sports_data_api/ncaamb/game.rb, line 41
def pbp
  raise NotImplementedError
end
summary() click to toggle source
# File lib/sports_data_api/ncaamb/game.rb, line 34
def summary
  Ncaamb.game_summary(@id)
end