class Kloudless::File
Public Class Methods
convert_id(account_id:, raw_id:, type:, params: {}, **data)
click to toggle source
# File lib/kloudless/file.rb, line 63 def self.convert_id(account_id:, raw_id:, type:, params: {}, **data) path = "/accounts/#{account_id}/storage/convert_id" data[:raw_id] = raw_id data[:type] = type http.post(path, params: params, data: data) end
copy(account_id:, file_id:, parent_id:, params: {}, **data)
click to toggle source
# File lib/kloudless/file.rb, line 42 def self.copy(account_id:, file_id:, parent_id:, params: {}, **data) path = "/accounts/#{account_id}/storage/files/#{file_id}/copy" data[:parent_id] = parent_id new(http.post(path, params: params, data: data)) end
delete(account_id:, file_id:, **params)
click to toggle source
# File lib/kloudless/file.rb, line 48 def self.delete(account_id:, file_id:, **params) path = "/accounts/#{account_id}/storage/files/#{file_id}" new(http.delete(path, params: params)) end
download(account_id:, file_id:, **params)
click to toggle source
# File lib/kloudless/file.rb, line 37 def self.download(account_id:, file_id:, **params) path = "/accounts/#{account_id}/storage/files/#{file_id}/contents" http.get(path, params: params, parse_response: false) end
metadata(account_id:, file_id:, **params)
click to toggle source
# File lib/kloudless/file.rb, line 21 def self.metadata(account_id:, file_id:, **params) path = "/accounts/#{account_id}/storage/files/#{file_id}" new(http.get(path, params: params)) end
recent(account_ids:, **params)
click to toggle source
# File lib/kloudless/file.rb, line 53 def self.recent(account_ids:, **params) path = "/accounts/#{account_ids.join(',')}/storage/recent" Kloudless::Collection.new(self, http.get(path, params: params)) end
rename(account_id:, file_id:, params: {}, **data)
click to toggle source
# File lib/kloudless/file.rb, line 26 def self.rename(account_id:, file_id:, params: {}, **data) path = "/accounts/#{account_id}/storage/files/#{file_id}" new(http.patch(path, params: params, data: data)) end
search(account_ids:, **params)
click to toggle source
# File lib/kloudless/file.rb, line 58 def self.search(account_ids:, **params) path = "/accounts/#{account_ids.join(',')}/storage/search" Kloudless::Collection.new(self, http.get(path, params: params)) end
update(account_id:, file_id:, data:)
click to toggle source
# File lib/kloudless/file.rb, line 31 def self.update(account_id:, file_id:, data:) path = "/accounts/#{account_id}/storage/files/#{file_id}" new(http.put(path, data: data, parse_request: false, headers: {'Content-Type' => 'application/octet-stream'})) end
upload(account_id:, data:, parent_id:, file_name:, **params)
click to toggle source
# File lib/kloudless/file.rb, line 6 def self.upload(account_id:, data:, parent_id:, file_name:, **params) headers = { 'X-Kloudless-Metadata' => {parent_id: parent_id, name: file_name}.to_json, 'Content-Type' => 'application/octet-stream' } path = "/accounts/#{account_id}/storage/files" new(http.post(path, params: params, data: data, headers: headers, parse_request: false)) end
upload_from_url(account_id:, params: {}, **data)
click to toggle source
# File lib/kloudless/file.rb, line 16 def self.upload_from_url(account_id:, params: {}, **data) path = "/accounts/#{account_id}/storage/files" new(http.post(path, params: params, data: data)) end