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
-
#person(person_ids, options = {}) ⇒ Object
(also: #people)
View one or more person’s stats and biographical information.
-
#person_game_stats(person_id, options = {}) ⇒ Object
View a player’s stats for a specific game.
Instance Method Details
#person(person_ids, options = {}) ⇒ Object Also known as: people
View one or more person’s stats and biographical information.
9 10 11 12 13 14 15 16 17 |
# File 'lib/mlb_stats_api/people.rb', line 9 def person(person_ids, = {}) ids = Array(person_ids) result = get('/people', .merge(personIds: ids)).dig('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.
22 23 24 25 26 |
# File 'lib/mlb_stats_api/people.rb', line 22 def person_game_stats(person_id, = {}) game = .delete(:gamePk) || 'current' get("/people/#{person_id}/stats/game/#{game}", ).dig('stats') end |