Class: Lumiere::Provider
- Inherits:
-
Object
show all
- Defined in:
- lib/provider.rb
Constant Summary
collapse
- PROVIDERS =
%w(YouTubePlaylist VimeoPlaylist YouTube Vimeo Dailymotion)
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.delegate(url) ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/provider.rb', line 10
def self.delegate(url)
PROVIDERS.each do |provider|
provider_class = Object.const_get("Lumiere").const_get(provider)
if provider_class.useable?(url)
return provider_class.new(url)
end
end
raise NotImplementedError
end
|
.useable?(url) ⇒ Boolean
21
22
23
24
25
26
|
# File 'lib/provider.rb', line 21
def self.useable?(url)
delegate(url)
true
rescue NotImplementedError
false
end
|
Instance Method Details
#==(other) ⇒ Object
88
89
90
91
92
|
# File 'lib/provider.rb', line 88
def ==(other)
if other.respond_to?(:video_id)
video_id == other.video_id
end
end
|
#accessible? ⇒ Boolean
84
85
86
|
# File 'lib/provider.rb', line 84
def accessible?
response.is_a?(Net::HTTPSuccess)
end
|
#api_url ⇒ Object
36
37
38
|
# File 'lib/provider.rb', line 36
def api_url
raise NotImplementedError
end
|
#description ⇒ Object
56
57
58
|
# File 'lib/provider.rb', line 56
def description
raise NotImplementedError
end
|
#duration ⇒ Object
60
61
62
|
# File 'lib/provider.rb', line 60
def duration
raise NotImplementedError
end
|
#embed_code ⇒ Object
44
45
46
|
# File 'lib/provider.rb', line 44
def embed_code
raise NotImplementedError
end
|
#embed_url ⇒ Object
40
41
42
|
# File 'lib/provider.rb', line 40
def embed_url
raise NotImplementedError
end
|
#playlist_id ⇒ Object
32
33
34
|
# File 'lib/provider.rb', line 32
def playlist_id
raise NotImplementedError
end
|
#provider ⇒ Object
48
49
50
|
# File 'lib/provider.rb', line 48
def provider
raise NotImplementedError
end
|
#thumbnail_large ⇒ Object
76
77
78
|
# File 'lib/provider.rb', line 76
def thumbnail_large
raise NotImplementedError
end
|
#thumbnail_medium ⇒ Object
72
73
74
|
# File 'lib/provider.rb', line 72
def thumbnail_medium
raise NotImplementedError
end
|
#thumbnail_small ⇒ Object
68
69
70
|
# File 'lib/provider.rb', line 68
def thumbnail_small
raise NotImplementedError
end
|
#title ⇒ Object
52
53
54
|
# File 'lib/provider.rb', line 52
def title
raise NotImplementedError
end
|
#upload_date ⇒ Object
64
65
66
|
# File 'lib/provider.rb', line 64
def upload_date
raise NotImplementedError
end
|
#video_id ⇒ Object
28
29
30
|
# File 'lib/provider.rb', line 28
def video_id
raise NotImplementedError
end
|
#videos ⇒ Object
80
81
82
|
# File 'lib/provider.rb', line 80
def videos
raise NotImplementedError
end
|