Refactor API code to use annotator-store flaskless

Everything seems to work: reading, creating, updating, deleting, searching, permissions seem to work but need better testing, and in general more tests and thorough code review would be good.

To keep a consistent style and make refactoring easier, I decided to use traversal with a `@view_defaults` class everywhere, using the defaults class to specify the `context` predicate, so as to group the views within that. For the same reasons I do not use view names but use a resource for each location (I explictly state `name=''` for clarity, though that could be removed). I think this style works out nicely.

I put some questions in the comments, just search for the question marks.

The dependency on the next (flaskless) annotator-store version has yet to be added.

<!---
@huboard:{"order":1346.7445068359375,"milestone_order":1300,"custom_state":""}
-->

Not if it's done in annotator-store.
On Nov 5, 2014 2:44 PM, "Gerben" <notifications@github.com> wrote:

> In tests/unit/test_api.py:
>
> > +    links = result['links']
> > +    assert links['annotation']['create']['method'] == 'POST'
> > +    assert links['annotation']['create']['url'] == host + '/annotations'
> > +    assert links['annotation']['delete']['method'] == 'DELETE'
> > +    assert links['annotation']['delete']['url'] == host + '/annotations/:id'
> > +    assert links['annotation']['read']['method'] == 'GET'
> > +    assert links['annotation']['read']['url'] == host + '/annotations/:id'
> > +    assert links['annotation']['update']['method'] == 'PUT'
> > +    assert links['annotation']['update']['url'] == host + '/annotations/:id'
> > +    assert links['search']['method'] == 'GET'
> > +    assert links['search']['url'] == host + '/search'
> > +
> > +
> > +@patch('h.api.get_user')
> > +@patch('h.api.Annotation')
> > +def test_search(mock_Annotation, mock_get_user):
>
> The test indeed tested only the happy path. I've added a search_params
> function and have only that one be tested. However there was not much logic
> to be extracted, as defaults and limit checking are done in
> annotator-store. Do you think we should do that already here?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/hypothesis/h/pull/1300/files#r19912904>.
>