Class: RefMaterial
Class Method Summary
collapse
Instance Method Summary
collapse
#fileupload_destroy, #retrieve, #type_name, #upload, #uri, #url, #x_accel_url
Methods inherited from Asset
find_klass, #uri, #x_accel_url
Class Method Details
.destroy(params) ⇒ Object
11
12
13
14
15
16
17
18
19
|
# File 'app/models/media/ref_material.rb', line 11
def destroy(params)
{
files: [
remoteupload_klass.destroy(params).try(:attributes)
]
}
rescue JsonApiClient::Errors::ApiError
{ files: [] }
end
|
.remoteupload_klass ⇒ Object
Instance Method Details
#as_json(options = nil) ⇒ Object
30
31
32
33
34
35
36
37
|
# File 'app/models/media/ref_material.rb', line 30
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
|
#remote_token ⇒ Object
26
27
28
|
# File 'app/models/media/ref_material.rb', line 26
def remote_token
data.try(:file).try(:public_token)
end
|
#remoteupload_klass ⇒ Object
43
44
45
|
# File 'app/models/media/ref_material.rb', line 43
def remoteupload_klass
self.class.remoteupload_klass
end
|
#thumb_url ⇒ Object
8
|
# File 'app/models/media/ref_material.rb', line 8
def thumb_url; end
|
#to_fileupload ⇒ Object
39
40
41
|
# File 'app/models/media/ref_material.rb', line 39
def to_fileupload
as_json
end
|