-
Notifications
You must be signed in to change notification settings - Fork 30
JNUC2019 Lab Session J Deleting Things
Chris Lasell edited this page Oct 31, 2019
·
6 revisions
-
Let's 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
- It takes an array of ids, which we happen to have already in
- This is faster if you haven't fetched, because fetching an object can be slow
JSS::Computer.delete my_grp.member_ids
# => [568]
-
This method returns another array of the ids that it did not delete, because they didn't exist
-
In this case, that's the id of the individual one we deleted above