Class: Gameday::BoxScore
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Gameday::BoxScore
- Defined in:
- lib/gameday/box_score.rb
Class Method Summary collapse
Instance Method Summary collapse
- #__getobj__ ⇒ Object
- #away_team ⇒ Object
- #game_info ⇒ Object
- #home_team ⇒ Object
-
#initialize(boxscore_response_obj) ⇒ BoxScore
constructor
A new instance of BoxScore.
Constructor Details
#initialize(boxscore_response_obj) ⇒ BoxScore
Returns a new instance of BoxScore.
21 22 23 |
# File 'lib/gameday/box_score.rb', line 21 def initialize(boxscore_response_obj) @response_obj = boxscore_response_obj end |
Class Method Details
.from_params(year, month, day, away_code, home_code) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/gameday/box_score.rb', line 7 def self.from_params(year, month, day, away_code, home_code) base = Gameday::BASE_URL path = "/components/game/mlb/year_#{year}/month_#{month}/day_#{day}/gid_#{year}_#{month}_#{day}_#{away_code}mlb_#{home_code}mlb_1/boxscore.json" doc = UrlHelper.get_json_doc(Gameday::BASE_URL, path) return nil unless doc["data"] Gameday::BoxScore.new(doc["data"]["boxscore"]) end |
Instance Method Details
#__getobj__ ⇒ Object
17 18 19 |
# File 'lib/gameday/box_score.rb', line 17 def __getobj__ @response_obj end |
#away_team ⇒ Object
29 30 31 |
# File 'lib/gameday/box_score.rb', line 29 def away_team self["away_fname"] end |
#game_info ⇒ Object
33 34 35 |
# File 'lib/gameday/box_score.rb', line 33 def game_info Gameday::GameInfo.new(self["game_info"]) end |
#home_team ⇒ Object
25 26 27 |
# File 'lib/gameday/box_score.rb', line 25 def home_team self["home_fname"] end |