grapeのoptionsについての備忘録

railsのgemに [grape](https://github.com/ruby-grape/grape)と [grape-entity](https://github.com/ruby-grape/grape-entity#options-hash)というものがある。 これらを使えば、RESTfulなAPIをそれなりに手軽に返せる機構を作ることが出来る。 以下のようなgrapeのフォーマットに従ったAPIレスポンス用のクラス、及び Entity定義用のクラスがあったとする。 ``` ruby # UserAPIクラス class Api < Grape::API format :json content_type :json, 'application/json' ```

続きを読む →