Sha256: 274f01129f2a1acc17e604fbfec58a18304d502cd86e3c422032158582be92a7

Contents?: true

Size: 903 Bytes

Versions: 16

Compression:

Stored size: 903 Bytes

Contents

module Onebox
  module Engine
    class SlidesOnebox
      include Engine
      include StandardEmbed

      matches_regexp(/^https?:\/\/slides\.com\/[\p{Alnum}_\-]+\/[\p{Alnum}_\-]+$/)


      def to_html
        if uri.path =~ /^\/[\p{Alnum}_\-]+\/[\p{Alnum}_\-]+$/
          "<iframe src=\"//slides.com#{uri.path}/embed?style=light\" width=\"576\" height=\"420\" scrolling=\"no\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>"
        end
      end

      def placeholder_html
        # get_opengraph_data
        "<img src='#{get_opengraph_data[:images].first}'>"
      end

      private

      def get_opengraph_data
        return @opengraph_data if @opengraph_data
        response = Onebox::Helpers.fetch_response(url)
        html_doc = Nokogiri::HTML(response.body)

        @opengraph_data = parse_open_graph(html_doc, url)
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
onebox-1.5.50 lib/onebox/engine/slides_onebox.rb
onebox-1.5.49 lib/onebox/engine/slides_onebox.rb
onebox-1.5.48 lib/onebox/engine/slides_onebox.rb
onebox-1.5.47 lib/onebox/engine/slides_onebox.rb
onebox-1.5.45 lib/onebox/engine/slides_onebox.rb
onebox-1.5.44 lib/onebox/engine/slides_onebox.rb
onebox-1.5.43 lib/onebox/engine/slides_onebox.rb
onebox-1.5.42 lib/onebox/engine/slides_onebox.rb
onebox-1.5.41 lib/onebox/engine/slides_onebox.rb
onebox-1.5.40 lib/onebox/engine/slides_onebox.rb
onebox-1.5.39 lib/onebox/engine/slides_onebox.rb
onebox-1.5.38 lib/onebox/engine/slides_onebox.rb
onebox-1.5.37 lib/onebox/engine/slides_onebox.rb
onebox-1.5.36 lib/onebox/engine/slides_onebox.rb
onebox-1.5.35 lib/onebox/engine/slides_onebox.rb
onebox-1.5.34 lib/onebox/engine/slides_onebox.rb