Sha256: 50bcd62408d7d5f24b5863794a642b5e7e515be48aacd09a93a0ded6add8a63b
Contents?: true
Size: 830 Bytes
Versions: 8
Compression:
Stored size: 830 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]) "<img src='#{oembed_data[:thumbnail_url]}'>" 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
8 entries across 8 versions & 1 rubygems