-
Notifications
You must be signed in to change notification settings - Fork 30
JNUC2019 Lab Session J Deleting Things
Chris Lasell edited this page Oct 4, 2019
·
6 revisions
-
Lets now delete the 5 computers we created for the lab
-
There are two ways to delete API objects in ruby-jss
-
If you already have a fetched instance of the object, you can just call its
delete
method -
Lets delete the computer we just fetched a moment ago
comp_to_check.delete
# => nil
-
If you haven't fetched the thing yet, you can use the
delete
method on the class itself -
It takes an array of ids, which we happen to have already in
group.member_ids
-
This is faster because fetching an object can be slow
JSS::Computer.delete group.member_ids
# => [568]
-
This method returns an array of the ids that it did not delete, because they didn't exist.
-
In this case, thats the id of the individual one we just deleted above.