Class: Gameday::MasterScoreboard
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Gameday::MasterScoreboard
- Defined in:
- lib/gameday/master_scoreboard.rb
Class Method Summary collapse
Instance Method Summary collapse
- #__getobj__ ⇒ Object
- #date ⇒ Object
- #day ⇒ Object
- #games ⇒ Object
-
#initialize(games_obj) ⇒ MasterScoreboard
constructor
A new instance of MasterScoreboard.
- #month ⇒ Object
- #num_games ⇒ Object
- #year ⇒ Object
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 |
#date ⇒ Object
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 |
#day ⇒ Object
26 27 28 |
# File 'lib/gameday/master_scoreboard.rb', line 26 def day self["day"] end |
#games ⇒ Object
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 |
#month ⇒ Object
20 21 22 |
# File 'lib/gameday/master_scoreboard.rb', line 20 def month self["month"] end |
#num_games ⇒ Object
34 35 36 |
# File 'lib/gameday/master_scoreboard.rb', line 34 def num_games self["game"].length end |
#year ⇒ Object
23 24 25 |
# File 'lib/gameday/master_scoreboard.rb', line 23 def year self["year"] end |