Class: BrickFTP::RESTfulAPI::ContinueUpload

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/brick_ftp/restful_api/continue_upload.rb

Overview

Requesting additional upload URLs

Params

PARAMETER TYPE DESCRIPTION
ref string Unique identifier to reference this file upload. This identifier is needed for subsequent requests to the REST API to complete the upload or request more upload URLs.
part integer part number of multi part uploads.

Defined Under Namespace

Classes: Params

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

#call(path, params) ⇒ BrickFTP::Types::Upload

Once an upload has been opened and before it is completed, additional upload URLs can be requested from the REST API.

Send a POST request to /files/PATH_AND_FILENAME.EXT with parameter action set to put, parameter ref set to the reference ID returned at the start of the upload, and parameter part set to the part number the upload URL should refer to. The part number can be the same as one previously used if a new URL is required, either because the part is to be re-uploaded or because a prior upload attempt failed and the prior URL's signature has expired.

Parameters:

Returns:



43
44
45
46
47
# File 'lib/brick_ftp/restful_api/continue_upload.rb', line 43

def call(path, params)
  res = client.post("/api/rest/v1/files/#{ERB::Util.url_encode(path)}", params.to_h.compact.merge(action: 'put'))

  BrickFTP::Types::Upload.new(**res.symbolize_keys)
end