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

      # the type has to be defined in the class of self.
      raise JSS::InvalidDataError, "#{self.class::RSRC_LIST_KEY} only take uploads of type: :#{self.class::UPLOAD_TYPES.keys.join(', :')}." \
        unless self.class::UPLOAD_TYPES.keys.include? type

      # figure out the resource after the UPLOAD_RSRC_PREFIX
      upload_rsrc = "#{UPLOAD_RSRC_PREFIX}/#{self.class::UPLOAD_TYPES[type]}/id/#{@id}"

      # make a File object to hand to REST. 'rb' = read,binary
      file = File.new local_file.to_s, 'rb'

      # upload it!
      @api.cnx[upload_rsrc].post name: file
    end
def upload(type, local_file)
      # the thing's gotta be in the JSS, and have an @id
      raise JSS::NoSuchItemError, 'Create this #{self.class::RSRC_OBJECT_KEY} in the JSS before uploading files to it.' unless @id && @in_jss

      # the type has to be defined in the class of self.
      raise JSS::InvalidDataError, "#{self.class::RSRC_LIST_KEY} only take uploads of type: :#{self.class::UPLOAD_TYPES.keys.join(', :')}." \
        unless self.class::UPLOAD_TYPES.keys.include? type

      # figure out the resource after the UPLOAD_RSRC_PREFIX
      upload_rsrc = "#{UPLOAD_RSRC_PREFIX}/#{self.class::UPLOAD_TYPES[type]}/id/#{@id}"

      # make a File object to hand to REST. 'rb' = read,binary
      file = File.new local_file.to_s, 'rb'

      # upload it!
      @api.cnx[upload_rsrc].post name: file
    end
Variables


  Methods


 Upload a file to the JSS via the REST Resource of the
 object to which this module is mixed in.

 @param type[Symbol] the type of upload happening.
   Must be one of the keys defined in the class's UPLOAD_TYPES Hash.

 @param local_file[String, Pathname] String or Pathname pointing to the
   locally-readable file to be uploaded.

 @return [String] The xml response from the server.