victor-am / rails-ranger

🤠 An opinionated AJAX client for Ruby on Rails APIs
https://victor-am.github.io/rails-ranger/
MIT License
32 stars 5 forks source link

Allow the usage of namespaces #21

Closed victor-am closed 6 years ago

victor-am commented 6 years ago

This PR introduces a namespace feature that works like this:

api.namespace('admin').list('users')
// => admin/users

api.namespace('blog_posts/:id', { id: 1 }).list('users')
// => blogs/1/users

The resource feature now works on top of the namespace function, so this:

api.resource('blogPosts', 1)

Is the same as this:

api.namespace('blog_posts/:id', { id: 1 })

Pending

Closes #1