Class: ScimEngine::ResourceTypesController

Inherits:
ApplicationController show all
Defined in:
app/controllers/scim_engine/resource_types_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject


5
6
7
8
9
10
11
# File 'app/controllers/scim_engine/resource_types_controller.rb', line 5

def index
  resource_types = ScimEngine::Engine.resources.map do |resource|
    resource.resource_type(scim_resource_type_url(name: resource.resource_type_id))
  end

  render json: resource_types
end

#showObject


13
14
15
16
17
18
19
20
# File 'app/controllers/scim_engine/resource_types_controller.rb', line 13

def show
  resource_types = ScimEngine::Engine.resources.reduce({}) do |hash, resource|
    hash[resource.resource_type_id] = resource.resource_type(scim_resource_type_url(name: resource.resource_type_id))
    hash
  end

  render json: resource_types[params[:name]]
end