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)


7
8
9
10
11
12
# File 'lib/mlb_stats_api/stats.rb', line 7

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.

Raises:

  • (ArgumentError)


15
16
17
18
19
# File 'lib/mlb_stats_api/stats.rb', line 15

def stats_leaders(**options)
  raise ArgumentError, '#stats_leaders requires a leaderCategories arg' unless options[:leaderCategories]

  get '/stats/leaders', **options
end