Sha256: 3dfeb39c4518396b20c5adcd7a7c9b0f2625431d6d6c4f527dd049dc864b55a9

Contents?: true

Size: 823 Bytes

Versions: 4

Compression:

Stored size: 823 Bytes

Contents

# frozen_string_literal: true

module MLBStatsAPI
  # Operations pertaining to stats
  # @see https://statsapi.mlb.com/docs/#tag/stats
  module Stats
    # View statistics based on statType, group, season, and organization.
    # @see https://statsapi.mlb.com/docs/#operation/stats
    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

    # View leaders for a statistic.
    # @see https://statsapi.mlb.com/docs/#operation/leaders
    def stats_leaders(options = {})
      unless options[:leaderCategories]
        raise ArgumentError, '#stats_leaders requires a leaderCategories arg'
      end

      get '/stats/leaders', 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/stats.rb
mlb_stats_api-0.2.4 lib/mlb_stats_api/stats.rb
mlb_stats_api-0.2.3 lib/mlb_stats_api/stats.rb
mlb_stats_api-0.2.2 lib/mlb_stats_api/stats.rb