Class: Media

Inherits:
Object
  • Object
show all
Defined in:
lib/media.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#gidObject

Returns the value of attribute gid.



8
9
10
# File 'lib/media.rb', line 8

def gid
  @gid
end

#highlightsObject

Returns the value of attribute highlights.



8
9
10
# File 'lib/media.rb', line 8

def highlights
  @highlights
end

#mobileObject

Returns the value of attribute mobile.



8
9
10
# File 'lib/media.rb', line 8

def mobile
  @mobile
end

Instance Method Details

#load_from_id(gid) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/media.rb', line 11

def load_from_id(gid)
  @gid = gid
  @highlights = []
  @mobile = []
  @xml_highlights = GamedayFetcher.fetch_media_highlights(gid)
  @xml_doc = REXML::Document.new(@xml_highlights)
  if @xml_doc.root
    @xml_doc.elements.each("highlights/media") do |element| 
      highlight = MediaHighlight.new(element)
      @highlights << highlight
    end
  end
  
  @xml_mobile = GamedayFetcher.fetch_media_mobile(gid)
  @xml_doc = REXML::Document.new(@xml_mobile)
  if @xml_doc.root
    @xml_doc.elements.each("mobile/media") do |element| 
      mobile = MediaMobile.new(element)
      @mobile << mobile
    end
  end
end