Sha256: 04327d910d062c22824584e12bce49f9152cf5e664ab74e952c79e4f92ae208f

Contents?: true

Size: 774 Bytes

Versions: 70

Compression:

Stored size: 774 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."

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

Version data entries

70 entries across 70 versions & 1 rubygems

Version Path
onebox-2.1.0 lib/onebox/engine/google_drive_onebox.rb
onebox-2.0.2 lib/onebox/engine/google_drive_onebox.rb
onebox-2.0.1 lib/onebox/engine/google_drive_onebox.rb
onebox-2.0.0 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.30 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.29 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.28.4 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.28.3 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.28.2 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.28.1 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.28 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.27.2 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.27.1 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.26 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.25 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.24 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.23 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.22 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.21 lib/onebox/engine/google_drive_onebox.rb
onebox-1.9.20 lib/onebox/engine/google_drive_onebox.rb