Class: Scimaenaga::ScimSchemasController

Inherits:
ApplicationController show all
Defined in:
app/controllers/scimaenaga/scim_schemas_controller.rb

Constant Summary

Constants included from Response

Response::CONTENT_TYPE

Instance Method Summary collapse

Methods included from Response

#json_response, #json_scim_response

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
15
# File 'app/controllers/scimaenaga/scim_schemas_controller.rb', line 5

def index
  schemas = Scimaenaga.config.schemas

  counts = ScimCount.new(
    start_index: params[:startIndex],
    limit: params[:count],
    total: schemas.count
  )

  list_schemas_response(schemas, counts)
end

#showObject



17
18
19
20
21
22
23
24
25
# File 'app/controllers/scimaenaga/scim_schemas_controller.rb', line 17

def show
  schema = Scimaenaga.config.schemas.find do |s|
    s[:id] == params[:id]
  end

  raise Scimaenaga::ExceptionHandler::ResourceNotFound, params[:id] if schema.nil?

  json_response(schema)
end