Module: MLBStatsAPI::Stats

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

Overview

Operations pertaining to stats

Instance Method Summary collapse

Instance Method Details

#stats(options = {}) ⇒ Object

View statistics based on statType, group, season, and organization.

Raises:

  • (ArgumentError)

See Also:



9
10
11
12
13
14
# File 'lib/mlb_stats_api/stats.rb', line 9

def stats(options = {})
  raise ArgumentError, '#stats requires a stats arg' unless options[:stats]
  raise ArgumentError, '#stats requires a group arg' unless options[:group]

  get '/stats', options
end

#stats_leaders(options = {}) ⇒ Object

View leaders for a statistic.



18
19
20
21
22
23
24
# File 'lib/mlb_stats_api/stats.rb', line 18

def stats_leaders(options = {})
  unless options[:leaderCategories]
    raise ArgumentError, '#stats_leaders requires a leaderCategories arg'
  end

  get '/stats/leaders', options
end