module Nearmiss::Client::Projects
Methods for the Projects
API
Public Instance Methods
Create a project
@param options [Hash] Project
information. @option options [String] :name e.g. Berkeley Art Museum @option options [String] :project_id e.g. 10611.70 @return [Sawyer::Resource] Newly created project info
# File lib/nearmiss-ruby/client/projects.rb, line 33 def create_project(options = {}) post 'projects', options end
Delete a project
@param project [String] Project
ID @return [Boolean] Indicating success of deletion
# File lib/nearmiss-ruby/client/projects.rb, line 60 def delete_project(project, options = {}) boolean_from_response :delete, "projects/#{project}", options end
Edit a project
@param options [Hash] Project
information. @option options [String] :name e.g. Berkeley Art Museum @option options [String] :project_id e.g. 10611.70
@return
[Sawyer::Resource] Newly created project info
@example Update a project
@client.edit_project('some_id', { name: "New name of project", project_id: "1043.32" })
# File lib/nearmiss-ruby/client/projects.rb, line 51 def edit_project(project, options = {}) patch "#{project_path(project)}", options end
Get a single project
@param project [String] UUID of project to fetch @return [Sawyer::Resource] Project
information
# File lib/nearmiss-ruby/client/projects.rb, line 23 def project(project, options = {}) get "#{project_path(project)}", options end
List projects
@note Shows a list of projects for the users organization aka account
@return [Array<Sawyer::Resource>] List of projects
# File lib/nearmiss-ruby/client/projects.rb, line 13 def projects(options = {}) paginate "projects", options end
Private Instance Methods
# File lib/nearmiss-ruby/client/projects.rb, line 67 def project_path(id) if uuid?(id) "projects/#{id}" else "project/#{id}" end end