Commit 721a221

mokha <mokha@cisco.com>
2018-01-25 22:59:07
extract UserRepository class.
1 parent e93f376
Changed files (2)
app
app/controllers/scim/v2/users_controller.rb
@@ -41,26 +41,5 @@ module Scim
         UserRepository.new
       end
     end
-
-    class UserRepository
-      def find!(id)
-        User.find_by!(uuid: id)
-      end
-
-      def create!(params)
-        password = SecureRandom.hex(32)
-        User.create!(email: params[:userName], password: password)
-      end
-
-      def update!(id, params)
-        user = find!(id)
-        user.update!(email: params[:userName])
-        user
-      end
-
-      def destroy!(id)
-        find!(id).destroy!
-      end
-    end
   end
 end
app/models/user_repository.rb
@@ -0,0 +1,20 @@
+class UserRepository
+  def find!(id)
+    User.find_by!(uuid: id)
+  end
+
+  def create!(params)
+    password = SecureRandom.hex(32)
+    User.create!(email: params[:userName], password: password)
+  end
+
+  def update!(id, params)
+    user = find!(id)
+    user.update!(email: params[:userName])
+    user
+  end
+
+  def destroy!(id)
+    find!(id).destroy!
+  end
+end