Class: MLB::TiedGames

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

Overview

Provides methods for fetching tied games from the API

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#datesArray<ScheduleDate>

Returns the schedule dates with tied games

Examples:

tied_games.dates #=> [#<MLB::ScheduleDate>, ...]

Returns:



13
# File 'lib/mlb/tied_games.rb', line 13

attribute :dates, ScheduleDate, collection: true

Class Method Details

.all(season: nil) ⇒ Array<ScheduledGame>

Retrieves tied games for a given season

Examples:

Get tied games for a season

MLB::TiedGames.all(season: 2024)

Parameters:

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

    the season year (defaults to current year)

Returns:



26
27
28
29
30
# File 'lib/mlb/tied_games.rb', line 26

def self.all(season: nil)
  season ||= Utils.current_season
  response = CLIENT.get("schedule/games/tied?#{Utils.build_query(season:)}")
  from_json(response).dates.flat_map(&:games)
end