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
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/provider.rb', line 16
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
27
28
29
30
31
32
|
# File 'lib/provider.rb', line 27
def self.useable?(url)
delegate(url)
true
rescue NotImplementedError
false
end
|
Instance Method Details
#==(other) ⇒ Object
94
95
96
97
98
|
# File 'lib/provider.rb', line 94
def ==(other)
if other.respond_to?(:video_id)
video_id == other.video_id
end
end
|
#accessible? ⇒ Boolean
90
91
92
|
# File 'lib/provider.rb', line 90
def accessible?
response.is_a?(Net::HTTPSuccess)
end
|
#api_url ⇒ Object
42
43
44
|
# File 'lib/provider.rb', line 42
def api_url
raise NotImplementedError
end
|
#description ⇒ Object
62
63
64
|
# File 'lib/provider.rb', line 62
def description
raise NotImplementedError
end
|
#duration ⇒ Object
66
67
68
|
# File 'lib/provider.rb', line 66
def duration
raise NotImplementedError
end
|
#embed_code ⇒ Object
50
51
52
|
# File 'lib/provider.rb', line 50
def embed_code
raise NotImplementedError
end
|
#embed_url ⇒ Object
46
47
48
|
# File 'lib/provider.rb', line 46
def embed_url
raise NotImplementedError
end
|
#playlist_id ⇒ Object
38
39
40
|
# File 'lib/provider.rb', line 38
def playlist_id
raise NotImplementedError
end
|
#provider ⇒ Object
54
55
56
|
# File 'lib/provider.rb', line 54
def provider
raise NotImplementedError
end
|
#thumbnail_large ⇒ Object
82
83
84
|
# File 'lib/provider.rb', line 82
def thumbnail_large
raise NotImplementedError
end
|
#thumbnail_medium ⇒ Object
78
79
80
|
# File 'lib/provider.rb', line 78
def thumbnail_medium
raise NotImplementedError
end
|
#thumbnail_small ⇒ Object
74
75
76
|
# File 'lib/provider.rb', line 74
def thumbnail_small
raise NotImplementedError
end
|
#title ⇒ Object
58
59
60
|
# File 'lib/provider.rb', line 58
def title
raise NotImplementedError
end
|
#upload_date ⇒ Object
70
71
72
|
# File 'lib/provider.rb', line 70
def upload_date
raise NotImplementedError
end
|
#video_id ⇒ Object
34
35
36
|
# File 'lib/provider.rb', line 34
def video_id
raise NotImplementedError
end
|
#videos ⇒ Object
86
87
88
|
# File 'lib/provider.rb', line 86
def videos
raise NotImplementedError
end
|