Class: VideoInfo::Providers::Vimeo

Inherits:
VideoInfo::Provider show all
Defined in:
lib/video_info/providers/vimeo.rb

Instance Attribute Summary

Attributes inherited from VideoInfo::Provider

#data, #options, #url, #video_id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from VideoInfo::Provider

#available?, #embed_code, #stats, #thumbnail, #thumbnail_large_2x, #thumbnail_maxres

Constructor Details

#initialize(url, options = {}) ⇒ Vimeo

Returns a new instance of Vimeo.



7
8
9
10
11
12
13
14
15
# File 'lib/video_info/providers/vimeo.rb', line 7

def initialize(url, options = {})
  if VideoInfo.provider_api_keys[:vimeo].nil?
    extend VimeoScraper
  else
    extend VimeoAPI
  end

  super(url, options)
end

Class Method Details

.usable?(url) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/video_info/providers/vimeo.rb', line 17

def self.usable?(url)
  url.match?(%r{(vimeo\.com/(?!album|hubnut/album|user\d+/?\z).*)})
end

Instance Method Details

#embed_urlObject



25
26
27
# File 'lib/video_info/providers/vimeo.rb', line 25

def embed_url
  "//player.vimeo.com/video/#{video_id}"
end

#providerObject



21
22
23
# File 'lib/video_info/providers/vimeo.rb', line 21

def provider
  "Vimeo"
end