Sha256: fcf5d5abbae20d5ad373587254a177ee9f867ff1d88869a121f170fcd099b392

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

module DropboxApi::Endpoints::Files
  class Move < DropboxApi::Endpoints::Rpc
    Method      = :post
    Path        = "/2/files/move".freeze
    ResultType  = DropboxApi::Metadata::Resource
    ErrorType   = DropboxApi::Errors::RelocationError

    include DropboxApi::Endpoints::OptionsValidator

    # Move 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 moved.
    #
    # @param from [String] Path in the user's Dropbox to be copied or moved.
    # @param to [String] Path in the user's Dropbox that is the destination.
    # @option options autorename [Boolean] If there's a conflict, have the
    #   Dropbox server try to autorename the file to avoid the conflict. The
    #   default for this field is +false+.
    add_endpoint :move do |from, to, options = {}|
      # We're not implementing support for the `allow_shared_folder` option
      # because according to Dropbox's documentation: "This field is always
      # true for move".
      validate_options([
        :autorename
      ], options)

      perform_request options.merge({
        :from_path => from,
        :to_path => to
      })
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dropbox_api-0.1.10 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.9 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.8 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.7 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.6 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.5 lib/dropbox_api/endpoints/files/move.rb