module Ohanakapa::Client::Categories

Methods for the Categories endpoint

@see ohanapi.herokuapp.com/api/docs

Public Instance Methods

categories(options={}) click to toggle source

List all categories

This provides a dump of every category, in the order that they were uploaded to the Ohana DB.

@see ohanapi.herokuapp.com/api/docs#!/api/GET-api-categories—format-_get_0

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

@example

Ohanakapa.categories

@example

Ohanakapa.cats
# File lib/ohanakapa/client/categories.rb, line 22
def categories(options={})
  paginate "categories", options
end
Also aliased as: cats
cats(options={})
Alias for: categories
replace_all_categories(service_id, cat_ids) click to toggle source

Replace all categories for a Service

@param service_id [String] Number ID of the service @param cat_ids [Array] An array of category IDs to use as replacement @return [<Sawyer::Resource>] The updated service @see ohanapi.herokuapp.com/api/docs @example Replace categories for service with ID '1'

Ohanakapa.replace_all_categories("1", ['101', '102'])
# File lib/ohanakapa/client/categories.rb, line 35
def replace_all_categories(service_id, cat_ids)
  put "services/#{service_id}/categories", :query => { :oe_ids => cat_ids }
end