triannon 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: feb01d17b07570a2f93644aa4f630272df6281f8
4
- data.tar.gz: 707da73463f69cc9f28b0f6fafe8b6e0d94d1756
3
+ metadata.gz: fe781b6ecd92bc4a8862c0be6d1d16964be6a197
4
+ data.tar.gz: afde4024d9b2fb317f359c99a3cc2828de69bca7
5
5
  SHA512:
6
- metadata.gz: a89db206c12919c93630d4377ac6204583c042bfae99379ad73c3ff0da2a3e61bbace6306f4c47853da3fd018893a0d487eeabbf02c2ff7ef4599b770754795c
7
- data.tar.gz: c29ddde43c40c2e536140c41f67019957632da471b1449d5dbe3a5c6d5904f3a0b9d5e97520146d07e76f38fadf0c6e2b193396953effe05a3cf1d4a00817d8d
6
+ metadata.gz: 9f56d27f5281ab3fe37705bc0314a612c2f4c81f4c8556018e21cf78234417b555049cd75ef3448d50367be654eee261d6892bbaef9d60decfce657627495742
7
+ data.tar.gz: b1e61108016b1c7e348e27aad4e85f799f02fc91a1a056c754eca8ecbd996944cf21321cb898f21729fa817f6efd439fc435fc5715c5a0dc0a8699230742b540
@@ -1,18 +1,26 @@
1
1
  Triannon::Engine.routes.draw do
2
2
  root to: 'annotations#index'
3
3
 
4
- # show action must explicitly forbid "iiif" or "oa" as id values; couldn't
5
- # figure out how to do it with regexp constraint since beginning and end
4
+ # show action must explicitly forbid "new", "iiif" and "oa" as id values; couldn't
5
+ # figure out how to do it with regexp constraint since beginning and end regex
6
6
  # matchers aren't allowed when enforcing formats for segment (e.g. :id)
7
7
  get '/annotations/:id(.:format)', to: 'annotations#show',
8
8
  constraints: lambda { |request|
9
9
  id = request.env["action_dispatch.request.path_parameters"][:id]
10
- id !~ /^iiif$/ && id !~ /^oa$/
10
+ id !~ /^new$/ && id !~ /^iiif$/ && id !~ /^oa$/
11
11
  }
12
12
 
13
13
  resources :annotations, :except => [:update, :edit, :show]
14
14
 
15
- # allow jsonld context in path
16
- get '/annotations/:jsonld_context/:id(.:format)', to: 'annotations#show', jsonld_context: /iiif|oa/
15
+ # allow jsonld context in path (only allow iiif or oa as values)
16
+ # must explicitly forbid "new" as id values; couldn't
17
+ # figure out how to do it with regexp constraint since beginning and end regex
18
+ # matchers aren't allowed when enforcing formats for segment (e.g. :id)
19
+ get '/annotations/:jsonld_context/:id(.:format)', to: 'annotations#show',
20
+ constraints: lambda { |request|
21
+ jsonld_context = request.env["action_dispatch.request.path_parameters"][:jsonld_context]
22
+ id = request.env["action_dispatch.request.path_parameters"][:id]
23
+ (jsonld_context =~ /^iiif$/ || jsonld_context =~ /^oa$/ ) && id !~ /^new$/
24
+ }
17
25
 
18
26
  end
@@ -1,3 +1,3 @@
1
1
  module Triannon
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: triannon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer