Class: Polar::Resources::Files
- Defined in:
- lib/polar/resources/files.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#create(attributes) ⇒ Hash
Create a file upload.
-
#delete(id) ⇒ Boolean
Delete a file.
-
#list(params = {}) ⇒ PaginatedResponse
List files.
-
#update(id, attributes) ⇒ Hash
Update file metadata.
-
#uploaded(id, completion_data = {}) ⇒ Hash
Mark file upload as completed.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Polar::Resources::Base
Instance Method Details
#create(attributes) ⇒ Hash
Create a file upload
25 26 27 28 |
# File 'lib/polar/resources/files.rb', line 25 def create(attributes) response = post('/files/', attributes) response.body end |
#delete(id) ⇒ Boolean
Delete a file
51 52 53 54 |
# File 'lib/polar/resources/files.rb', line 51 def delete(id) delete("/files/#{id}") true end |
#list(params = {}) ⇒ PaginatedResponse
List files
14 15 16 |
# File 'lib/polar/resources/files.rb', line 14 def list(params = {}) paginate('/files/', params) end |
#update(id, attributes) ⇒ Hash
Update file metadata
43 44 45 46 |
# File 'lib/polar/resources/files.rb', line 43 def update(id, attributes) response = patch("/files/#{id}", attributes) response.body end |
#uploaded(id, completion_data = {}) ⇒ Hash
Mark file upload as completed
34 35 36 37 |
# File 'lib/polar/resources/files.rb', line 34 def uploaded(id, completion_data = {}) response = post("/files/#{id}/uploaded", completion_data) response.body end |