Module: Jamf::BulkDeletable
- Included in:
- Building
- Defined in:
- lib/jamf/api/mixins/bulk_deletable.rb
Overview
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
Constant Summary collapse
- DELETE_MULTIPLE_ENDPOINT =
'delete-multiple'.freeze
Instance Method Summary collapse
-
#bulk_delete(ids, cnx: Jamf.cnx) ⇒ Array<Jamf::Connection::APIError::ErrorInfo] Info about any ids that failed to be deleted.
Delete multiple objects by providing an array of their.
Instance Method Details
#bulk_delete(ids, cnx: Jamf.cnx) ⇒ Array<Jamf::Connection::APIError::ErrorInfo] Info about any ids that failed to be deleted.
Delete multiple objects by providing an array of their
44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/jamf/api/mixins/bulk_deletable.rb', line 44 def bulk_delete(ids, cnx: Jamf.cnx) ids = [ids] unless ids.is_a? Array request_body = { ids: ids.map(&:to_s) } begin cnx.post "#{rsrc_path}/#{DELETE_MULTIPLE_ENDPOINT}", request_body [] rescue Jamf::Connection::APIError => e raise e unless e.httpStatus == 400 e.errors end end |