Class: NFL::LiveUpdate::GameCenter::Game
- Inherits:
-
Object
- Object
- NFL::LiveUpdate::GameCenter::Game
- Defined in:
- lib/nfl/live_update/game_center/game.rb
Instance Attribute Summary collapse
-
#away ⇒ Object
Returns the value of attribute away.
-
#home ⇒ Object
Returns the value of attribute home.
-
#json ⇒ Object
Returns the value of attribute json.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json) ⇒ Game
constructor
A new instance of Game.
Constructor Details
#initialize(json) ⇒ Game
Returns a new instance of Game.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nfl/live_update/game_center/game.rb', line 8 def initialize(json) @next_update = json.delete("nextupdate") @id = json.keys.first json = json[@id.to_s] @home = Team.new(json["home"]) @away = Team.new(json["away"]) @json = json @json.delete("home") @json.delete("away") end |
Instance Attribute Details
#away ⇒ Object
Returns the value of attribute away.
6 7 8 |
# File 'lib/nfl/live_update/game_center/game.rb', line 6 def away @away end |
#home ⇒ Object
Returns the value of attribute home.
6 7 8 |
# File 'lib/nfl/live_update/game_center/game.rb', line 6 def home @home end |
#json ⇒ Object
Returns the value of attribute json.
6 7 8 |
# File 'lib/nfl/live_update/game_center/game.rb', line 6 def json @json end |
Class Method Details
.test_game ⇒ Object
22 23 24 25 26 |
# File 'lib/nfl/live_update/game_center/game.rb', line 22 def test_game eid = "2011122500" url = "http://www.nfl.com/liveupdate/game-center/#{eid}/#{eid}_gtd.json" new(JSON.parse(open(url).readlines.join)) end |