module Nearmiss::Client::Categories

Methods for the Categories API

Public Instance Methods

cat(category, options={})
Alias for: category
categories(options = {}) click to toggle source

List categories

@return [Array<Sawyer::Resource>] List of categories

# File lib/nearmiss-ruby/client/categories.rb, line 11
def categories(options = {})
  paginate "categories", options
end
Also aliased as: list_categories, list_cats, cats
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/nearmiss-ruby/client/categories.rb, line 23
def category(category, options={})
  get "categories/#{category}", options
end
Also aliased as: cat
cats(options = {})
Alias for: categories
create_cat(options = {})
Alias for: create_category
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/nearmiss-ruby/client/categories.rb, line 34
def create_category(options = {})
  post 'categories', options
end
Also aliased as: create_cat
delete_cat(category, options = {})
Alias for: delete_category
delete_category(category, options = {}) click to toggle source

Delete a category

@param category [String] Project ID @return [Boolean] Indicating success of deletion

# File lib/nearmiss-ruby/client/categories.rb, line 62
def delete_category(category, options = {})
  boolean_from_response :delete, "categories/#{category}", options
end
edit_cat(category, options = {})
Alias for: edit_category
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/nearmiss-ruby/client/categories.rb, line 51
def edit_category(category, options = {})
  patch "categories/#{category}", options
end
Also aliased as: edit_cat
list_categories(options = {})
Alias for: categories
list_cats(options = {})
Alias for: categories
remove_cat(category, options = {})
Alias for: delete_category
remove_category(category, options = {})
Alias for: delete_category