onebox 1.8.35 → 1.8.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/onebox/engine/wistia_onebox.rb +17 -19
- data/lib/onebox/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75def311705c3e04f08f263f624625bfa3e57b0183dc72f89c93ba3756a27ef4
|
4
|
+
data.tar.gz: d60df762c104ceeeb7f7370429bef4bd305e88a0b0dbb6457a21f3aa600db879
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4795ca2825a9de8d12a34d857b3b5a228ce5f2c92751a04884b99e739677f4b3343c7adf731a584898c85b0d8d0c4ceb6a501c8fc59884d78423ded2a227b516
|
7
|
+
data.tar.gz: 1f8fa8b09145a5802a7ee2508098efea6e50054f838a6072b7cc86a0ed813b09145085c3106e191981520bbdb10ef55a27eed912e6b5c35ccc3737f7f2c0d36b
|
@@ -7,28 +7,26 @@ module Onebox
|
|
7
7
|
matches_regexp(/https?:\/\/(.+)?(wistia.com|wi.st)\/(medias|embed)\/.*/)
|
8
8
|
always_https
|
9
9
|
|
10
|
-
def placeholder_html
|
11
|
-
tw = get_twitter
|
12
|
-
escaped_src = ::Onebox::Helpers.normalize_url_for_output(tw[:image])
|
13
|
-
"<img src='#{escaped_src}' height='#{tw[:player_height]}' #{Helpers.title_attr(tw)}>"
|
14
|
-
end
|
15
|
-
|
16
10
|
def to_html
|
17
|
-
|
18
|
-
|
19
|
-
escaped_src = ::Onebox::Helpers.normalize_url_for_output(src)
|
11
|
+
oembed_data[:html]
|
12
|
+
end
|
20
13
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
scrolling="no"
|
26
|
-
frameborder="0"
|
27
|
-
allowtransparency="true"
|
28
|
-
allowfullscreen>
|
29
|
-
</iframe>
|
30
|
-
HTML
|
14
|
+
def placeholder_html
|
15
|
+
return if Onebox::Helpers.blank?(oembed_data[:thumbnail_url])
|
16
|
+
escaped_src = ::Onebox::Helpers.normalize_url_for_output(oembed_data[:thumbnail_url])
|
17
|
+
"<img src='#{escaped_src}' #{Helpers.title_attr(oembed_data)}>"
|
31
18
|
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def oembed_data
|
22
|
+
@oembed_data ||= begin
|
23
|
+
oembed_url = "https://fast.wistia.com/oembed?embedType=iframe&url=#{url}"
|
24
|
+
response = Onebox::Helpers.fetch_response(oembed_url) rescue "{}"
|
25
|
+
Onebox::Helpers.symbolize_keys(::MultiJson.load(response))
|
26
|
+
rescue
|
27
|
+
{}
|
28
|
+
end
|
29
|
+
end
|
32
30
|
end
|
33
31
|
end
|
34
32
|
end
|
data/lib/onebox/version.rb
CHANGED