class Uploadcare::Client::FileClient
API client for handling single files @see uploadcare.com/docs/api_reference/rest/accessing_files/ @see uploadcare.com/api-refs/rest-api/v0.5.0/#tag/File
Public Instance Methods
copy(**options)
click to toggle source
'copy' method is used to copy original files or their modified versions to default storage. Source files MAY either be stored or just uploaded and MUST NOT be deleted. @see uploadcare.com/api-refs/rest-api/v0.5.0/#operation/copyFile
# File lib/uploadcare/client/file_client.rb, line 27 def copy(**options) body = options.compact.to_json post(uri: '/files/', content: body) end
delete(uuid)
click to toggle source
@see uploadcare.com/api-refs/rest-api/v0.5.0/#operation/deleteFile
# File lib/uploadcare/client/file_client.rb, line 33 def delete(uuid) request(method: 'DELETE', uri: "/files/#{uuid}/") end
index()
click to toggle source
Gets list of files without pagination fields
# File lib/uploadcare/client/file_client.rb, line 12 def index response = get(uri: '/files/') response.fmap { |i| i[:results] } end
info(uuid)
click to toggle source
Acquire file info @see uploadcare.com/api-refs/rest-api/v0.5.0/#operation/fileInfo
# File lib/uploadcare/client/file_client.rb, line 19 def info(uuid) get(uri: "/files/#{uuid}/") end
Also aliased as: file
store(uuid)
click to toggle source
Store a single file, preventing it from being deleted in 2 weeks @see uploadcare.com/api-refs/rest-api/v0.5.0/#operation/storeFile
# File lib/uploadcare/client/file_client.rb, line 39 def store(uuid) put(uri: "/files/#{uuid}/storage/") end