Class: MLB::PostseasonSeries

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

Overview

Provides methods for fetching postseason series from the API

Class Method Summary collapse

Class Method Details

.all(season: nil, sport: Utils::DEFAULT_SPORT_ID) ⇒ Array<PostseasonSeriesEntry>

Retrieves postseason series for a season

Examples:

Get postseason series for a season

MLB::PostseasonSeries.all(season: 2024)

Parameters:

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

    the season year (defaults to current year)

  • sport (Integer, Sport) (defaults to: Utils::DEFAULT_SPORT_ID)

    the sport ID or Sport object

Returns:



47
48
49
50
51
52
# File 'lib/mlb/postseason_series.rb', line 47

def self.all(season: nil, sport: Utils::DEFAULT_SPORT_ID)
  season ||= Utils.current_season
  params = {season:, sportId: Utils.extract_id(sport)}
  response = CLIENT.get("schedule/postseason/series?#{Utils.build_query(params)}")
  from_json(response).series
end