From 15096ed20f918d585f7b49610f89deefda0a20b3 Mon Sep 17 00:00:00 2001 From: hellekin Date: Mon, 22 Mar 2021 15:30:45 +0100 Subject: Add UUIDResolver The UUIDResolver adds a route at `/by-uuid/:uuid` that enables applications to request information about a given UUID. The UUID must be a Random UUID (version 4, see RFC 4122). If an invalid UUID is given, the controller will return 422 Unprocessable Entity. If a valid UUID is given: - 404 indicates that the UUID is not assigned to anything known to the system. - 302 indicates that the UUID was assigned to a record, and the User-Agent will be redirected to that record's Location as indicated in the response header. - 200 indicates that the UUID was assigned to more than one record (which is unlikely) and will list those records. --- config/initializers/inflections.rb | 1 + config/routes.rb | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) (limited to 'config') diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index 2292fab..45c08f4 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -24,4 +24,5 @@ ActiveSupport::Inflector.inflections do |inflect| inflect.acronym 'API' inflect.acronym 'SSO' inflect.acronym 'INCOMMON' + inflect.acronym 'UUID' end diff --git a/config/routes.rb b/config/routes.rb index 9be4a4e..54f383e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -28,7 +28,10 @@ Rails.application.routes.draw do get '/my/account', to: 'users#show', as: 'account' patch '/my/current_agent', to: 'my/agent#switch', as: 'agent_switch' get '/my/dashboard', to: 'welcome#dashboard' - get 'my/peers', to: 'users#index', as: 'users' + get '/my/peers', to: 'users#index', as: 'users' + + # UUID Resolver + get '/by-uuid/:uuid', to: 'uuid_resolver#new', as: 'uuid_resolver' # Discourse SSO get 'authenticate(/:token)', to: 'welcome#authenticate' -- cgit v1.2.3