15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/riiif/routes.rb', line 15
def draw
add_routes do |options|
resource = options.fetch(:resource)
route_prefix = options[:at]
route_prefix ||= "/#{options[:as]}" if options[:as]
get "#{route_prefix}/:id/:region/:size/:rotation/:quality.:format" => 'riiif/images#show',
constraints: { rotation: ALLOW_DOTS, size: SIZES },
defaults: { format: 'jpg', rotation: '0', region: 'full', quality: 'default', model: resource },
as: options[:as] || 'image'
get "#{route_prefix}/:id/info.json" => 'riiif/images#info',
defaults: { format: 'json', model: resource },
as: [options[:as], 'info'].compact.join('_')
get "#{route_prefix}/:id" => 'riiif/images#redirect', as: [options[:as], 'base'].compact.join('_')
end
end
|