Class: MLB::GameChanges
- Inherits:
-
Shale::Mapper
- Object
- Shale::Mapper
- MLB::GameChanges
- Defined in:
- lib/mlb/game_changes.rb
Overview
Fetches games that have been modified since a given timestamp
This endpoint is useful for efficiently polling for game updates rather than fetching all game data repeatedly.
Instance Attribute Summary collapse
-
#dates ⇒ Array<ChangedGameDate>
Returns dates containing changed games.
Class Method Summary collapse
-
.since(updated_since:, sport_id: nil, season: nil, game_type: nil) ⇒ Array<ChangedGame>
Retrieves games modified since the given timestamp.
Instance Attribute Details
#dates ⇒ Array<ChangedGameDate>
Returns dates containing changed games
56 |
# File 'lib/mlb/game_changes.rb', line 56 attribute :dates, ChangedGameDate, collection: true |
Class Method Details
.since(updated_since:, sport_id: nil, season: nil, game_type: nil) ⇒ Array<ChangedGame>
Retrieves games modified since the given timestamp
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/mlb/game_changes.rb', line 76 def self.since(updated_since:, sport_id: nil, season: nil, game_type: nil) params = { updatedSince: updated_since.to_s, sportId: sport_id, season: season, gameType: game_type }.compact response = CLIENT.get("game/changes?#{URI.encode_www_form(params)}") from_json(response).dates.flat_map(&:games) end |