Class: PickedFile

Inherits:
SatelliteAsset show all
Defined in:
app/models/media/picked_file.rb

Instance Method Summary collapse

Methods inherited from SatelliteAsset

#fileupload_destroy, #retrieve, #type_name, #upload, #uri, #url, #x_accel_url

Methods inherited from Asset

find_klass, #uri, #x_accel_url

Instance Method Details

#as_json(options = nil) ⇒ Object



18
19
20
21
22
23
24
25
# File 'app/models/media/picked_file.rb', line 18

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

#deleteObject



10
11
12
# File 'app/models/media/picked_file.rb', line 10

def delete
  nil
end

#remote_tokenObject



14
15
16
# File 'app/models/media/picked_file.rb', line 14

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

#remoteupload_klassObject



31
32
33
# File 'app/models/media/picked_file.rb', line 31

def remoteupload_klass
  TranslationCms::Api::Materials::Attachment
end

#thumb_urlObject



8
# File 'app/models/media/picked_file.rb', line 8

def thumb_url; end

#to_fileuploadObject



27
28
29
# File 'app/models/media/picked_file.rb', line 27

def to_fileupload
  as_json
end