Class: Increase::Resources::Files

Inherits:
Object
  • Object
show all
Defined in:
lib/increase/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:



95
96
97
# File 'lib/increase/resources/files.rb', line 95

def initialize(client:)
  @client = client
end

Instance Method Details

#create(file: , purpose: , description: nil, request_options: {}) ⇒ Increase::Models::File

Some parameter documentations has been truncated, see Models::FileCreateParams for more details.

To upload a file to Increase, you’ll need to send a request of Content-Type ‘multipart/form-data`. The request should contain the file you would like to upload, as well as the parameters for creating a file.

Parameters:

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/increase/resources/files.rb', line 26

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

#list(created_at: nil, cursor: nil, idempotency_key: nil, limit: nil, purpose: nil, request_options: {}) ⇒ Increase::Internal::Page<Increase::Models::File>

Some parameter documentations has been truncated, see Models::FileListParams for more details.

List Files

Parameters:

Returns:

See Also:



80
81
82
83
84
85
86
87
88
89
90
# File 'lib/increase/resources/files.rb', line 80

def list(params = {})
  parsed, options = Increase::FileListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "files",
    query: parsed,
    page: Increase::Internal::Page,
    model: Increase::File,
    options: options
  )
end

#retrieve(file_id, request_options: {}) ⇒ Increase::Models::File

Retrieve a File

Parameters:

  • file_id (String)

    The identifier of the File.

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

Returns:

See Also:



49
50
51
52
53
54
55
56
# File 'lib/increase/resources/files.rb', line 49

def retrieve(file_id, params = {})
  @client.request(
    method: :get,
    path: ["files/%1$s", file_id],
    model: Increase::File,
    options: params[:request_options]
  )
end