Class: Uploadcare::Rails::Api::Rest::FileApi
- Defined in:
- lib/uploadcare/rails/api/rest/file_api.rb
Overview
A class that contains File related methods for Uploadcare REST API
Class Method Summary collapse
- .delete_file(uuid) ⇒ Object
-
.delete_files(uuids) ⇒ Object
Delete several files by list of uids uuids: Array.
-
.get_file(uuid) ⇒ Object
Acquire file info.
-
.get_files(options = {}) ⇒ Object
Returns a pagination json of files stored in project valid options: removed: [true|false] stored: [true|false] limit: (1..1000) ordering: [“datetime_uploaded”|“-datetime_uploaded”] from: A starting point for filtering files.
-
.local_copy_file(source, options = {}) ⇒ Object
‘local_copy’ method is used to copy original files or their modified versions to a default storage.
-
.remote_copy_file(source, target, options = {}) ⇒ Object
‘remote_copy’ method is used to copy original files or their modified versions to a custom storage.
-
.store_file(uuid) ⇒ Object
Store a single file, preventing it from being deleted in 2 weeks.
-
.store_files(uuids) ⇒ Object
Make a set of files “stored”.
Class Method Details
.delete_file(uuid) ⇒ Object
46 47 48 |
# File 'lib/uploadcare/rails/api/rest/file_api.rb', line 46 def delete_file(uuid) Uploadcare::File.delete(uuid) end |
.delete_files(uuids) ⇒ Object
Delete several files by list of uids uuids: Array
66 67 68 |
# File 'lib/uploadcare/rails/api/rest/file_api.rb', line 66 def delete_files(uuids) Uploadcare::FileList.batch_delete(uuids) end |
.get_file(uuid) ⇒ Object
Acquire file info
27 28 29 |
# File 'lib/uploadcare/rails/api/rest/file_api.rb', line 27 def get_file(uuid) Uploadcare::File.info(uuid) end |
.get_files(options = {}) ⇒ Object
Returns a pagination json of files stored in project valid options: removed: [true|false] stored: [true|false] limit: (1..1000) ordering: [“datetime_uploaded”|“-datetime_uploaded”] from: A starting point for filtering files. The value depends on your ordering parameter value.
21 22 23 |
# File 'lib/uploadcare/rails/api/rest/file_api.rb', line 21 def get_files( = {}) Uploadcare::FileList.file_list() end |
.local_copy_file(source, options = {}) ⇒ Object
‘local_copy’ method is used to copy original files or their modified versions to a default storage. Source files MAY either be stored or just uploaded and MUST NOT be deleted.
34 35 36 |
# File 'lib/uploadcare/rails/api/rest/file_api.rb', line 34 def local_copy_file(source, = {}) Uploadcare::File.local_copy(source, ) end |
.remote_copy_file(source, target, options = {}) ⇒ Object
‘remote_copy’ method is used to copy original files or their modified versions to a custom storage. Source files MAY either be stored or just uploaded and MUST NOT be deleted.
41 42 43 |
# File 'lib/uploadcare/rails/api/rest/file_api.rb', line 41 def remote_copy_file(source, target, = {}) Uploadcare::File.remote_copy(source, target, ) end |
.store_file(uuid) ⇒ Object
Store a single file, preventing it from being deleted in 2 weeks
52 53 54 |
# File 'lib/uploadcare/rails/api/rest/file_api.rb', line 52 def store_file(uuid) Uploadcare::File.store(uuid) end |
.store_files(uuids) ⇒ Object
Make a set of files “stored”. This will prevent them from being deleted automatically uuids: Array
59 60 61 |
# File 'lib/uploadcare/rails/api/rest/file_api.rb', line 59 def store_files(uuids) Uploadcare::FileList.batch_store(uuids) end |