Skip to content

JNUC2019 Lab Session J Deleting Things

Chris Lasell edited this page Oct 4, 2019 · 6 revisions

Deleting Things

  • 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

comp_to_check.delete
# => nil
  • but if you haven't fetched the thing yet, you can use the delete method on the class itself, and pass it an array of ids
JSS::Computer.delete group.member_ids
# => [568]
  • When using this method, what you get back is 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.
Clone this wiki locally