Add restful API controllers

Add specs and testing for restful API controllers
Sorry, but we've already done this work. It does not fit in model/scope
layer. Its a query object and it's all ready and in use already. Check it
out in the normal discussions controller.

On Mon, Nov 3, 2014 at 4:38 PM, James Kiesel <notifications@github.com>
wrote:

> In app/models/permitted_filters.rb:
>
> > @@ -0,0 +1,37 @@
> > +class PermittedFilters < Struct.new(:params)
>
> Agree on all fronts, although I think that this solution and the user
> permissions one can work in tandem. (since we're just chaining together
> queries, I think..) Also, I'd be really happy to get all this logic pushed
> down into a scope, so it's not in the otherwise-spanky-clean controllers.
>
> I'm envisioning something like
>
> Discussion.visible_to(current_user).where(param_filters)
>
> scope :visible_to, ->(user) { Queries::VisibleDiscussions.new(user: user) }
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/loomio/loomio/pull/1736/files#r19718194>.
>