Class: VgCollegehumor
- Defined in:
- lib/acts_as_unvlogable/vg_collegehumor.rb
Instance Method Summary collapse
- #download_url ⇒ Object
- #duration ⇒ Object
- #embed_html(width = 425, height = 344, options = {}) ⇒ Object
- #embed_url ⇒ Object
- #flv ⇒ Object
-
#initialize(url = nil, options = {}) ⇒ VgCollegehumor
constructor
A new instance of VgCollegehumor.
- #service ⇒ Object
- #thumbnail ⇒ Object
- #title ⇒ Object
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, ={}) @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_url ⇒ Object
36 37 38 |
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 36 def download_url nil end |
#duration ⇒ Object
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 (width=425, height=344, ={}) "<object type='application/x-shockwave-flash' data='#{}' 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 src='#{}' type='application/x-shockwave-flash' wmode='transparent' width='#{width}' height='#{height}' allowScriptAccess='always'></embed></object>" end |
#embed_url ⇒ Object
24 25 26 |
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 24 def "http://www.collegehumor.com/moogaloop/moogaloop.swf?clip_id=#{@video_id}&fullscreen=1" end |
#flv ⇒ Object
32 33 34 |
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 32 def flv REXML::XPath.first(@feed, "//video/file")[0] end |
#service ⇒ Object
44 45 46 |
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 44 def service "CollegeHumor" end |
#thumbnail ⇒ Object
20 21 22 |
# File 'lib/acts_as_unvlogable/vg_collegehumor.rb', line 20 def thumbnail REXML::XPath.first(@feed, "//video/thumbnail")[0] end |
#title ⇒ Object
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 |