Method: Jamf::Uploadable#upload

Defined in:
lib/jamf/api/classic/api_objects/uploadable.rb

#upload(type, local_file, force_ipa_upload: false) ⇒ Boolean

instance method wrapper for class method

Upload a file to the JSS to be stored with this instance of the class mixing in the Uploadable module

Parameters:

  • type (Symbol)

    the type of upload happening. Must be one of the keys defined in the class’s UPLOAD_TYPES Hash.

  • local_file (String, Pathname)

    String or Pathname pointing to the locally-readable file to be uploaded.

  • force_ipa_upload (Boolean) (defaults to: false)

    Should the server upload the .ipa file to JCDS or AWS if such are confgured for use?

Returns:

  • (Boolean)

    was the upload successful?

Raises:



171
172
173
174
175
176
# File 'lib/jamf/api/classic/api_objects/uploadable.rb', line 171

def upload(type, local_file, force_ipa_upload: false)
  # the thing's gotta be in the JSS, and have an @id
  raise Jamf::NoSuchItemError, "Create this #{self.class::RSRC_OBJECT_KEY} in the JSS before uploading files to it." unless @id && @in_jss

  self.class.upload @id, type, local_file, force_ipa_upload: force_ipa_upload, cnx: @cnx
end