kadamwhite/wordpress-rest-api — pull request #45 by kadamwhite (2014-06-27 23:58:44+00:00)
Title: Add wp.types() endpoint handler

This endpoint handles the following WP-API routes:
```
/posts/types
/posts/types/
```
It is separate from `wp.posts()` because the resources returned are post types, not posts; we're keeping `wp.posts()` focused on returning post collections, so we intend to make the `types` method on a `PostsRequest` object into a `.type()` method that will set a post type to filter by, rather than a method to set a subresource of that posts API request.

This PR began to accumulate a lot of other cruft because while working on it I identified that the prototype-based path templates exposed a flaw (setting a custom template for any request object would change the template (via reference to a prototype method) for all other instances of that constructor), and dealing with that flaw lead me to some tests that needed to be cleaned up. Rather than continue down that rabbit-hole I'm cutting myself off, merging this (Travis-willing), and moving test cleanup to more specific branches.