Class: Gameday::Game

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/gameday/game.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(game_obj, scoreboard) ⇒ Game

Returns a new instance of Game.



10
11
12
13
# File 'lib/gameday/game.rb', line 10

def initialize(game_obj, scoreboard)
  @game = game_obj
  @scoreboard = scoreboard
end

Instance Attribute Details

#scoreboardObject

Returns the value of attribute scoreboard.



4
5
6
# File 'lib/gameday/game.rb', line 4

def scoreboard
  @scoreboard
end

Instance Method Details

#__getobj__Object



6
7
8
# File 'lib/gameday/game.rb', line 6

def __getobj__
  @game
end

#away_codeObject



15
16
17
# File 'lib/gameday/game.rb', line 15

def away_code
  self["away_code"]
end

#away_pitcherObject



27
28
29
# File 'lib/gameday/game.rb', line 27

def away_pitcher
  Gameday::Pitcher.new(self["away_probable_pitcher"])
end

#boxscore_base_urlObject



41
42
43
# File 'lib/gameday/game.rb', line 41

def boxscore_base_url
  Gameday::BASE_URL
end

#boxscore_pathObject



45
46
47
# File 'lib/gameday/game.rb', line 45

def boxscore_path
  "/components/game/mlb/year_#{year}/month_#{month}/day_#{day}/gid_#{year}_#{month}_#{day}_#{away_code}mlb_#{home_code}mlb_1/boxscore.json"
end

#dayObject



37
38
39
# File 'lib/gameday/game.rb', line 37

def day
  scoreboard.day
end

#home_codeObject



19
20
21
# File 'lib/gameday/game.rb', line 19

def home_code
  self["home_code"]
end

#home_pitcherObject



23
24
25
# File 'lib/gameday/game.rb', line 23

def home_pitcher
  Gameday::Pitcher.new(self["home_probable_pitcher"])
end

#monthObject



34
35
36
# File 'lib/gameday/game.rb', line 34

def month
  scoreboard.month
end

#yearObject



31
32
33
# File 'lib/gameday/game.rb', line 31

def year
  scoreboard.year
end