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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6d5848d0ee780c4a34fe10fbfdc4757a25871b76ceaaf091182059d1f13e7ce0
4
- data.tar.gz: 84ae7136ce2e5d2bd037ab5fae4bf193ca49bc36b35cbdeadd29ecf017c083b1
3
+ metadata.gz: 75def311705c3e04f08f263f624625bfa3e57b0183dc72f89c93ba3756a27ef4
4
+ data.tar.gz: d60df762c104ceeeb7f7370429bef4bd305e88a0b0dbb6457a21f3aa600db879
5
5
  SHA512:
6
- metadata.gz: d5330e5b5e2e00186aa095aded82ba83f032da7d560f28a845dc51e4b249062869bb26e482d403b5f9f7a914e3c1dcadbc23ea5d5c75e6af0e42d0a2604ae186
7
- data.tar.gz: 266fd2ef4906a5d96349c3e394bc0d82d72d1400a1f3575f8f5a70d7523548d5798dcae485c46ab9fa5f6bf006161aeaea7a08a8b4bfe1bd291a476a50b3d50f
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
- tw = get_twitter
18
- src = tw[:url].gsub("?twitter=true", "")
19
- escaped_src = ::Onebox::Helpers.normalize_url_for_output(src)
11
+ oembed_data[:html]
12
+ end
20
13
 
21
- <<-HTML
22
- <iframe src="#{escaped_src}"
23
- width="640"
24
- height="360"
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
@@ -1,3 +1,3 @@
1
1
  module Onebox
2
- VERSION = "1.8.35"
2
+ VERSION = "1.8.36"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: onebox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.35
4
+ version: 1.8.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joanna Zeta