Module: MLBStatsAPI::Leagues

Included in:
Client
Defined in:
lib/mlb_stats_api/leagues.rb

Overview

Operations pertaining to leagues

Constant Summary collapse

LEAGUES =
{
  american: 103,
  national: 104,
  al: 103,
  nl: 104,
  big_east: 107,
  acc: 108,
  texas: 109,
  california: 110,
  southern: 111,
  pcl: 112,
  eastern: 113,
  cactus: 114,
  grapefruit: 115,
  south_atlantic: 116,
  international: 117,
  midwest: 118
}.freeze

Instance Method Summary collapse

Instance Method Details

#all_star_ballot(league_id, season = nil, options = {}) ⇒ Object

View All-Star Ballots per league.



38
39
40
41
42
# 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 = {}) ⇒ Object

View All-Star Final Vote per league.



54
55
56
57
58
# 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 = {}) ⇒ Object

View All-Star Write-ins per league.



46
47
48
49
50
# 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 = {}) ⇒ Object

View league information.



28
29
30
31
32
33
34
# 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