Skip to content

JNUC2019 Lab Session J Deleting Things

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

Hands On, Real-time Classic API Using ruby-jss

(Home)

Lab Session Contents - 9 - Deleting Things

Previous           TOC           Next


  • Let's now delete the 5 computers we created for the lab

  • There are two ways to delete API objects in ruby-jss

  1. 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
  1. 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 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


Previous           TOC           Next

Clone this wiki locally