class SportsDataApi::Ncaamb::Team

Attributes

alias[R]
conference[R]
division[R]
id[R]
market[R]
name[R]
players[R]
points[R]
stats[R]

Public Class Methods

new(xml, conference = nil, division = nil) click to toggle source
# File lib/sports_data_api/ncaamb/team.rb, line 7
def initialize(xml, conference = nil, division = nil)
  xml = xml.first if xml.is_a? Nokogiri::XML::NodeSet
  if xml.is_a? Nokogiri::XML::Element
    @id = xml['id']
    @name = xml['name']
    @market = xml['market']
    @alias = xml['alias']
    @points = xml['points'] ? xml['points'].to_i : nil
    @conference = conference
    @division = division
    @players = xml.xpath("players/player").map do |player_xml|
      Player.new(player_xml)
    end
  end
end

Public Instance Methods

==(other) click to toggle source

Compare the Team with another team

Calls superclass method
# File lib/sports_data_api/ncaamb/team.rb, line 25
def ==(other)
  # Must have an id to compare
  return false if id.nil?

  if other.is_a? SportsDataApi::Ncaamb::Team
    other.id && id === other.id
  elsif other.is_a? Symbol
    id.to_sym === other
  else
    super(other)
  end
end