Class: Scimitar::SchemasController

Inherits:
ApplicationController show all
Defined in:
app/controllers/scimitar/schemas_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/scimitar/schemas_controller.rb', line 5

def index
  schemas = Scimitar::Engine.schemas

  schemas.each do |schema|
    schema.meta.location = scim_schemas_url(name: schema.id)
  end

  schemas_by_id = schemas.reduce({}) do |hash, schema|
    hash[schema.id] = schema
    hash
  end

  render json: schemas_by_id[params[:name]] || schemas
end