]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/api/amf_controller.rb
Fix new rubocop warnings
[rails.git] / app / controllers / api / amf_controller.rb
index 509cf1d77c7847a77f1b8d6f849b9aae6116850d..ca46726a46fadcf268f3660deb1cf750559f29e3 100644 (file)
 # * version conflict when POIs and ways are reverted
 
 module Api
-  class AmfController < ApplicationController
+  class AmfController < ApiController
     include Potlatch
 
-    skip_before_action :verify_authenticity_token
     before_action :check_api_writable
 
     # AMF Controller implements its own authentication and authorization checks
@@ -93,14 +92,14 @@ module Api
             result = putway(renumberednodes, *args)
             result[4] = renumberednodes.reject { |k, _v| orn.key?(k) }
             renumberedways[result[2]] = result[3] if result[0].zero? && result[2] != result[3]
-          when "putrelation" then
+          when "putrelation"
             result = putrelation(renumberednodes, renumberedways, *args)
-          when "deleteway" then
+          when "deleteway"
             result = deleteway(*args)
           when "putpoi" then
             result = putpoi(*args)
             renumberednodes[result[2]] = result[3] if result[0].zero? && result[2] != result[3]
-          when "startchangeset" then
+          when "startchangeset"
             result = startchangeset(*args)
           end
 
@@ -115,18 +114,18 @@ module Api
 
     def amf_handle_error(call, rootobj, rootid)
       yield
-    rescue OSM::APIAlreadyDeletedError => ex
-      [-4, ex.object, ex.object_id]
-    rescue OSM::APIVersionMismatchError => ex
-      [-3, [rootobj, rootid], [ex.type.downcase, ex.id, ex.latest]]
-    rescue OSM::APIUserChangesetMismatchError => ex
-      [-2, ex.to_s]
-    rescue OSM::APIBadBoundingBox => ex
-      [-2, "Sorry - I can't get the map for that area. The server said: #{ex}"]
-    rescue OSM::APIError => ex
-      [-1, ex.to_s]
-    rescue StandardError => ex
-      [-2, "An unusual error happened (in #{call}). The server said: #{ex}"]
+    rescue OSM::APIAlreadyDeletedError => e
+      [-4, e.object, e.object_id]
+    rescue OSM::APIVersionMismatchError => e
+      [-3, [rootobj, rootid], [e.type.downcase, e.id, e.latest]]
+    rescue OSM::APIUserChangesetMismatchError => e
+      [-2, e.to_s]
+    rescue OSM::APIBadBoundingBox => e
+      [-2, "Sorry - I can't get the map for that area. The server said: #{e}"]
+    rescue OSM::APIError => e
+      [-1, e.to_s]
+    rescue StandardError => e
+      [-2, "An unusual error happened (in #{call}). The server said: #{e}"]
     end
 
     def amf_handle_error_with_timeout(call, rootobj, rootid)