Sha256: 9618fd105da0d5a4c40be7ecf055b51c3e4b72e74fff326f8a57e12a2812b13a

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

# frozen_string_literal: true

class FreeQuoteFile < SatelliteAsset
  sunrise_uploader PickedFileUploader

  validates_filesize_of :data, maximum: 50.megabytes.to_i

  def thumb_url; end

  def delete
    nil
  end

  def remote_token
    data.try(:file).try(:public_token)
  end

  def as_json(options = nil)
    options = {
      root: false,
      only: [:id, :guid, :assetable_id, :assetable_type, :user_id, :public_token],
      methods: [:filename, :url, :thumb_url, :size, :content_type, :remote_token]
    }.merge(options || {})
    super(options)
  end

  def to_fileupload
    as_json
  end

  def remoteupload_klass
    TranslationCms::Api::Attachment
  end

  def self.fileupload_find_asset(params)
    find_by(remote_asset_id: params[:id])
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
translation_cms-0.1.5 app/models/media/free_quote_file.rb