Pajk/apipie-rails — pull request #98 by iNecas (2013-02-18 09:20:57+00:00)
Title: param_groups for DRY the documentation

Often, params occur together in more actions. Typically, most of the
params for `create` and `update` actions are common for both of
them.

This params can be extracted with `def_param_group` and
`param_group` keywords.

The definition is looked up in the scope of the controller. If the
group is defined in a different controller, it might be referenced by
specifying the second argument.

```ruby
def_param_group :address do
param :street, String
param :number, Integer
param :zip, String
end

def_param_group :user do
param :user, Hash do
param :name, String, "Name of the user"
param_group :address
end
end

api :POST, "/users", "Create an user"
param_group :user
def create
# ...
end

api :PUT, "/users/:id", "Update an user"
param_group :user
def update
# ...
end

api :POST, "/users", "Create an user"
param_group :user, V1::UsersController
def create
# ...
end
```

During the implementation, dsl refactoring took place. This resulted in reusing
the DSL definition in Hash params. Also the evaluation of the method DSL itself
is moved to phase when the method is defined. This gives more options to
integrate the DSL with the code itself - preparation for ActiveRecord
integration.