Sha256: c519ff92874b3a90178b5414e82c3f9ee0ee8a4c27061b80e99d1185db9889ae
Contents?: true
Size: 941 Bytes
Versions: 2
Compression:
Stored size: 941 Bytes
Contents
module Onebox module Engine class SoundCloudOnebox include Engine include StandardEmbed matches_regexp(/^https?:\/\/soundcloud\.com/) always_https def to_html oembed_data[:html].gsub('visual=true', 'visual=false') 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)}>" end private def oembed_data @oembed_data ||= begin oembed_url = "https://soundcloud.com/oembed.json?url=#{url}" oembed_url << "&maxheight=166" unless url["/sets/"] Onebox::Helpers.symbolize_keys(::MultiJson.load(Onebox::Helpers.fetch_response(oembed_url).body)) rescue {} end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
onebox-1.7.5 | lib/onebox/engine/soundcloud_onebox.rb |
onebox-1.7.4 | lib/onebox/engine/soundcloud_onebox.rb |