Module: MLBStatsAPI::People

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

Overview

Operations pertaining to players, umpires, and coaches

Instance Method Summary collapse

Instance Method Details

#person(person_ids, **options) ⇒ Object Also known as: people

View one or more person’s stats and biographical information.



7
8
9
10
11
12
13
14
15
# File 'lib/mlb_stats_api/people.rb', line 7

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

#person_game_stats(person_id, **options) ⇒ Object

View a player’s stats for a specific game.



19
20
21
22
23
# File 'lib/mlb_stats_api/people.rb', line 19

def person_game_stats(person_id, **options)
  game = options.delete(:gamePk) || 'current'

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