module Jamf::BulkDeletable

This mixin implements the …/delete-multiple endpoints that some collection resources have (and eventually all will??) It should be extended into classes representing those resources

Constants

DELETE_MULTIPLE_ENDPOINT

Public Instance Methods

bulk_delete(ids, cnx: Jamf.cnx) click to toggle source

Delete multiple objects by providing an array of their

@param ids [Array<String,Integer>] The ids to delete

@param cnx [Jamf::Connection] The connection to use, default: Jamf.cnx

TODO: fix this return value, no more ErrorInfo @return [Array<Jamf::Connection::JamfProAPIError::ErrorInfo] Info about any ids

that failed to be deleted.
   # File lib/jamf/api/jamf_pro/mixins/bulk_deletable.rb
45 def bulk_delete(ids, cnx: Jamf.cnx)
46   ids = [ids] unless ids.is_a? Array
47   request_body = { ids: ids.map(&:to_s) }
48 
49   begin
50     cnx.post "#{rsrc_path}/#{DELETE_MULTIPLE_ENDPOINT}", request_body
51     []
52   rescue Jamf::Connection::JamfProAPIError => e
53     raise e unless e.httpStatus == 400
54 
55     e.errors
56   end
57 end