Sha256: 31e5d1f8a22caad28d8ec612c9c1c72d9d9c93d4cc8fde6195e0ed7861c8a551

Contents?: true

Size: 566 Bytes

Versions: 3

Compression:

Stored size: 566 Bytes

Contents

module Onebox
  module Engine
    class SoundCloudOnebox
      include Engine
      include StandardEmbed

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

      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("http://soundcloud.com/oembed.json?url=#{url}").body))
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
onebox-1.5.21 lib/onebox/engine/soundcloud_onebox.rb
onebox-1.5.20 lib/onebox/engine/soundcloud_onebox.rb
onebox-1.5.19 lib/onebox/engine/soundcloud_onebox.rb