lib/onebox/engine/wistia_onebox.rb in onebox-1.8.79 vs lib/onebox/engine/wistia_onebox.rb in onebox-1.8.80

- old
+ new

@@ -6,27 +6,22 @@ matches_regexp(/https?:\/\/(.+)?(wistia.com|wi.st)\/(medias|embed)\/.*/) always_https def to_html - oembed_data[:html] + get_oembed.html end def placeholder_html - return if Onebox::Helpers.blank?(oembed_data[:thumbnail_url]) - escaped_src = ::Onebox::Helpers.normalize_url_for_output(oembed_data[:thumbnail_url]) - "<img src='#{escaped_src}' #{Helpers.title_attr(oembed_data)}>" + oembed = get_oembed + return if Onebox::Helpers.blank?(oembed.thumbnail_url) + "<img src='#{oembed.thumbnail_url}' #{oembed.title_attr}>" end private - def oembed_data - @oembed_data ||= begin - oembed_url = "https://fast.wistia.com/oembed?embedType=iframe&url=#{url}" - response = Onebox::Helpers.fetch_response(oembed_url) rescue "{}" - Onebox::Helpers.symbolize_keys(::MultiJson.load(response)) - rescue - {} - end + + def get_oembed_url + "https://fast.wistia.com/oembed?embedType=iframe&url=#{url}" end end end end