class SportsDataApi::Nba::Team

Attributes

alias[R]
conference[R]
division[R]
id[R]
json[R]
market[R]
name[R]
stats[R]

Public Class Methods

new(json, conference = nil, division = nil) click to toggle source
# File lib/sports_data_api/nba/team.rb, line 6
def initialize(json, conference = nil, division = nil)
  @conference = conference
  @division = division
  @id = json['id']
  @name = json['name']
  @market = json['market']
  @alias = json['alias']
  @points = json['points']
  @alias = json['alias']
  @json = json
end

Public Instance Methods

==(other) click to toggle source

Compare the Team with another team

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

  if other.is_a? SportsDataApi::Nba::Team
    other.id && id === other.id
  elsif other.is_a? Symbol
    id.to_sym === other
  else
    super(other)
  end
end
players() click to toggle source
# File lib/sports_data_api/nba/team.rb, line 22
def players
  return [] if json['players'].nil? || json['players'].empty?
  @players ||= json['players'].map { |x| Player.new(x) }
end
points() click to toggle source
# File lib/sports_data_api/nba/team.rb, line 18
def points
  @points ||= json['points'] ? json['points'].to_i : nil
end
venue() click to toggle source
# File lib/sports_data_api/nba/team.rb, line 27
def venue
  @venue ||= Venue.new(json['venue']) if json['venue']
end