Sha256: 6f8c9727c6bfcd665601199f2257c95bebc62e9597d9e844ce61911e9665f752
Contents?: true
Size: 799 Bytes
Versions: 5
Compression:
Stored size: 799 Bytes
Contents
module TestApp module Modules class User < Grape::API include Grape::Transformations::Base target_model ::User format :json content_type :json, 'application/json' # Defines all transformable entities define_endpoints do |entity| desc 'returns all existent users', { entity: entity } get '/' do content_type "text/json" present ::User.all, with: entity end desc 'returns specific users', { entity: entity } get '/:id' do content_type "text/json" user = ::User.find present user, with: entity end end version :v1 do resource :users do add_endpoints end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems