Class: BrickFTP::RESTfulAPI::StartUpload

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

Overview

Starting a new upload

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

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

The first request to upload a new file is a POST request to /files/PATH_AND_FILENAME.EXT with an action parameter with the value of put.

Parameters:

  • path (String)

    Full path of the file or folder. Maximum of 550 characters.

Returns:



21
22
23
24
25
# File 'lib/brick_ftp/restful_api/start_upload.rb', line 21

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

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