Class: JSS::DockItem

Inherits:
APIObject show all
Includes:
Creatable, Updatable
Defined in:
lib/jss/api_object/dock_item.rb,
lib/jss.rb

Overview

A Dock Item in the JSS. These are rather simple. They have an ID, name, path, type, and contents which is read-only

See Also:

Constant Summary collapse

DOCK_ITEM_TYPE =

The Dock Item type

%w[
  App
  File
  Folder
].freeze
RSRC_BASE =

The base for REST resources of this class

'dockitems'.freeze
RSRC_LIST_KEY =

the hash key used for the JSON list output of all objects in the JSS

:dock_items
RSRC_OBJECT_KEY =

The hash key used for the JSON object output. It's also used in various error messages

:dock_item

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ DockItem

Constructor

See Also:

  • APIObject.initialize


89
90
91
92
93
94
95
# File 'lib/jss/api_object/dock_item.rb', line 89

def initialize(args = {})
  super args

  @type = 'App' if @init_data[:type].nil?
  @type = @init_data[:type]
  @path = @init_data[:path]
end

Instance Attribute Details

#idObject (readonly)

Attributes



81
82
83
# File 'lib/jss/api_object/dock_item.rb', line 81

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



82
83
84
# File 'lib/jss/api_object/dock_item.rb', line 82

def name
  @name
end

#need_to_updateBoolean (readonly) Originally defined in module Updatable

Returns do we have unsaved changes?.

Returns:

  • (Boolean)

    do we have unsaved changes?

#pathObject

Returns the value of attribute path.



84
85
86
# File 'lib/jss/api_object/dock_item.rb', line 84

def path
  @path
end

#typeObject

Returns the value of attribute type.



83
84
85
# File 'lib/jss/api_object/dock_item.rb', line 83

def type
  @type
end

Instance Method Details

#clone(new_name, api: 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

  • api (JSS::APIConnection) (defaults to: nil)

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

Returns:

  • (APIObject)

    An uncreated clone of this APIObject with the given name

Raises:

#createInteger Originally defined in module Creatable

Create a new object in the JSS.

Parameters:

  • api (JSS::APIConnection)

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

Returns:

  • (Integer)

    the jss ID of the newly created object

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:

#updateBoolean Originally defined in module Updatable

Save changes to the JSS

Returns:

  • (Boolean)

    success

Raises: