Sha256: 46c62aae4bf0fd3831969de78c3b526d3bda9510e78f4d6e328fb1647f4d25bf

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 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::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

8 entries across 8 versions & 1 rubygems

Version Path
dropbox_api-0.1.18 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.17 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.16 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.15 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.14 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.13 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.12 lib/dropbox_api/endpoints/files/move.rb
dropbox_api-0.1.11 lib/dropbox_api/endpoints/files/move.rb