Class: VgCollegehumor

Inherits:
Object show all
Defined in:
lib/acts_as_unvlogable/vg_collegehumor.rb

Instance Method Summary collapse

Constructor Details

#initialize(url = nil, options = {}) ⇒ VgCollegehumor

Returns a new instance of VgCollegehumor.



9
10
11
12
13
14
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 9

def initialize(url=nil, options={})
  @url = url
  @video_id = parse_url(url)
  res = Net::HTTP.get(URI.parse("http://www.collegehumor.com/moogaloop/video:#{@video_id}"))
  @feed = REXML::Document.new(res)
end

Instance Method Details

#download_urlObject



36
37
38
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 36

def download_url
  nil
end

#durationObject



40
41
42
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 40

def duration
  nil
end

#embed_html(width = 425, height = 344, options = {}) ⇒ Object



28
29
30
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 28

def embed_html(width=425, height=344, options={})
  "<object type='application/x-shockwave-flash' data='#{embed_url}' width='#{width}' height='#{height}'><param name='allowfullscreen' value='true'/><param name='wmode' value='transparent'/><param name='AllowScriptAccess' value='true'/><param name='movie' quality='best' value='#{embed_url}'/><embed src='#{embed_url}' type='application/x-shockwave-flash' wmode='transparent' width='#{width}' height='#{height}' allowScriptAccess='always'></embed></object>"
end

#embed_urlObject



24
25
26
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 24

def embed_url
  "http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=#{@video_id}&fullscreen=1"
end

#flvObject



32
33
34
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 32

def flv
  REXML::XPath.first(@feed, "//video/file")[0]
end

#serviceObject



44
45
46
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 44

def service
  "CollegeHumor"
end

#thumbnailObject



20
21
22
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 20

def thumbnail
  REXML::XPath.first(@feed, "//video/thumbnail")[0]
end

#titleObject



16
17
18
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 16

def title
  REXML::XPath.first(@feed, "//video/caption")[0].to_s
end