sakaiproject/Hilary — pull request #124 by simong (2012-09-27 16:25:34+00:00)
Title: Groups REST implementation

This PR holds the REST implementation for Groups.
The group service API is now more consistent with the Content Service API.

All the group endpoints are wrapped in oae-tests/rest/*.

There are some things in this PR that do require a bit of feedback:
* The two tenants that get created on startup are now exposed on the `global` object. I'm not entirely sure if this is something that we should be doing? It's convenient, but it sort of feels like I'm opening Pandora's box here.

* The RestAPI requires a 'Context' object which is similar to the one that we use in oae-context, yet it is not the same. This could potentially be confusing? It does make it re-useable in a non-Hilary context (say the model loader)
* There are still a bunch of tests left in test-groups which I haven't ported too the RestAPI. At some point those should probably be ported. I found it way easier to deal with method signature changes if we abstract functionality such as `creating a group`, `creating a user`, .. It's the third time I've had to update something like createGroup which touches a lot of unit tests, it would be neet if we only had to do it in the RestAPI

An example of how to use the 'Rest API'
```javascript
// Require the API
var RestAPI = require('oae-tests/rest');

// Create a "context" that holds the url of tenant a userid and a password.
// This is so we know where to direct our HTTP requests to and can login if required.
var ctx = new RestAPI.Context(global.oaeTests.tenants.cam.baseUrl, 'u:cam:simong', 'password');

// Perform the actual request.
RestAPI.Groups.createGroup(ctx, 'The Avengers', 'The coolest group in the world', 'public', 'no', ['u:cam:nick_fury'], ['u:cam:the_hull'], {}, function(err, data) {
// ...
});
```