Class: Increase::Resources::Files
- Inherits:
-
Object
- Object
- Increase::Resources::Files
- Defined in:
- lib/increase/resources/files.rb
Instance Method Summary collapse
-
#create(file: , purpose: , description: nil, request_options: {}) ⇒ Increase::Models::File
Some parameter documentations has been truncated, see Models::FileCreateParams for more details.
-
#initialize(client:) ⇒ Files
constructor
private
A new instance of Files.
-
#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.
-
#retrieve(file_id, request_options: {}) ⇒ Increase::Models::File
Retrieve a File.
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.
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.
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/increase/resources/files.rb', line 26 def create(params) parsed, = Increase::FileCreateParams.dump_request(params) @client.request( method: :post, path: "files", headers: {"content-type" => "multipart/form-data"}, body: parsed, model: Increase::File, 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
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/increase/resources/files.rb', line 80 def list(params = {}) parsed, = Increase::FileListParams.dump_request(params) @client.request( method: :get, path: "files", query: parsed, page: Increase::Internal::Page, model: Increase::File, options: ) end |
#retrieve(file_id, request_options: {}) ⇒ Increase::Models::File
Retrieve a File
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 |