Sha256: 9305f0eea5435cec1940b8aeb61a2b253ffde8f2d0f1a4c2c134e2c8179b410b

Contents?: true

Size: 725 Bytes

Versions: 7

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

module Onebox
  module Engine
    class GoogleDriveOnebox
      include Engine
      include StandardEmbed
      include LayoutSupport

      matches_regexp(/^(https?:)?\/\/(drive\.google\.com)\/file\/d\/(?<key>[\w-]*)\/.+$/)
      always_https

      protected

      def data
        og_data = get_opengraph
        title = og_data.title || "Google Drive"
        title = "#{og_data.title} (video)" if og_data.type =~ /^video[\/\.]/
        description = og_data.description || "Google Drive file."

        {
          link: link,
          title: title,
          description: Onebox::Helpers.truncate(description, 250),
          image: og_data.image
        }
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
onebox-2.2.19 lib/onebox/engine/google_drive_onebox.rb
onebox-2.2.18 lib/onebox/engine/google_drive_onebox.rb
onebox-2.2.17 lib/onebox/engine/google_drive_onebox.rb
onebox-2.2.16 lib/onebox/engine/google_drive_onebox.rb
onebox-2.2.15 lib/onebox/engine/google_drive_onebox.rb
onebox-2.2.14 lib/onebox/engine/google_drive_onebox.rb
onebox-2.2.13 lib/onebox/engine/google_drive_onebox.rb