Class: HostedVideo::Providers::Vimeo

Inherits:
Base
  • Object
show all
Defined in:
lib/hosted_video/providers/vimeo.rb

Direct Known Subclasses

VimeoByIframe

Instance Attribute Summary

Attributes inherited from Base

#url

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#iframe_code, #initialize, #kind, #vid

Constructor Details

This class inherits a constructor from HostedVideo::Providers::Base

Class Method Details

.can_parse?(url) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/hosted_video/providers/vimeo.rb', line 4

def self.can_parse?(url)
  url =~ /vimeo\.com\/\d{7,8}.*/
end

Instance Method Details

#previewObject



8
9
10
# File 'lib/hosted_video/providers/vimeo.rb', line 8

def preview
  JSON.load(open("http://vimeo.com/api/v2/video/#{vid}.json")).first['thumbnail_large']
end

#url_for_iframeObject



12
13
14
# File 'lib/hosted_video/providers/vimeo.rb', line 12

def url_for_iframe
  "http://player.vimeo.com/video/#{vid}?api=0"
end