module MLBStatsAPI::Leagues

Operations pertaining to leagues @see statsapi.mlb.com/docs/#tag/league

Constants

LEAGUES

Public Instance Methods

all_star_ballot(league_id, season = nil, options = {}) click to toggle source

View All-Star Ballots per league. @see statsapi.mlb.com/docs/#operation/allStarBallot

# File lib/mlb_stats_api/leagues.rb, line 38
def all_star_ballot(league_id, season = nil, options = {})
  options[:season] = season || Time.now.year

  get "/league/#{league_id}/allStarBallot", options
end
all_star_final_vote(league_id, season = nil, options = {}) click to toggle source

View All-Star Final Vote per league. @see statsapi.mlb.com/docs/#operation/allStarFinalVote

# File lib/mlb_stats_api/leagues.rb, line 54
def all_star_final_vote(league_id, season = nil, options = {})
  options[:season] = season || Time.now.year

  get "/league/#{league_id}/allStarFinalVote", options
end
all_star_write_ins(league_id, season = nil, options = {}) click to toggle source

View All-Star Write-ins per league. @see statsapi.mlb.com/docs/#operation/allStarWriteIns

# File lib/mlb_stats_api/leagues.rb, line 46
def all_star_write_ins(league_id, season = nil, options = {})
  options[:season] = season || Time.now.year

  get "/league/#{league_id}/allStarWriteIns", options
end
leagues(options = {}) click to toggle source

View league information. @see statsapi.mlb.com/docs/#operation/league

# File lib/mlb_stats_api/leagues.rb, line 28
def leagues(options = {})
  unless options[:sportId] || options[:leagueIds]
    raise ArgumentError, '#leagues requires a sportId or leagueIds'
  end

  get '/league', options
end