Sha256: c462c572a8550cbcff24836a2b8edc9e22aa0495598c6efb3026d180d0391bd9
Contents?: true
Size: 992 Bytes
Versions: 2
Compression:
Stored size: 992 Bytes
Contents
# frozen_string_literal: true module MLBStatsAPI module Standings TYPES = { regular_season: 'regularSeason', wild_card: 'wildCard', division_leaders: 'divisionLeaders', wild_card_with_leaders: 'wildCardWithLeaders', first_half: 'firstHalf', second_half: 'secondHalf', spring_training: 'springTraining', post_season: 'postseason', by_division: 'byDivision', by_conference: 'byConference', by_league: 'byLeague' }.freeze def standings(leagues:, type: :regular_season, season: nil, hydrate: 'team') raise 'Invalid standings type.' unless TYPES[type] league_ids = Leagues::LEAGUES.values_at(*leagues) if league_ids.none? raise 'Invalid league(s) - see Leagues::LEAGUES for available names.' end get( "/standings/#{TYPES[type]}", leagueId: league_ids.join(','), season: (season || Date.today.year), hydrate: hydrate ) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mlb_stats_api-0.2.1 | lib/mlb_stats_api/standings.rb |
mlb_stats_api-0.2.0 | lib/mlb_stats_api/standings.rb |