]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/user_blocks_controller.rb
Add show user block api endpoint
[rails.git] / app / controllers / api / user_blocks_controller.rb
diff --git a/app/controllers/api/user_blocks_controller.rb b/app/controllers/api/user_blocks_controller.rb
new file mode 100644 (file)
index 0000000..19fd4b4
--- /dev/null
@@ -0,0 +1,18 @@
+module Api
+  class UserBlocksController < ApiController
+    before_action :check_api_readable
+
+    authorize_resource
+
+    around_action :api_call_handle_error, :api_call_timeout
+    before_action :set_request_formats
+
+    def show
+      raise OSM::APIBadUserInput, "No id was given" unless params[:id]
+
+      @user_block = UserBlock.find(params[:id])
+    rescue ActiveRecord::RecordNotFound
+      raise OSM::APINotFoundError
+    end
+  end
+end