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_week ⇒ Object

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

#ga ⇒ Object

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_type ⇒ Object

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

#gsis ⇒ Object

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_abbr ⇒ Object

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_nickname ⇒ Object

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_score ⇒ Object

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_name ⇒ Object

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

#id ⇒ Object

Returns the value of attribute id.



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

def id
  @id
end

#k ⇒ Object

Returns the value of attribute k.



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

def k
  @k
end

#network ⇒ Object

Returns the value of attribute network.



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

def network
  @network
end

#o ⇒ Object

Returns the value of attribute o.



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

def o
  @o
end

#p ⇒ Object

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_zone ⇒ Object

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

#status ⇒ Object

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_day ⇒ Object

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_abbr ⇒ Object

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_nickname ⇒ Object

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_score ⇒ Object

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_name ⇒ Object

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

#xml ⇒ Object (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_center ⇒ Object



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_string ⇒ Object



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