Class: Scimitar::ResourceTypesController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- Scimitar::ResourceTypesController
- Defined in:
- app/controllers/scimitar/resource_types_controller.rb
Instance Method Summary collapse
Instance Method Details
#index ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'app/controllers/scimitar/resource_types_controller.rb', line 3 def index resource_types = Scimitar::Engine.resources.map do |resource| resource.resource_type(scim_resource_type_url(name: resource.resource_type_id)) end render json: { schemas: [ 'urn:ietf:params:scim:api:messages:2.0:ListResponse' ], totalResults: resource_types.size, Resources: resource_types } end |
#show ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'app/controllers/scimitar/resource_types_controller.rb', line 17 def show resource_types = Scimitar::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 resource_type = resource_types[params[:name]] if resource_type.nil? raise Scimitar::NotFoundError.new(params[:name]) else render json: resource_type end end |