Class: MLB::TeamUniforms

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/mlb/uniforms.rb

Overview

Represents team uniform collection

Class Method Summary collapse

Class Method Details

.find(team:, season: nil) ⇒ Array<UniformInfo>

Retrieves uniform information for a team

Examples:

Get uniforms for a team

MLB::TeamUniforms.find(team: 147)

Get uniforms using a Team object

MLB::TeamUniforms.find(team: team)

Parameters:

  • team (Integer, Team)

    the team ID or team object

  • season (Integer, nil) (defaults to: nil)

    the season year (defaults to current year)

Returns:



90
91
92
93
94
95
# File 'lib/mlb/uniforms.rb', line 90

def self.find(team:, season: nil)
  season ||= Utils.current_season
  params = {teamId: Utils.extract_id(team), season:}
  response = CLIENT.get("uniforms/team?#{Utils.build_query(params)}")
  from_json(response).uniforms
end