Class: NFL::LiveUpdate::GameCenter::Game

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/nfl/live_update/game_center/game.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Game

Returns a new instance of Game.


17
18
19
20
21
22
23
24
25
26
27
# File 'lib/nfl/live_update/game_center/game.rb', line 17

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

#awayObject

Returns the value of attribute away.


14
15
16
# File 'lib/nfl/live_update/game_center/game.rb', line 14

def away
  @away
end

#homeObject

Returns the value of attribute home.


14
15
16
# File 'lib/nfl/live_update/game_center/game.rb', line 14

def home
  @home
end

#idObject

Returns the value of attribute id.


14
15
16
# File 'lib/nfl/live_update/game_center/game.rb', line 14

def id
  @id
end

#jsonObject

Returns the value of attribute json.


14
15
16
# File 'lib/nfl/live_update/game_center/game.rb', line 14

def json
  @json
end

#next_updateObject

Returns the value of attribute next_update.


14
15
16
# File 'lib/nfl/live_update/game_center/game.rb', line 14

def next_update
  @next_update
end

Class Method Details

.find(id) ⇒ Object


31
32
33
# File 'lib/nfl/live_update/game_center/game.rb', line 31

def find(id)
  new(get(relative_url(id)))
end