Module: FileboundClient::Endpoints::Files
- Defined in:
- lib/filebound_client/endpoints/files.rb
Overview
Module for Files resource endpoint
Class Method Summary collapse
-
.included(klass) ⇒ Object
This will call macros to create resource methods on the fly.
Instance Method Summary collapse
-
#file(file_id, query_params = nil) ⇒ Hash
Retrieves a single file by its key.
-
#file_add(file) ⇒ Hash
Adds a file.
-
#file_add_comment(file_id, comment_data, query_params = nil) ⇒ Hash
Adds a comment to file.
-
#file_by_key_value(project_id, key_value) ⇒ int
Retrieves file_id by specifying a project id and key value.
-
#file_comments(file_id, query_params = nil) ⇒ Object
Returns the file comments for the supplied file key.
-
#file_delete(file_id) ⇒ bool
Deletes a file.
-
#file_documents(file_id, query_params = nil) ⇒ Array
Retrieves all documents for the specified file key.
-
#file_update(file_id, file) ⇒ Hash
Updates a file.
-
#file_update_by_key_value(project_id, key_value, file) ⇒ Hash
Adds file based on project key value.
Class Method Details
.included(klass) ⇒ Object
This will call macros to create resource methods on the fly
6 7 8 9 10 11 |
# File 'lib/filebound_client/endpoints/files.rb', line 6 def self.included(klass) klass.instance_eval do allow_new :file allow_all :files end end |
Instance Method Details
#file(file_id, query_params = nil) ⇒ Hash
Retrieves a single file by its key
17 18 19 |
# File 'lib/filebound_client/endpoints/files.rb', line 17 def file(file_id, query_params = nil) get("/files/#{file_id}", query_params) end |
#file_add(file) ⇒ Hash
Adds a file
48 49 50 |
# File 'lib/filebound_client/endpoints/files.rb', line 48 def file_add(file) put('/files', nil, file) end |
#file_add_comment(file_id, comment_data, query_params = nil) ⇒ Hash
Adds a comment to file
79 80 81 |
# File 'lib/filebound_client/endpoints/files.rb', line 79 def file_add_comment(file_id, comment_data, query_params = nil) put("/files/#{file_id}/comments", nil, comment_data) end |
#file_by_key_value(project_id, key_value) ⇒ int
Retrieves file_id by specifying a project id and key value
33 34 35 |
# File 'lib/filebound_client/endpoints/files.rb', line 33 def file_by_key_value(project_id, key_value) get("/files/#{project_id}/ByKeyValue", value: key_value) end |
#file_comments(file_id, query_params = nil) ⇒ Object
Returns the file comments for the supplied file key
71 72 73 |
# File 'lib/filebound_client/endpoints/files.rb', line 71 def file_comments(file_id, query_params = nil) get("/files/#{file_id}/comments", query_params) end |
#file_delete(file_id) ⇒ bool
Deletes a file
64 65 66 |
# File 'lib/filebound_client/endpoints/files.rb', line 64 def file_delete(file_id) delete("/files/#{file_id}") end |
#file_documents(file_id, query_params = nil) ⇒ Array
Retrieves all documents for the specified file key
25 26 27 |
# File 'lib/filebound_client/endpoints/files.rb', line 25 def file_documents(file_id, query_params = nil) get("/files/#{file_id}/documents", query_params) end |
#file_update(file_id, file) ⇒ Hash
Updates a file
41 42 43 |
# File 'lib/filebound_client/endpoints/files.rb', line 41 def file_update(file_id, file) post("files/#{file_id}", nil, file) end |
#file_update_by_key_value(project_id, key_value, file) ⇒ Hash
Adds file based on project key value
57 58 59 |
# File 'lib/filebound_client/endpoints/files.rb', line 57 def file_update_by_key_value(project_id, key_value, file) put("/files/#{project_id}/ByKeyValue", { value: key_value }, file) end |