Sha256: f78a631b1c02744bcde83e921c048a45e358c2d7ce9b979ce1891aa1d1554f65
Contents?: true
Size: 1007 Bytes
Versions: 7
Compression:
Stored size: 1007 Bytes
Contents
module SnowmanIO module API class Apps < Grape::API before(&:authenticate!) namespace :apps do desc "Creates app" params do requires :app, type: Hash do requires :name, type: String end end post do { app: App.create!(permitted_params[:app].to_h) } end route_param :id do before do @app = App.find(params[:id]) end desc "Returns app" get do { app: @app } end desc "Updates app" params do requires :app, type: Hash do requires :name, type: String end end put do { app: @app.tap { |app| app.update_attributes!(permitted_params[:app].to_h) } } end desc "Deletes app" delete do Extra::Meteor.model_destroy(@app) {status: "ok"} end end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems