Commit 23eb610

mokha <mokha@cisco.com>
2018-01-23 00:03:51
add scim routes.
1 parent 7c9393e
app/controllers/scim/v2/resource_types_controller.rb
@@ -0,0 +1,6 @@
+module Scim
+  module V2
+    class ResourceTypesController < ApplicationController
+    end
+  end
+end
app/controllers/scim/v2/schemas_controller.rb
@@ -0,0 +1,6 @@
+module Scim
+  module V2
+    class SchemasController < ApplicationController
+    end
+  end
+end
app/controllers/scim/v2/service_providers_controller.rb
@@ -0,0 +1,6 @@
+module Scim
+  module V2
+    class ServiceProvidersController < ApplicationController
+    end
+  end
+end
config/routes.rb
@@ -9,7 +9,14 @@ Rails.application.routes.draw do
 
   namespace :scim do
     namespace :v2, defaults: { format: 'json' } do
-      resources :users, only: [:create]
+      resources :users, only: [:show, :create, :update, :destroy]
+      get :ServiceProviderConfig, to: "service_providers#index"
+      #resources :groups
+      resources :resource_types, only: [:index]
+      get :ResourceTypes, to: "resource_types#index"
+      resources :schemas, only: [:index]
+
+      match 'me', to: lambda { |env| [501, {}, ['']] }, via: [:get, :post, :put, :patch, :delete]
     end
   end
   root to: "sessions#new"
spec/routing/scim_spec.rb
@@ -0,0 +1,22 @@
+require "rails_helper"
+
+describe "/scim" do
+  let(:id) { SecureRandom.uuid }
+  it { expect(get: "scim/v2/users/#{id}").to route_to(controller: "scim/v2/users", action: "show", id: id, format: "json") }
+  it { expect(post: "scim/v2/users").to route_to(controller: "scim/v2/users", action: "create", format: "json") }
+  it { expect(put: "scim/v2/users/#{id}").to route_to(controller: "scim/v2/users", action: "update", id: id, format: "json") }
+  it { expect(patch: "scim/v2/users/#{id}").to route_to(controller: "scim/v2/users", action: "update", id: id, format: "json") }
+  it { expect(delete: "scim/v2/users/#{id}").to route_to(controller: "scim/v2/users", action: "destroy", id: id, format: "json") }
+
+  #it { expect(get: "scim/v2/groups/#{id}").to route_to(controller: "scim/v2/groups", action: "show", id: id, format: "json") }
+  #it { expect(post: "scim/v2/groups").to route_to(controller: "scim/v2/groups", action: "create", format: "json") }
+  #it { expect(put: "scim/v2/groups/#{id}").to route_to(controller: "scim/v2/groups", action: "update", id: id, format: "json") }
+  #it { expect(patch: "scim/v2/groups/#{id}").to route_to(controller: "scim/v2/groups", action: "update", id: id, format: "json") }
+  #it { expect(delete: "scim/v2/groups/#{id}").to route_to(controller: "scim/v2/groups", action: "destroy", id: id, format: "json") }
+
+  #it { expect(get: "/scim/v2/me").to route_to(controller: 'hi') }
+  it { expect(get: "scim/v2/ServiceProviderConfig").to route_to(controller: "scim/v2/service_providers", action: "index", format: "json") }
+  it { expect(get: "scim/v2/ResourceTypes").to route_to(controller: "scim/v2/resource_types", action: "index", format: "json") }
+  it { expect(get: "scim/v2/schemas").to route_to(controller: "scim/v2/schemas", action: "index", format: "json") }
+  #it { expect(post: "scim/v2/bulk").to route_to(controller: "scim/v2/bulk", action: "update", format: "json") }
+end
Gemfile.lock
@@ -2,6 +2,7 @@ PATH
   remote: ../scim-shady
   specs:
     scim-shady (0.1.0)
+      activesupport (>= 4.2.0)
 
 GEM
   remote: https://rubygems.org/