Class: VgVimeo
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 = {}) ⇒ VgVimeo
constructor
A new instance of VgVimeo.
- #service ⇒ Object
- #thumbnail ⇒ Object
- #title ⇒ Object
- #video_id ⇒ Object
Constructor Details
#initialize(url = nil, options = {}) ⇒ VgVimeo
Returns a new instance of VgVimeo.
9 10 11 12 13 14 15 |
# File 'lib/acts_as_unvlogable/vg_vimeo.rb', line 9 def initialize(url=nil, ={}) # general settings @url = url @video_id = parse_url(url) res = Net::HTTP.get(URI.parse("http://vimeo.com/moogaloop/load/clip:#{@video_id}/embed?param_server=vimeo.com¶m_clip_id=#{@video_id}")) @feed = REXML::Document.new(res) end |
Instance Method Details
#download_url ⇒ Object
47 48 49 50 51 |
# File 'lib/acts_as_unvlogable/vg_vimeo.rb', line 47 def download_url request_signature = REXML::XPath.first( @feed, "//request_signature" )[0] request_signature_expires = REXML::XPath.first( @feed, "//request_signature_expires" )[0] "http://www.vimeo.com/moogaloop/play/clip:#{@video_id}/#{request_signature}/#{request_signature_expires}/?q=hd" end |
#duration ⇒ Object
29 30 31 |
# File 'lib/acts_as_unvlogable/vg_vimeo.rb', line 29 def duration REXML::XPath.first( @feed, "//duration" )[0].to_s.to_i end |
#embed_html(width = 425, height = 344, options = {}) ⇒ Object
37 38 39 |
# File 'lib/acts_as_unvlogable/vg_vimeo.rb', line 37 def (width=425, height=344, ={}) "<object width='#{width}' height='#{height}'><param name='movie' value='#{}'></param><param name='allowFullScreen' value='true'></param><param name='allowscriptaccess' value='always'></param><embed src='#{}' type='application/x-shockwave-flash' allowscriptaccess='always' allowfullscreen='true' width='#{width}' height='#{height}'></embed></object>" end |
#embed_url ⇒ Object
33 34 35 |
# File 'lib/acts_as_unvlogable/vg_vimeo.rb', line 33 def "http://vimeo.com/moogaloop.swf?clip_id=#{@video_id}&server=vimeo.com&fullscreen=1&show_title=1&show_byline=1&show_portrait=1" end |
#flv ⇒ Object
41 42 43 44 45 |
# File 'lib/acts_as_unvlogable/vg_vimeo.rb', line 41 def flv request_signature = REXML::XPath.first( @feed, "//request_signature" )[0] request_signature_expires = REXML::XPath.first( @feed, "//request_signature_expires" )[0] "http://www.vimeo.com/moogaloop/play/clip:#{@video_id}/#{request_signature}/#{request_signature_expires}/" end |
#service ⇒ Object
53 54 55 |
# File 'lib/acts_as_unvlogable/vg_vimeo.rb', line 53 def service "Vimeo" end |
#thumbnail ⇒ Object
25 26 27 |
# File 'lib/acts_as_unvlogable/vg_vimeo.rb', line 25 def thumbnail REXML::XPath.first( @feed, "//thumbnail" )[0].to_s end |
#title ⇒ Object
21 22 23 |
# File 'lib/acts_as_unvlogable/vg_vimeo.rb', line 21 def title REXML::XPath.first( @feed, "//caption" )[0].to_s end |
#video_id ⇒ Object
17 18 19 |
# File 'lib/acts_as_unvlogable/vg_vimeo.rb', line 17 def video_id @video_id end |