Class: DropboxApi::Endpoints::Files::Delete

Inherits:
Rpc
  • Object
show all
Includes:
OptionsValidator
Defined in:
lib/dropbox_api/endpoints/files/delete.rb

Constant Summary collapse

Method =
:post
Path =
'/2/files/delete'
ResultType =
DropboxApi::Metadata::Resource
ErrorType =
DropboxApi::Errors::DeleteError

Instance Method Summary collapse

Methods included from OptionsValidator

#validate_options

Methods inherited from Rpc

#build_connection, #build_request, #request_body

Methods inherited from Base

add_endpoint, #initialize

Constructor Details

This class inherits a constructor from DropboxApi::Endpoints::Base

Instance Method Details

#delete(path, options = {}) ⇒ Object

Delete the file or folder at a given path.

If the path is a folder, all its contents will be deleted too.

A successful response indicates that the file or folder was deleted. The returned metadata will be the corresponding Metadata::File or Metadata::Folder for the item at time of deletion, and not a Metadata::Deleted object.

Parameters:

  • path (String)

    Path in the user's Dropbox to delete.

Options Hash (options):

  • parent_rev (String)

    Perform delete if given "rev" matches the existing file's latest "rev". This field does not support deleting a folder. If the given "rev" doesn't match, a DropboxApi::Errors::FileConflictError will be raised.



25
26
27
28
29
30
31
# File 'lib/dropbox_api/endpoints/files/delete.rb', line 25

add_endpoint :delete do |path, options = {}|
  validate_options([:parent_rev], options)

  perform_request options.merge({
    path: path
  })
end