Commit 3c43f4b3e51f2be097d1dbd88ac0d8b973119f95

Authored by Leandro Santos
Committed by Rodrigo Souto
1 parent 6138ba4d

adding root clause in entities return

Showing 1 changed file with 3 additions and 0 deletions   Show diff stats
lib/api/entities.rb
1 module API 1 module API
2 module Entities 2 module Entities
3 class Article < Grape::Entity 3 class Article < Grape::Entity
  4 + root 'articles', 'article'
4 expose :id, :name, :body, :created_at 5 expose :id, :name, :body, :created_at
5 6
6 expose :author do |article, options| 7 expose :author do |article, options|
@@ -17,6 +18,7 @@ module API @@ -17,6 +18,7 @@ module API
17 end 18 end
18 19
19 class Comment < Grape::Entity 20 class Comment < Grape::Entity
  21 + root 'comments', 'comment'
20 expose :body, :title, :created_at, :id 22 expose :body, :title, :created_at, :id
21 23
22 expose :author do |comment, options| 24 expose :author do |comment, options|
@@ -33,6 +35,7 @@ module API @@ -33,6 +35,7 @@ module API
33 end 35 end
34 36
35 class User < Grape::Entity 37 class User < Grape::Entity
  38 + root 'users', 'user'
36 expose :login 39 expose :login
37 end 40 end
38 41