knpuniversity/rest — pull request #27 by weaverryan (2014-11-06 23:33:13+00:00)
Title: Hal cleanup finish

Hiya!

In the previous sections, we did a lot: we added HATEOAS, which gave us Hal. But we haven't explored this format too much. The point of this section is to step back, use the Hal Browser to see how things feel and identify some issues. For example, before this, we weren't using the `CollectionResource`, so the returned format wasn't really valid.

Steps:

1) Install hal browser (I commit it for simplicity)
2) Reference mwop's docs about Hal: http://phlyrestfully.readthedocs.org/en/latest/halprimer.html
3) Update collection scenario to look for the proper Hal format
4) Add CollectionResource to make this a reality
5) Add collection for /programmers/{id}/battles
6) Add relation to battles from programmer
7) Add self to battle (and talk about relations)

One concern I have is the repetition of link `rels`. For example, if I have 5 model classes that all link the some collection of programmers, then all 5 will repeat the rel `programmers` in their annotation. Furthermore, if I want to add a nice `title` attribute (e.g. "A collection of programmers"), then that will need to be repeated across all of the `Relation` annotations as well. This is not a huge deal - I was just wondering if I'm overlooking anything (or over-reacting).

Thanks!