Class: MLB::GamePace

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

Overview

Provides methods for fetching game pace data from the API

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#sportsArray<GamePaceStats>

Returns the sports game pace data

Examples:

game_pace.sports #=> [#<MLB::GamePaceStats>, ...]

Returns:



154
# File 'lib/mlb/game_pace.rb', line 154

attribute :sports, GamePaceStats, collection: true

Class Method Details

.find(season: nil) ⇒ GamePaceStats

Retrieves game pace statistics for a season

Examples:

Get game pace for 2024

MLB::GamePace.find(season: 2024)

Parameters:

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

    the season year (defaults to current year)

Returns:



167
168
169
170
171
# File 'lib/mlb/game_pace.rb', line 167

def self.find(season: nil)
  season ||= Utils.current_season
  response = CLIENT.get("gamePace?#{Utils.build_query(season:)}")
  from_json(response).sports.first
end