module FileboundClient::Endpoints::Files
Module for Files
resource endpoint
Public Class Methods
This will call macros to create resource methods on the fly
# 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
Public Instance Methods
Retrieves a single file by its key @param [int] file_id the file key @param [Hash] query_params additional query params to send in the request (optional params: filter) @return [Hash] the file hash
# File lib/filebound_client/endpoints/files.rb, line 17 def file(file_id, query_params = nil) get("/files/#{file_id}", query_params) end
Adds a file @param [Hash] file the file hash to add @return [Hash] the newly added file hash
# File lib/filebound_client/endpoints/files.rb, line 48 def file_add(file) put('/files', nil, file) end
Adds a comment to file @param [int] file_id the file key @param [Hash] comment_data the comment to add @return [Hash] the newly added file comment hash
# 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
Retrieves file_id by specifying a project id and key value @param [int] project_id the project key @param [String] key_value the key value to search on @return [int] the file id
# 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
Returns the file comments for the supplied file key @param [int] file_id the file key @param [Hash] query_params the additional query params to send in the request
# 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
Deletes a file @param [int] file_id the file key @return [bool] true if the file deleted successfully
# File lib/filebound_client/endpoints/files.rb, line 64 def file_delete(file_id) delete("/files/#{file_id}") end
Retrieves all documents for the specified file key @param [int] file_id the file key @param [Hash] query_params additional query params to send in the request (optional params: filter) @return [Array] an array of document hashes
# 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
Updates a file @param [int] file_id the file key @param [Hash] file the file hash with updated fields @return [Hash] the updated file hash
# File lib/filebound_client/endpoints/files.rb, line 41 def file_update(file_id, file) post("files/#{file_id}", nil, file) end
Adds file based on project key value @param [int] project_id the project key value @param [String] key_value the key value @param [Hash] file the file hash with updated fields @return [Hash] the updated file hash
# 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