Class: Jamf::Script

Inherits:
CollectionResource show all
Includes:
ChangeLog, Referable
Defined in:
lib/jamf/api/resources/collection_resources/script.rb

Overview

A building defined in the JSS

Constant Summary collapse

RSRC_PATH =

Constants

'scripts'.freeze
RSRC_VERSION =
'v1'.freeze
PRIORITY_BEFORE =
'BEFORE'.freeze
PRIORITY_AFTER =
'AFTER'.freeze
PRIORITY_AT_REBOOT =
'AT_REBOOT'.freeze
PRIORTIES =
[
  PRIORITY_BEFORE,
  PRIORITY_AFTER,
  PRIORITY_AT_REBOOT
].freeze
OBJECT_MODEL =

Object Model / Attributes See APIObject class documentation for details of how the OBJECT_MODEL hash works.

{

  # @!attribute [r] id
  #   @return [Integer]
  id: {
    class: :integer,
    identifier: :primary,
    readonly: true
  },

  # @!attribute name
  #   @return [String]
  name: {
    class: :string,
    identifier: true
  },

  # @!attribute info
  #   @return [String]
  info: {
    class: :string
  },

  # @!attribute notes
  #   @return [String]
  notes: {
    class: :string
  },

  # @!attribute priority
  #   @return [String]
  priority: {
    class: :string,
    enum: Jamf::Script::PRIORTIES
  },

  # TODO: Jamf should standardize object references
  # this should be a Category::Reference object

  # @!attribute categoryId
  #   @return [Integer]
  categoryId: {
    class: :integer
  },

  # @!attribute categoryName
  #   @return [String]
  categoryName: {
    class: :string
  },

  # @!attribute osRequirements
  #   @return [String]
  osRequirements: {
    class: :string
  },

  # @!attribute scriptContents
  #   @return [String]
  scriptContents: {
    class: :string,
    validate: :script_contents,
    aliases: %i[code]
  },

  # @!attribute parameter4
  #   @return [String]
  parameter4: {
    class: :string
  },

  # @!attribute parameter5
  #   @return [String]
  parameter5: {
    class: :string
  },

  # @!attribute parameter6
  #   @return [String]
  parameter6: {
    class: :string
  },

  # @!attribute parameter7
  #   @return [String]
  parameter7: {
    class: :string
  },

  # @!attribute parameter8
  #   @return [String]
  parameter8: {
    class: :string
  },

  # @!attribute parameter9
  #   @return [String]
  parameter9: {
    class: :string
  },

  # @!attribute parameter10
  #   @return [String]
  parameter10: {
    class: :string
  },

  # @!attribute parameter11
  #   @return [String]
  parameter11: {
    class: :string
  }
}.freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Jamf::JSONObject

Instance Attribute Details

#categoryIdInteger

Returns:

  • (Integer)


# File 'lib/jamf/api/resources/collection_resources/script.rb', line 101

#categoryNameString

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 107

#idInteger (readonly)

Returns:

  • (Integer)


# File 'lib/jamf/api/resources/collection_resources/script.rb', line 64

#infoString

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 79

#nameString

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 72

#notesString

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 85

#osRequirementsString

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 113

#parameter10String

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 163

#parameter11String

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 169

#parameter4String

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 127

#parameter5String

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 133

#parameter6String

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 139

#parameter7String

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 145

#parameter8String

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 151

#parameter9String

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 157

#priorityString

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 91

#scriptContentsString

Returns:



# File 'lib/jamf/api/resources/collection_resources/script.rb', line 119

Class Method Details

.scriptContents(scr_ident, cnx: Jamf.cnx) ⇒ Object

Class Methods



182
183
184
185
186
# File 'lib/jamf/api/resources/collection_resources/script.rb', line 182

def self.scriptContents(scr_ident, cnx: Jamf.cnx)
  id = valid_id scr_ident
  raise Jamf::NoSuchItemError, "No script matches '#{scr_ident}'" unless id
  cnx.download "#{RSRC_VERSION}/#{RSRC_PATH}/#{id}/download"
end

Instance Method Details

#add_change_log_note(note, cnx: Jamf.cnx) ⇒ void Originally defined in module ChangeLog

This method returns an undefined value.

Add a note to this resource’s change log.

If the change history has been cached already, it is recached after adding the note.

Parameters:

  • note (String)

    The note to add. It cannot be empty.

#change_log(refresh = false, cnx: Jamf.cnx) ⇒ Array<Jamf::ChangeHistoryEntry> Originally defined in module ChangeLog

The change and note history for this resource.

The history is cached internally and only re-fetched when a truthy parameter is given.

Parameters:

  • refresh (Boolean) (defaults to: false)

    re-fetch and re-cache the history

Returns:

  • (Array<Jamf::ChangeHistoryEntry>)

    The change and note history for this resource

#referenceself.class::GenericReference Originally defined in module Referable

Returns A reference to this object.

Returns:

  • (self.class::GenericReference)

    A reference to this object.