Class: Deeprails::Resources::Files

Inherits:
Object
  • Object
show all
Defined in:
lib/deeprails/resources/files.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Files

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Files.

Parameters:



32
33
34
# File 'lib/deeprails/resources/files.rb', line 32

def initialize(client:)
  @client = client
end

Instance Method Details

#upload(files:, request_options: {}) ⇒ Deeprails::Models::FileResponse

Use this endpoint to upload a file to the DeepRails API

Parameters:

  • files (Array<String>)

    The contents of the files to upload.

  • request_options (Deeprails::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/deeprails/resources/files.rb', line 17

def upload(params)
  parsed, options = Deeprails::FileUploadParams.dump_request(params)
  @client.request(
    method: :post,
    path: "files/upload",
    headers: {"content-type" => "multipart/form-data"},
    body: parsed,
    model: Deeprails::FileResponse,
    options: options
  )
end