Sha256: 310bed2e70a79d433880f02f56562d53c1b76b2395e0c1e8dd43e09baaf7717d

Contents?: true

Size: 586 Bytes

Versions: 7

Compression:

Stored size: 586 Bytes

Contents

module Onebox
  module Engine
    class SoundCloudOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https?:\/\/.*soundcloud\.com/)
      always_https

      def to_html
        get_oembed_data[:html].gsub!('height="400"', 'height="250"')
      end

      def placeholder_html
        "<img src='#{get_oembed_data[:thumbnail_url]}'>"
      end

      private

      def get_oembed_data
        Onebox::Helpers.symbolize_keys(::MultiJson.load(Onebox::Helpers.fetch_response("https://soundcloud.com/oembed.json?url=#{url}").body))
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
onebox-1.5.28 lib/onebox/engine/soundcloud_onebox.rb
onebox-1.5.27 lib/onebox/engine/soundcloud_onebox.rb
onebox-1.5.26 lib/onebox/engine/soundcloud_onebox.rb
onebox-1.5.25 lib/onebox/engine/soundcloud_onebox.rb
onebox-1.5.24 lib/onebox/engine/soundcloud_onebox.rb
onebox-1.5.23 lib/onebox/engine/soundcloud_onebox.rb
onebox-1.5.22 lib/onebox/engine/soundcloud_onebox.rb