Class: Lumiere::Vimeo

Inherits:
Provider show all
Defined in:
lib/provider/vimeo/vimeo.rb

Constant Summary collapse

USEABLE =
['www.vimeo.com', 'vimeo.com', 'player.vimeo.com']

Constants inherited from Provider

Provider::PROVIDERS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Provider

#==, #accessible?, delegate, #playlist_id, #videos

Constructor Details

#initialize(url, fetched = nil) ⇒ Vimeo

Returns a new instance of Vimeo.



16
17
18
19
# File 'lib/provider/vimeo/vimeo.rb', line 16

def initialize(url, fetched=nil)
  @url = url
  @fetched = fetched
end

Instance Attribute Details

#urlObject

Returns the value of attribute url.



3
4
5
# File 'lib/provider/vimeo/vimeo.rb', line 3

def url
  @url
end

Class Method Details

.new_from_video_id(video_id, fetched = nil) ⇒ Object



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

def self.new_from_video_id(video_id, fetched=nil)
  new("http://vimeo.com/#{video_id}", fetched)
end

.useable?(url) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/provider/vimeo/vimeo.rb', line 7

def self.useable?(url)
  uri = URISchemeless.parse(url)
  USEABLE.include?(uri.host)
end

Instance Method Details

#api_urlObject



29
30
31
# File 'lib/provider/vimeo/vimeo.rb', line 29

def api_url
  "http://vimeo.com/api/v2/video/#{video_id}.json"
end

#descriptionObject



45
46
47
# File 'lib/provider/vimeo/vimeo.rb', line 45

def description
  fetch.description
end

#durationObject



49
50
51
# File 'lib/provider/vimeo/vimeo.rb', line 49

def duration
  fetch.duration
end

#embed_codeObject



37
38
39
# File 'lib/provider/vimeo/vimeo.rb', line 37

def embed_code
  "<iframe src=\"#{embed_url}\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>"
end

#embed_urlObject



33
34
35
# File 'lib/provider/vimeo/vimeo.rb', line 33

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

#providerObject



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

def provider
  "Vimeo"
end

#thumbnail_largeObject



65
66
67
# File 'lib/provider/vimeo/vimeo.rb', line 65

def thumbnail_large
  fetch.thumbnail_large
end

#thumbnail_mediumObject



61
62
63
# File 'lib/provider/vimeo/vimeo.rb', line 61

def thumbnail_medium
  fetch.thumbnail_medium
end

#thumbnail_smallObject



57
58
59
# File 'lib/provider/vimeo/vimeo.rb', line 57

def thumbnail_small
  fetch.thumbnail_small
end

#titleObject



41
42
43
# File 'lib/provider/vimeo/vimeo.rb', line 41

def title
  fetch.title
end

#unpack_intoObject



69
70
71
72
# File 'lib/provider/vimeo/vimeo.rb', line 69

def unpack_into
  struct = []
  struct.extend(VimeoVideosRepresenter)
end

#upload_dateObject



53
54
55
# File 'lib/provider/vimeo/vimeo.rb', line 53

def upload_date
  fetch.upload_date
end

#video_idObject



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

def video_id
  @video_id ||= calculate_video_id
end