Class: DropboxApi::Endpoints::Files::Copy

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

Constant Summary collapse

Method =
:post
Path =
'/2/files/copy'
ResultType =
DropboxApi::Metadata::Resource
ErrorType =
DropboxApi::Errors::RelocationError

Instance Method Summary collapse

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

#copy(from, to) ⇒ Object

Copy a file or folder to a different location in the user's Dropbox. If the source path is a folder all its contents will be copied.

Parameters:

  • from (String)

    Path in the user's Dropbox to be copied or moved.

  • to (String)

    Path in the user's Dropbox that is the destination.

Returns:

  • The moved file.



15
16
17
18
19
20
# File 'lib/dropbox_api/endpoints/files/copy.rb', line 15

add_endpoint :copy do |from, to|
  perform_request({
    from_path: from,
    to_path: to
  })
end