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. --- app/views/uuid_resolver/new.html.erb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 app/views/uuid_resolver/new.html.erb (limited to 'app/views') diff --git a/app/views/uuid_resolver/new.html.erb b/app/views/uuid_resolver/new.html.erb new file mode 100644 index 0000000..1cefbfc --- /dev/null +++ b/app/views/uuid_resolver/new.html.erb @@ -0,0 +1,15 @@ +

Resolving <%= @resolver.uuid %>

+

Found <%= pluralize(@resolver.count, "result") %>.

+ +<% if @resolver.count == 1 %> + <%= render @resolver.record %> +<% elsif @resolver.count > 1 %> + <% @resolver.records.each do |rec| %> + <%= render rec %> + <% end %> +<% end %> + +<% content_for :debug do %> + <%= h @resolver.records.inspect %> +<% end %> + -- cgit v1.2.3