Class: MLB::PostseasonSchedule
- Inherits:
-
Shale::Mapper
- Object
- Shale::Mapper
- MLB::PostseasonSchedule
- Defined in:
- lib/mlb/postseason_schedule.rb
Overview
Provides methods for fetching postseason schedule data from the API
Instance Attribute Summary collapse
-
#dates ⇒ Array<ScheduleDate>
Returns the schedule dates.
-
#total_games ⇒ Integer
Returns the total number of games.
Class Method Summary collapse
-
.games(season: nil) ⇒ Array<ScheduledGame>
Retrieves postseason games for a season.
Instance Attribute Details
#dates ⇒ Array<ScheduleDate>
Returns the schedule dates
21 |
# File 'lib/mlb/postseason_schedule.rb', line 21 attribute :dates, ScheduleDate, collection: true |
#total_games ⇒ Integer
Returns the total number of games
13 |
# File 'lib/mlb/postseason_schedule.rb', line 13 attribute :total_games, Shale::Type::Integer |
Class Method Details
.games(season: nil) ⇒ Array<ScheduledGame>
Retrieves postseason games for a season
35 36 37 38 39 |
# File 'lib/mlb/postseason_schedule.rb', line 35 def self.games(season: nil) season ||= Utils.current_season response = CLIENT.get("schedule/postseason?#{Utils.build_query(season:)}") from_json(response).dates.flat_map(&:games) end |