Commit 6c32fc56 authored by Robert Schilling's avatar Robert Schilling

Grapify the license API

parent cf046802
......@@ -3,26 +3,22 @@ module API
before { authenticated_as_admin! }
resource :license do
# Get information on the currently active license
#
# Example request:
# GET /license
desc 'Get information on the currently active license' do
success Entities::License
end
get do
license = ::License.current
present license, with: Entities::License
end
# Add a new license
#
# Parameters:
# license (required) - The license text
#
# Example request:
# POST /license
desc 'Add a new license' do
success Entities::License
end
params do
requires :license, type: String, desc: 'The license text'
end
post do
required_attributes! [:license]
license = ::License.new(data: params[:license])
if license.save
present license, with: Entities::License
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment