Quick fixes to posts api

* Fix error undefined variable $id
* Add missing datetime query.
Move Controller_Api_Posts::post() to Model_Post::for_api()
Improve RestContext to allow checking for error conditions

Previously HTTP error codes would throw a php error. Now we catch these
errors and grab the response object anyway.
Change post status 'publish' to 'published'
Make test for DELETE /form/ID check for id in response
Add tests for posts api

* Adds tests
* Tweak feature context to add required fixtures
* Add custom date time value 'unknown'
* Make posts through a 400 for invalid attribute in POST
Add option to configure proxy url for testing
Improving RestContext

* Add thePropertyContains() step, used to check for tags.
* Use base_url from Guzzle
* Add support for setting query strings in tests
* Improve error message for property equals
* Better handling of JSON errors in tests
* Add test for JSONP
* Add test for response does NOT have a property
* theTypeOfThePropertyIsNumeric() converted to theTypeOfThePropertyIs()
  with ability to add further type support
* Fix thePropertyEquals() to handle numeric values
  Make comparison less strict since value from behat is always a string
Fix post_datetime SQL Create statement - only create if not exists
DELETE /posts/:id - return the post that was deleted
PUT /posts/:id - implementing post updates
Adding further tests and improve some existing ones

* Test for 404 on DELETE missing resources
* Test for 404 when try to GET non existent resource
* Test for being saved tags in posts
* Test for searching posts
  * Add extra fixtures to support this
* Test for 404 on PUT/updating a non-existent resource
* Test GET /posts with GeoJSON and JSONP formats
* Test for PUT /posts with partial data.
* Test missing values in PUT /posts are ignored not removed
* Test GET /posts with limit/offset and orderby/order
* Test POST/PUT /posts with invalid relation IDs
* Test PUT /posts with invalid form id
* Test creating/updating groups and attributes with invalid form id
* Test creating/updating attributes with invalid groups

Check for next/prev/curr properties on the /posts limit+offset test
Make GET/PUT/DELETE on missing resources respond with 404s

Covers: forms, posts, attributes, groups
Improve JSON format error: provide more info about why it didn't parse.

* Uses json_last_error() to get json parsing errors
* Adds seperate check to ensure array/object JSON supplied
* Remove outer try/catch since json_decode() doesn't throw Exceptions
Allow checking deeply nested property types and values

* Using Arr::path() to get properties burried deeper in the JSON
  This allow checking properties like: 'values.last_location'
Change JSON structure returned to include both url and id of relations

* Changes form_id to a form array containing id and url
* Changes form_group_id to a form_group array containing id and url
* Update tests to match
* Update API to handle this
Make sure errors throw 400 or 404 as appropriate

* Replace 200 ORM Validation errors with 400
* Replace POST and PUT for attr/group on missing form or group with 404
* Remove no longer relevant @todo's
Add validation rules to Group model, tweak Attribute model
Attributes: check group exists when updating Attribute.

Also fixes check for unique key to exclude the attribute itself
Add support for JSONP