Commit f76ed84

mo <mo.khan@gmail.com>
2018-12-23 20:56:38
render partials
1 parent b1d0cd7
Changed files (2)
app
controllers
views
scim
v2
resource_types
app/controllers/scim/v2/resource_types_controller.rb
@@ -6,6 +6,7 @@ module Scim
       skip_before_action :authenticate!
 
       def index
+        @resource_types = [:user, :group]
         render status: :ok
       end
 
app/views/scim/v2/resource_types/index.scim.jbuilder
@@ -1,30 +1,5 @@
 # frozen_string_literal: true
 
-json.array! [
-  {
-    "schemas": [SCIM::Schema::RESOURCE_TYPE],
-    "id": "User",
-    "meta": {
-      "location": scim_v2_resource_type_url(id: 'User'),
-      "resourceType": "ResourceType"
-    },
-    "description": "User Account",
-    "endpoint": scim_v2_users_url,
-    "name": "User",
-    "schema": SCIM::Schema::USER,
-    "schemaExtensions": []
-  },
-  {
-    "schemas": [SCIM::Schema::RESOURCE_TYPE],
-    "id": "Group",
-    "meta": {
-      "location": scim_v2_resource_type_url(id: 'Group'),
-      "resourceType": "ResourceType"
-    },
-    "description": "Group",
-    "endpoint": scim_v2_groups_url,
-    "name": "Group",
-    "schema": SCIM::Schema::GROUP,
-    "schemaExtensions": []
-  }
-]
+json.array! @resource_types do |resource_type|
+  json.partial! resource_type.to_s
+end