Sha256: 1423e3d62c44715087f4144c43c4fe8c08a903f561268adf068dab7e82958aaf

Contents?: true

Size: 629 Bytes

Versions: 7

Compression:

Stored size: 629 Bytes

Contents

module Tessa::ActiveStorage
  class AssetWrapper < SimpleDelegator
    def id
      key
    end

    def public_url
      Rails.application.routes.url_helpers.
        rails_blob_url(__getobj__, disposition: :inline)
    end

    def private_url(expires_in: 1.day)
      service_url(disposition: :inline, expires_in: expires_in)
    end

    def private_download_url(expires_in: 1.day)
      service_url(disposition: 'attachment', expires_in: expires_in)
    end

    def meta
      {
        mime_type: content_type,
        size: byte_size,
        name: filename
      }
    end

    def failure?
      false
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tessa-1.2.3 lib/tessa/active_storage/asset_wrapper.rb
tessa-1.2.2 lib/tessa/active_storage/asset_wrapper.rb
tessa-2.0 lib/tessa/active_storage/asset_wrapper.rb
tessa-1.2.1 lib/tessa/active_storage/asset_wrapper.rb
tessa-1.2.0 lib/tessa/active_storage/asset_wrapper.rb
tessa-1.1.1 lib/tessa/active_storage/asset_wrapper.rb
tessa-1.1.0 lib/tessa/active_storage/asset_wrapper.rb