Sha256: ae3b522a95f0781f55ca9247fee6d81a6440996ed12529f73940fe705df9d9fb

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

# frozen_string_literal: true

module MLBStatsAPI
  # Operations pertaining to players, umpires, and coaches
  module People
    # View one or more person's stats and biographical information.
    def person(person_ids, **options)
      ids = Array(person_ids)

      result = get('/people', **options.merge(personIds: ids))['people']

      return result.first if ids.length == 1

      result
    end
    alias people person

    # View a player's stats for a specific game.
    def person_game_stats(person_id, **options)
      game = options.delete(:gamePk) || 'current'

      get("/people/#{person_id}/stats/game/#{game}", **options)['stats']
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mlb_stats_api-0.4.0 lib/mlb_stats_api/people.rb