diff options
author | Azul <azul@riseup.net> | 2018-01-19 14:11:24 +0100 |
---|---|---|
committer | Azul <azul@riseup.net> | 2018-01-19 14:11:24 +0100 |
commit | 54653f75cf44890310a06c3a8a6be59625629d2a (patch) | |
tree | 3a1c851033c46e1a140de3e3b5a17ad4b7f2647e /app/controllers/api | |
parent | b8ba4f27a82868e0b3338b4af761f7c44226e729 (diff) |
API: implement deleting keys through new keys api
Diffstat (limited to 'app/controllers/api')
-rw-r--r-- | app/controllers/api/keys_controller.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/controllers/api/keys_controller.rb b/app/controllers/api/keys_controller.rb index d4cb759..7eb76ee 100644 --- a/app/controllers/api/keys_controller.rb +++ b/app/controllers/api/keys_controller.rb @@ -25,10 +25,22 @@ class Api::KeysController < ApiController def update keyring.update type, rev: rev, value: value head :no_content + rescue Keyring::NotFound => e + render status: 404, json: {error: e.message} rescue Keyring::Error, ActionController::ParameterMissing => e render status: 422, json: {error: e.message} end + def destroy + keyring.delete type, rev: rev + head :no_content + rescue Keyring::NotFound => e + render status: 404, json: {error: e.message} + rescue Keyring::Error, ActionController::ParameterMissing => e + render status: 422, json: {error: e.message} + end + + protected def require_enabled |