Class: NFL::LiveUpdate::ScoreStrip::Game

Inherits:
Object
  • Object
show all
Defined in:
lib/nfl/live_update/score_strip/game.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Game

Returns a new instance of Game.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/nfl/live_update/score_strip/game.rb', line 13

def initialize(xml)
  attributes = xml.attributes
  attributes.each do |k,v|
    attributes[k] = v.text
  end

  @id = attributes["eid"]
  @gsis = attributes["gsis"]
  @day_of_week = attributes["d"]
  @time_of_day = attributes["t"]
  @status = attributes["q"]

  @home_abbr = attributes["h"]
  @home_team_name = attributes["htn"]
  @home_nickname = attributes["hnn"]
  @home_score = attributes["hs"]

  @visitor_abbr = attributes["v"]
  @visitor_team_name = attributes["vtn"]
  @visitor_nickname = attributes["vnn"]
  @visitor_score = attributes["vs"]

  @red_zone = attributes["rz"]
  @ga = attributes["ga"]
  @game_type = attributes["gt"]

  @k = attributes["k"]
  @p = attributes["p"]
  @network = attributes["n"]
  @o = attributes["o"]
end

Instance Attribute Details

#day_of_weekObject

Returns the value of attribute day_of_week.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def day_of_week
  @day_of_week
end

#gaObject

Returns the value of attribute ga.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def ga
  @ga
end

#game_typeObject

Returns the value of attribute game_type.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def game_type
  @game_type
end

#gsisObject

Returns the value of attribute gsis.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def gsis
  @gsis
end

#home_abbrObject

Returns the value of attribute home_abbr.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def home_abbr
  @home_abbr
end

#home_nicknameObject

Returns the value of attribute home_nickname.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def home_nickname
  @home_nickname
end

#home_scoreObject

Returns the value of attribute home_score.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def home_score
  @home_score
end

#home_team_nameObject

Returns the value of attribute home_team_name.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def home_team_name
  @home_team_name
end

#idObject

Returns the value of attribute id.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def id
  @id
end

#kObject

Returns the value of attribute k.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def k
  @k
end

#networkObject

Returns the value of attribute network.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def network
  @network
end

#oObject

Returns the value of attribute o.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def o
  @o
end

#pObject

Returns the value of attribute p.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def p
  @p
end

#red_zoneObject

Returns the value of attribute red_zone.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def red_zone
  @red_zone
end

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def status
  @status
end

#time_of_dayObject

Returns the value of attribute time_of_day.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def time_of_day
  @time_of_day
end

#visitor_abbrObject

Returns the value of attribute visitor_abbr.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def visitor_abbr
  @visitor_abbr
end

#visitor_nicknameObject

Returns the value of attribute visitor_nickname.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def visitor_nickname
  @visitor_nickname
end

#visitor_scoreObject

Returns the value of attribute visitor_score.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def visitor_score
  @visitor_score
end

#visitor_team_nameObject

Returns the value of attribute visitor_team_name.



6
7
8
# File 'lib/nfl/live_update/score_strip/game.rb', line 6

def visitor_team_name
  @visitor_team_name
end

#xmlObject (readonly)

Returns the value of attribute xml.



11
12
13
# File 'lib/nfl/live_update/score_strip/game.rb', line 11

def xml
  @xml
end

Instance Method Details

#game_centerObject



62
63
64
# File 'lib/nfl/live_update/score_strip/game.rb', line 62

def game_center
  NFL::LiveUpdate::GameCenter::Game.find(id)
end

#game_type_stringObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/nfl/live_update/score_strip/game.rb', line 45

def game_type_string
  case @game_type
  when "REG"
    "Regular"
  when "WC"
    "Wild Card"
  when "CON"
    "Conference"
  when "DIV"
    "Division"
  when "PRO"
    "Pro Bowl"
  else
    @game_type
  end
end