grape

https://github.com/intridea/grape

Ruby

An opinionated framework for creating REST-like APIs in Ruby.

Grape::DSL::RequestResponse::ClassMethods#represent

Allows you to specify a default representation entity for a
class. This allows you to map your models to their respective
entities once and then simply call `present` with the model.

Note that Grape will automatically go up the class ancestry to
try to find a representing entity, so if you, for example, define
an entity to represent `Object` then all presented objects will
bubble up and utilize the entity provided on that `represent` call.

Source | Google | Stack overflow

Edit

git clone [email protected]:intridea/grape.git

cd grape

open lib/grape/dsl/request_response.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Grape--DSL--RequestResponse--ClassMethods-represent-for-pr


# Commit to git

git add lib/grape/dsl/request_response.rbgit commit -m "better docs for Grape::DSL::RequestResponse::ClassMethods#represent"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Grape--DSL--RequestResponse--ClassMethods-represent-for-pr

hub pull-request


# Celebrate!