Sha256: 47e3607eb6d58e4f0b00af5a3ccabca218ac52123c61fd1400fdc1f2a995725a
Contents?: true
Size: 1.01 KB
Versions: 10
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true module Scimaenaga class ScimSchemasController < Scimaenaga::ApplicationController 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 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 private def list_schemas_response(schemas, counts) response = { schemas: [ 'urn:ietf:params:scim:api:messages:2.0:ListResponse' ], totalResults: counts.total, startIndex: counts.start_index, itemsPerPage: counts.limit, Resources: schemas[counts.offset...counts.offset + counts.limit], } json_response(response) end end end
Version data entries
10 entries across 10 versions & 1 rubygems