module FileboundClient::Endpoints::Projects
Module for Projects
resource endpoint
Public Class Methods
This will call macros to create resource methods on the fly
# File lib/filebound_client/endpoints/projects.rb, line 6 def self.included(klass) klass.instance_eval do allow_new :project allow_all :projects end end
Public Instance Methods
Retrieves a single project by its key @param [int] project_id the project key @param [Hash] query_params additional query params to send in the request @return [Project] project object
# File lib/filebound_client/endpoints/projects.rb, line 17 def project(project_id, query_params = nil) get("/projects/#{project_id}", query_params) end
Adds a project. The project.ProjectId must be nil or 0. @param [Project] project the project to add @return [int] the id of the newly created project @example Add a project
c = FileboundClient::Client.connect(host: url, username: 'username', password: 'password', use_ntlm: true, ntlm_user: 'ntlm_user', ntlm_password: 'ntlm_password', ntlm_domain: 'ntlm_domain') c.project_add(ProjectId: nil, Name: 'Test API Project', ProjectType: 'HR')
# File lib/filebound_client/endpoints/projects.rb, line 96 def project_add(project) raise Client::FileboundClientException.new('Id is required', 0) if project[:projectId].greater_than_zero? put('/projects', nil, project) end
Retrieves assignments for a project @param [int] project_id the project key @param [Hash] query_params additional query params to send in the request (optional params: filter(String)) @return [Array] array of assignments
# File lib/filebound_client/endpoints/projects.rb, line 75 def project_assignments(project_id, query_params = nil) get_project_children(project_id, __method__, query_params) end
Deletes a project @param [int] project_id the project key of the project to delete @return [bool] true if deleting the project was successful
# File lib/filebound_client/endpoints/projects.rb, line 149 def project_delete(project_id) delete("/projects/#{project_id}") end
Adds a divider to a project @param [int] project_id the project key to add the divider to @param [Hash] divider the divider hash to add to the project @return [int] the divider id
# File lib/filebound_client/endpoints/projects.rb, line 118 def project_divider_add(project_id, divider) put("/projects/#{project_id}/dividers", nil, divider) end
Retrieves dividers for a project @param [int] project_id the project key @param [Hash] query_params additional query params to send in the request (optional params: filter(String)) @return [Array] array of dividers
# File lib/filebound_client/endpoints/projects.rb, line 50 def project_dividers(project_id, query_params = nil) get_project_children(project_id, __method__, query_params) end
Retrieves fields for a project @param [int] project_id the project key @param [Hash] query_params additional query params to send in the request (optional params: filter(String),
includeProjectLinkOptions(bool))
@return [Array] array of fields
# File lib/filebound_client/endpoints/projects.rb, line 26 def project_fields(project_id, query_params = nil) get_project_children(project_id, __method__, query_params) end
Adds a file to a project @param [int] project_id the project key to add the file to @param [Hash] file the file hash to add @return [int] the file id created
# File lib/filebound_client/endpoints/projects.rb, line 134 def project_file_add(project_id, file) put("/projects/#{project_id}/files", nil, file) end
Retrieves files for a project @param [int] project_id the project key @param [Hash] query_params additional query params to send in the request (optional params: filter(String)) @return [Array] array of files
# File lib/filebound_client/endpoints/projects.rb, line 34 def project_files(project_id, query_params = nil) get_project_children(project_id, __method__, query_params) end
Adds an array of files to a project @param [int] project_id the project key to add the files to @param [Array] files the array of file hashes to add @return [Hash] true if adding the files was successful
# File lib/filebound_client/endpoints/projects.rb, line 142 def project_files_add(project_id, files) put("/projects/#{project_id}/listfiles", nil, files) end
Retrieves groups for a project @param [int] project_id the project key @param [Hash] query_params additional query params to send in the request (optional params: filter(String)) @return [Array] array of groups
# File lib/filebound_client/endpoints/projects.rb, line 42 def project_groups(project_id, query_params = nil) get_project_children(project_id, __method__, query_params) end
Retrieves routed items for a project @param [int] project_id the project key @param [Hash] query_params additional query params to send in the request (optional params: filter(String),
userId(int), type(int))
@return [Array] array of routed items
# File lib/filebound_client/endpoints/projects.rb, line 59 def project_routeditems(project_id, query_params = nil) get_project_children(project_id, __method__, query_params) end
Retrieves routes for a project @param [int] project_id the project key @param [Hash] query_params additional query params to send in the request (optional params: filter(String),
xml(bool), hiddenRoutes(bool))
@return [Array] array of routes
# File lib/filebound_client/endpoints/projects.rb, line 84 def project_routes(project_id, query_params = nil) get_project_children(project_id, __method__, query_params) end
Adds a separator to a project @param [int] project_id the project key to add the separator to @param [Hash] separator the separator hash to add to the project @return [int] the separator id
# File lib/filebound_client/endpoints/projects.rb, line 126 def project_separator_add(project_id, separator) put("/projects/#{project_id}/separators", nil, separator) end
Retrieves separators for a project @param [int] project_id the project key @param [Hash] query_params additional query params to send in the request (optional params: filter(String)) @return [Array] array of separators
# File lib/filebound_client/endpoints/projects.rb, line 67 def project_separators(project_id, query_params = nil) get_project_children(project_id, __method__, query_params) end
Edits a project. The project.ProjectId must be not nil and > 0. @param [Hash] project the project to edit @return [int] the project id updated @example Update an existing project
c = FileboundClient::Client.connect(host: url, username: 'username', password: 'password', use_ntlm: true, ntlm_user: 'ntlm_user', ntlm_password: 'ntlm_password', ntlm_domain: 'ntlm_domain') c.project_update(ProjectId: 165, Name: 'Test API Project', ProjectType: 'HR', EnableMultiKeySearch: true)
# File lib/filebound_client/endpoints/projects.rb, line 109 def project_update(project) raise Client::FileboundClientException.new('Id is required', 0) unless project[:projectId].greater_than_zero? put('/projects', nil, project) end
Private Instance Methods
# File lib/filebound_client/endpoints/projects.rb, line 155 def get_project_children(project_id, child_name, query_params = nil) get("/projects/#{project_id}/#{child_name.to_s.split('_')[1]}", query_params) end