Class: JSS::Category
- Defined in:
- lib/jss/api_object/category.rb,
lib/jss.rb
Overview
A Category in the JSS.
Constant Summary collapse
- RSRC_BASE =
The base for REST resources of this class
'categories'.freeze
- RSRC_LIST_KEY =
the hash key used for the JSON list output of all objects in the JSS
:categories
- RSRC_OBJECT_KEY =
The hash key used for the JSON object output. It’s also used in various error messages
:category
- VALID_DATA_KEYS =
these keys, as well as :id and :name, are present in valid API JSON data for this class
[:priority].freeze
- NO_CATEGORY_NAME =
When no category has been assigned, this is the ‘name’ and id used
JSS::Categorizable::NO_CATEGORY_NAME
- NO_CATEGORY_ID =
JSS::Categorizable::NO_CATEGORY_ID
- DEFAULT_CATEGORY =
The Default category
NO_CATEGORY_NAME
- POSSIBLE_PRIORITIES =
The range of possible priorities
1..20
- DEFAULT_PRIORITY =
The Default Priority
5
Instance Attribute Summary collapse
-
#need_to_update ⇒ Boolean
included
from Updatable
readonly
Do we have unsaved changes?.
-
#priority ⇒ Integer
The SelfService priority for this category.
Class Method Summary collapse
-
.category_id_from_name(name) ⇒ Object
Class Methods.
Instance Method Summary collapse
-
#clone(new_name) ⇒ APIObject
included
from Creatable
make a clone of this API object, with a new name.
-
#create ⇒ Integer
included
from Creatable
Create a new object in the JSS.
-
#initialize(args = {}) ⇒ Category
constructor
See JSS::APIObject#initialize.
-
#name=(newname) ⇒ void
included
from Updatable
Change the name of this item Remember to #update to push changes to the server.
-
#update ⇒ Boolean
included
from Updatable
Save changes to the JSS.
Constructor Details
#initialize(args = {}) ⇒ Category
See JSS::APIObject#initialize
99 100 101 102 |
# File 'lib/jss/api_object/category.rb', line 99 def initialize(args = {}) super @priority = @init_data[:priority] || DEFAULT_PRIORITY end |
Instance Attribute Details
#need_to_update ⇒ Boolean (readonly) Originally defined in module Updatable
Returns do we have unsaved changes?.
#priority ⇒ Integer
Returns the SelfService priority for this category.
92 93 94 |
# File 'lib/jss/api_object/category.rb', line 92 def priority @priority end |
Class Method Details
.category_id_from_name(name) ⇒ Object
Class Methods
53 54 55 56 57 |
# File 'lib/jss/api_object/category.rb', line 53 def self.category_id_from_name(name) return nil if name.nil? return nil if name.casecmp(JSS::Category::NO_CATEGORY_NAME).zero? JSS::Category.map_all_ids_to(:name).invert[name] end |
Instance Method Details
#clone(new_name) ⇒ APIObject Originally defined in module Creatable
make a clone of this API object, with a new name. The class must be creatable
#create ⇒ Integer Originally defined in module Creatable
Create a new object in the JSS.
#name=(newname) ⇒ void Originally defined in module Updatable
This method returns an undefined value.
Change the name of this item Remember to #update to push changes to the server.
#update ⇒ Boolean Originally defined in module Updatable
Save changes to the JSS