module EspnFflApi class Team attr_reader :id, :team_name, :owners_uuids, :abbrev, :logo_url, :points_for, :points_against, :wins, :losses, :ties def initialize(id:, team_name:, owners_uuids:, abbrev:, logo_url:, points_for:, points_against:, wins:, losses:, ties:) @id = id @team_name = team_name @owners_uuids = owners_uuids @abbrev = abbrev @logo_url = logo_url @points_for = points_for @points_against = points_against @wins = wins @losses = losses @ties = ties end def self.build(team_hash) new( id: team_hash["id"], team_name: "#{team_hash["location"]} #{team_hash["nickname"]}", owners_uuids: team_hash["owners"], abbrev: team_hash["abbrev"], logo_url: team_hash["logo"], points_for: team_hash["record"]["overall"]["pointsFor"], points_against: team_hash["record"]["overall"]["pointsAgainst"], wins: team_hash["record"]["overall"]["wins"], losses: team_hash["record"]["overall"]["losses"], ties: team_hash["record"]["overall"]["ties"], ) end end end