Class: Onebox::Engine::GfycatOnebox
- Inherits:
-
Object
- Object
- Onebox::Engine::GfycatOnebox
show all
- Includes:
- Onebox::Engine, JSON
- Defined in:
- lib/onebox/engine/gfycat_onebox.rb
Constant Summary
DEFAULT
Instance Attribute Summary
#cache, #timeout, #uri
Class Method Summary
collapse
Instance Method Summary
collapse
engines, included, #initialize, #options, #options=
Class Method Details
.priority ⇒ Object
10
11
12
13
|
# File 'lib/onebox/engine/gfycat_onebox.rb', line 10
def self.priority
1
end
|
Instance Method Details
#placeholder_html ⇒ Object
32
33
34
35
36
37
38
39
|
# File 'lib/onebox/engine/gfycat_onebox.rb', line 32
def placeholder_html
<<-HTML
<a href="#{data[:url]}">
<img src="#{data[:posterUrl]}" width="#{data[:width]}" height="#{data[:height]}"><br/>
#{data[:gfyName]}
</a>
HTML
end
|
#to_html ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/onebox/engine/gfycat_onebox.rb', line 19
def to_html
<<-HTML
<div>
<video controls loop autoplay muted poster="#{data[:posterUrl]}" width="#{data[:width]}" height="#{data[:height]}">
<source id="webmSource" src="#{data[:webmUrl]}" type="video/webm">
<source id="mp4Source" src="#{data[:mp4Url]}" type="video/mp4">
<img title="Sorry, your browser doesn't support HTML5 video." src="#{data[:posterUrl]}">
</video><br/>
<a href="#{data[:url]}">#{data[:name]}</a>
</div>
HTML
end
|
#url ⇒ Object
15
16
17
|
# File 'lib/onebox/engine/gfycat_onebox.rb', line 15
def url
"https://gfycat.com/cajax/get/#{match[:name]}"
end
|