Module: Jamf::BulkDeletable
- Included in:
- JComputerExtensionAttribute
- Defined in:
- lib/jamf/api/jamf_pro/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
-
#delete_multiple(ids, cnx: Jamf.cnx) ⇒ Array<Jamf::Connection::JamfProAPIError::ErrorInfo] Info about any ids that failed to be deleted.
(also: #bulk_delete)
Delete multiple objects by providing an array of their ids.
Instance Method Details
#delete_multiple(ids, cnx: Jamf.cnx) ⇒ Array<Jamf::Connection::JamfProAPIError::ErrorInfo] Info about any ids that failed to be deleted. Also known as: bulk_delete
Delete multiple objects by providing an array of their ids
TODO: fix this return value, no more ErrorInfo
28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/jamf/api/jamf_pro/mixins/bulk_deletable.rb', line 28 def delete_multiple(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::JamfProAPIError => e raise e unless e.httpStatus == 400 e.errors end end |