Sha256: 79cb0c4468eebac3ba6cf16371cc83565814b684d8b68c8e3ed53aa64b633509

Contents?: true

Size: 660 Bytes

Versions: 4

Compression:

Stored size: 660 Bytes

Contents

# frozen_string_literal: true

module MLBStatsAPI
  # Operations pertaining to standings
  # @see https://statsapi.mlb.com/docs/#tag/standings
  module Standings
    # View standings for a league.
    # @see https://statsapi.mlb.com/docs/#operation/standings
    def standings(options = {})
      options[:hydrate] = 'team' unless options.key?(:hydrate)

      if options[:leagues] && !options[:leagueId]
        league_ids = Leagues::LEAGUES.values_at(*options.delete(:leagues))

        options[:leagueId] = league_ids
      end

      options[:leagueId] = [103, 104] unless Array(options[:leagueId])&.any?

      get '/standings', options
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mlb_stats_api-0.2.5 lib/mlb_stats_api/standings.rb
mlb_stats_api-0.2.4 lib/mlb_stats_api/standings.rb
mlb_stats_api-0.2.3 lib/mlb_stats_api/standings.rb
mlb_stats_api-0.2.2 lib/mlb_stats_api/standings.rb