Class: Gameday::MasterScoreboard

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(games_obj) ⇒ MasterScoreboard

Returns a new instance of MasterScoreboard.



16
17
18
# File 'lib/gameday/master_scoreboard.rb', line 16

def initialize(games_obj)
  @games = games_obj
end

Class Method Details

.from_date(year, month, day) ⇒ Object



6
7
8
9
10
# File 'lib/gameday/master_scoreboard.rb', line 6

def self.from_date(year,month,day)
  url = "/components/game/mlb/year_#{year}/month_#{month}/day_#{day}/master_scoreboard.json"
  doc = UrlHelper.get_json_doc(Gameday::BASE_URL, url) 
  Gameday::MasterScoreboard.new(doc["data"]["games"])
end

Instance Method Details

#__getobj__Object



12
13
14
# File 'lib/gameday/master_scoreboard.rb', line 12

def __getobj__
  @games
end

#dateObject



30
31
32
# File 'lib/gameday/master_scoreboard.rb', line 30

def date
  Date.new(year.to_i,month.to_i,day.to_i)
end

#dayObject



26
27
28
# File 'lib/gameday/master_scoreboard.rb', line 26

def day
  self["day"]
end

#gamesObject



38
39
40
# File 'lib/gameday/master_scoreboard.rb', line 38

def games
  self["game"].map { |game_obj| Gameday::Game.new(game_obj, self) }
end

#monthObject



20
21
22
# File 'lib/gameday/master_scoreboard.rb', line 20

def month
  self["month"]
end

#num_gamesObject



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

def num_games
  self["game"].length
end

#yearObject



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

def year
  self["year"]
end