Class: Increase::Resources::Files
- Inherits:
-
Object
- Object
- Increase::Resources::Files
- Defined in:
- lib/increase/resources/files.rb
Instance Method Summary collapse
-
#create(params = {}, opts = {}) ⇒ Increase::Models::File
To upload a file to Increase, you'll need to send a request of Content-Type
multipart/form-data
. -
#initialize(client:) ⇒ Files
constructor
A new instance of Files.
-
#list(params = {}, opts = {}) ⇒ Increase::Page<Increase::Models::File>
List Files.
-
#retrieve(file_id, opts = {}) ⇒ Increase::Models::File
Retrieve a File.
Constructor Details
#initialize(client:) ⇒ Files
Returns a new instance of Files.
6 7 8 |
# File 'lib/increase/resources/files.rb', line 6 def initialize(client:) @client = client end |
Instance Method Details
#create(params = {}, opts = {}) ⇒ Increase::Models::File
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.
24 25 26 27 28 29 30 31 |
# File 'lib/increase/resources/files.rb', line 24 def create(params = {}, opts = {}) req = {} req[:method] = :post req[:path] = "/files" req[:body] = params req[:model] = Increase::Models::File @client.request(req, opts) end |
#list(params = {}, opts = {}) ⇒ Increase::Page<Increase::Models::File>
List Files
63 64 65 66 67 68 69 70 71 |
# File 'lib/increase/resources/files.rb', line 63 def list(params = {}, opts = {}) req = {} req[:method] = :get req[:path] = "/files" req[:query] = params req[:page] = Increase::Page req[:model] = Increase::Models::File @client.request(req, opts) end |
#retrieve(file_id, opts = {}) ⇒ Increase::Models::File
Retrieve a File
39 40 41 42 43 44 45 |
# File 'lib/increase/resources/files.rb', line 39 def retrieve(file_id, opts = {}) req = {} req[:method] = :get req[:path] = "/files/#{file_id}" req[:model] = Increase::Models::File @client.request(req, opts) end |