agoragames/amico — pull request #11 by twelvelabs (2012-08-23 20:56:39+00:00)
Title: Clear all relationships for a given key

Howdy!

This pull request adds Amico.clear, which clears all relationships (in either direction) for a user. The motivation for this is that my application allows users to delete their accounts, and I want to prevent orphaned IDs in the various sets (as well as keep the corresponding counts accurate).

In order to be able to clear out blocked and pending sets for other users, I need to add blocked_by and pending_with sets. I didn't create a full API interface for those sets since all I really needed them for was the clear method and I wanted to keep the diff as small as possible. I'm happy to add collection, count, and boolean methods if desired.