Sha256: e589b346afc3f14d2e944516bd240a7936eecc3d2396382027604f345540a0f4

Contents?: true

Size: 588 Bytes

Versions: 9

Compression:

Stored size: 588 Bytes

Contents

module Onebox
  module Engine
    class WistiaOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/https?:\/\/(.+)?(wistia.com|wi.st)\/(medias|embed)\/.*/)
      always_https

      def to_html
        get_oembed.html
      end

      def placeholder_html
        oembed = get_oembed
        return if Onebox::Helpers.blank?(oembed.thumbnail_url)
        "<img src='#{oembed.thumbnail_url}' #{oembed.title_attr}>"
      end

      private

      def get_oembed_url
        "https://fast.wistia.com/oembed?embedType=iframe&url=#{url}"
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
onebox-1.8.89 lib/onebox/engine/wistia_onebox.rb
onebox-1.8.88 lib/onebox/engine/wistia_onebox.rb
onebox-1.8.87 lib/onebox/engine/wistia_onebox.rb
onebox-1.8.86 lib/onebox/engine/wistia_onebox.rb
onebox-1.8.85 lib/onebox/engine/wistia_onebox.rb
onebox-1.8.84 lib/onebox/engine/wistia_onebox.rb
onebox-1.8.83 lib/onebox/engine/wistia_onebox.rb
onebox-1.8.82 lib/onebox/engine/wistia_onebox.rb
onebox-1.8.80 lib/onebox/engine/wistia_onebox.rb