module Nearmiss::Client::Categories
Methods for the Categories
API
Public Instance Methods
categories(options = {})
click to toggle source
List categories
@return [Array<Sawyer::Resource>] List of categories
# File lib/toolhound-ruby/client/categories.rb, line 11 def categories(options = {}) paginate "categories", options end
category(category, options={})
click to toggle source
Get a single category
@param category [String] ID of category to fetch @return [Sawyer::Resource] Category information
# File lib/toolhound-ruby/client/categories.rb, line 23 def category(category, options={}) get "categories/#{category}", options end
Also aliased as: cat
create_category(options = {})
click to toggle source
Create a category
@param options [Hash] Category information. @option options [String] :name e.g. Name of category @return [Sawyer::Resource] Newly created category info
# File lib/toolhound-ruby/client/categories.rb, line 34 def create_category(options = {}) post 'categories', options end
Also aliased as: create_cat
delete_category(category, options = {})
click to toggle source
Delete a category
@param category [String] Project ID @return [Boolean] Indicating success of deletion
# File lib/toolhound-ruby/client/categories.rb, line 62 def delete_category(category, options = {}) boolean_from_response :delete, "categories/#{category}", options end
edit_category(category, options = {})
click to toggle source
Edit a category
@param options [Hash] Project information. @option options [String] :name e.g. Tools
@return
[Sawyer::Resource] Edited category info
@example Update a category
@client.edit_category('some_id', { name: "New name of category", })
# File lib/toolhound-ruby/client/categories.rb, line 51 def edit_category(category, options = {}) patch "categories/#{category}", options end
Also aliased as: edit_cat