Class: MLB::Boxscore

Inherits:
Shale::Mapper
  • Object
show all
Defined in:
lib/mlb/boxscore.rb

Overview

Represents a game’s boxscore

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#teamsBoxscoreTeams

Returns the teams data

Examples:

boxscore.teams #=> #<MLB::BoxscoreTeams>

Returns:



62
# File 'lib/mlb/boxscore.rb', line 62

attribute :teams, BoxscoreTeams

Class Method Details

.find(game:) ⇒ Boxscore

Retrieves the boxscore for a game

Examples:

Get boxscore for a game

MLB::Boxscore.find(game: 745726)

Parameters:

Returns:



75
76
77
78
79
# File 'lib/mlb/boxscore.rb', line 75

def self.find(game:)
  game_pk = game.respond_to?(:game_pk) ? game.game_pk : game
  response = CLIENT.get("game/#{game_pk}/boxscore")
  from_json(response)
end