Class: Uploadcare::Client::FileListClient

Inherits:
RestClient
  • Object
show all
Defined in:
lib/uploadcare/client/file_list_client.rb

Overview

API client for handling file lists

Instance Method Summary collapse

Methods inherited from RestClient

#api_root, #api_struct_delete, #api_struct_get, #api_struct_post, #api_struct_put, #delete, #get, #headers, #post, #put, #request

Methods included from Uploadcare::Concerns::ThrottleHandler

#handle_throttling

Methods included from Uploadcare::Concerns::ErrorHandler

#failure, #wrap

Instance Method Details

#batch_delete(uuids) ⇒ Object Also known as: delete_files

Delete several files by list of uids uuids: Array



36
37
38
39
# File 'lib/uploadcare/client/file_list_client.rb', line 36

def batch_delete(uuids)
  body = uuids.to_json
  request_delete(uri: '/files/storage/', content: body)
end

#batch_store(uuids) ⇒ Object Also known as: store_files

Make a set of files "stored". This will prevent them from being deleted automatically uuids: Array



26
27
28
29
# File 'lib/uploadcare/client/file_list_client.rb', line 26

def batch_store(uuids)
  body = uuids.to_json
  put(uri: '/files/storage/', content: body)
end

#file_list(options = {}) ⇒ Object Also known as: list

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: number of files skipped



18
19
20
21
# File 'lib/uploadcare/client/file_list_client.rb', line 18

def file_list(options = {})
  query = options.empty? ? '' : "?#{URI.encode_www_form(options)}"
  get(uri: "/files/#{query}")
end