Class: Jamf::Category

Inherits:
APIObject show all
Includes:
Creatable, Updatable
Defined in:
lib/jamf/api/classic/api_objects/category.rb

Overview

A Category in the JSS.

See Also:

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
NO_CATEGORY_NAME =

When no category has been assigned, this is the ‘name’ and id used

Jamf::Categorizable::NO_CATEGORY_NAME
NO_CATEGORY_ID =
Jamf::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
OBJECT_HISTORY_OBJECT_TYPE =

the object type for this object in the object history table. See APIObject#add_object_history_entry

72

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ Category

See Jamf::APIObject#initialize



103
104
105
106
# File 'lib/jamf/api/classic/api_objects/category.rb', line 103

def initialize(**args)
  super
  @priority = @init_data[:priority] || DEFAULT_PRIORITY
end

Instance Attribute Details

#need_to_updateBoolean (readonly) Originally defined in module Updatable

Returns do we have unsaved changes?.

Returns:

  • (Boolean)

    do we have unsaved changes?

#priorityInteger

Returns the SelfService priority for this category.

Returns:

  • (Integer)

    the SelfService priority for this category



96
97
98
# File 'lib/jamf/api/classic/api_objects/category.rb', line 96

def priority
  @priority
end

Class Method Details

.category_id_from_name(name, api: nil, cnx: Jamf.cnx) ⇒ Object

Class Methods



53
54
55
56
57
58
59
# File 'lib/jamf/api/classic/api_objects/category.rb', line 53

def self.category_id_from_name(name, api: nil, cnx: Jamf.cnx)
  cnx = api if api
  return nil if name.nil?
  return nil if name.casecmp(Jamf::Category::NO_CATEGORY_NAME).zero?

  Jamf::Category.map_all_ids_to(:name, cnx: cnx).invert[name]
end

Instance Method Details

#clone(new_name, api: nil, cnx: nil) ⇒ APIObject Originally defined in module Creatable

make a clone of this API object, with a new name. The class must be creatable

Parameters:

  • name (String)

    the name for the new object

  • cnx (Jamf::Connection) (defaults to: nil)

    the API in which to create the object Defaults to the API used to instantiate this object

Returns:

  • (APIObject)

    An unsaved clone of this APIObject with the given name

Raises:

#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.

Parameters:

  • newname (String)

    the new name

Raises: