riiif 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/CHANGELOG +10 -0
- data/README.md +8 -8
- data/app/controllers/riiif/images_controller.rb +26 -9
- data/app/models/riiif/image.rb +1 -1
- data/lib/riiif.rb +1 -0
- data/lib/riiif/akubra_system_file_resolver.rb +33 -0
- data/lib/riiif/routes.rb +2 -2
- data/lib/riiif/version.rb +1 -1
- data/riiif.gemspec +1 -1
- data/spec/controllers/images_controller_spec.rb +90 -73
- data/spec/models/akubra_system_file_resolver_spec.rb +13 -0
- data/spec/models/image_spec.rb +3 -3
- data/spec/routing/resize_routes_spec.rb +19 -19
- metadata +11 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65171f23d8765ea314112f202add0bb209715117
|
4
|
+
data.tar.gz: 69e2bd116d0af940167a09e37f20dbfaa876498f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 844d8230f62871475ce3bffcbb1ee2696ca35afe2eb1b5df86431f50b0747b23311ea79d29d9a3062c43bb7131ec9eba68fa9662b329c54a6a40ee1c84929cd9
|
7
|
+
data.tar.gz: 1949cb87c2668ac49fae803b82d1917229d2140ec62f6011c5db4aae4057367884ad1e17fa93ba9e7dc8dc8cbda06eec36fcbd571a261e108b50f346ed4dc35c
|
data/.gitignore
CHANGED
data/CHANGELOG
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
11/19/14
|
2
|
+
added lib/riiif/akubra_system_file_resolver.rb
|
3
|
+
modified lib/riiif.rb
|
4
|
+
author: Eric James (yulgit1) Yale University Library
|
5
|
+
3/10/15
|
6
|
+
rebased
|
7
|
+
updated akubra_system_file.resolver.rb to class instead of module
|
8
|
+
added test akubra_system_file_resolver_spec.rb
|
9
|
+
added spec/samples/22/7e/9/info%3Afedora%2Fdemo%3A1%2Fjp2%2Fjp2.0
|
10
|
+
author: Eric James (yulgit1) Yale University Library
|
data/README.md
CHANGED
@@ -65,19 +65,19 @@ By default the cache is located in `tmp/network_files`. You can set the cache pa
|
|
65
65
|
|
66
66
|
## Usage
|
67
67
|
|
68
|
-
|
68
|
+
Add the routes to your application by inserting the following line into `config/routes.rb`
|
69
69
|
```
|
70
|
-
|
70
|
+
iiif_for 'riiif/image', at: '/image-service'
|
71
71
|
```
|
72
72
|
|
73
73
|
Then you can make requests like this:
|
74
74
|
|
75
|
-
* http://www.example.org/image-service/abcd1234/full/full/0/
|
76
|
-
* http://www.example.org/image-service/abcd1234/full/100,/0/
|
77
|
-
* http://www.example.org/image-service/abcd1234/full/,100/0/
|
78
|
-
* http://www.example.org/image-service/abcd1234/full/pct:50/0/
|
79
|
-
* http://www.example.org/image-service/abcd1234/full/150,75/0/
|
80
|
-
* http://www.example.org/image-service/abcd1234/full/!150,75/0/
|
75
|
+
* http://www.example.org/image-service/abcd1234/full/full/0/default.jpg
|
76
|
+
* http://www.example.org/image-service/abcd1234/full/100,/0/default.jpg
|
77
|
+
* http://www.example.org/image-service/abcd1234/full/,100/0/default.jpg
|
78
|
+
* http://www.example.org/image-service/abcd1234/full/pct:50/0/default.jpg
|
79
|
+
* http://www.example.org/image-service/abcd1234/full/150,75/0/default.jpg
|
80
|
+
* http://www.example.org/image-service/abcd1234/full/!150,75/0/default.jpg
|
81
81
|
|
82
82
|
### Route helpers
|
83
83
|
|
@@ -1,6 +1,11 @@
|
|
1
1
|
module Riiif
|
2
2
|
class ImagesController < ::ApplicationController
|
3
3
|
before_filter :link_header, only: [:show, :info]
|
4
|
+
|
5
|
+
rescue_from Riiif::InvalidAttributeError do
|
6
|
+
render nothing: true, status: 400
|
7
|
+
end
|
8
|
+
|
4
9
|
def show
|
5
10
|
begin
|
6
11
|
image = model.new(image_id)
|
@@ -14,17 +19,23 @@ module Riiif
|
|
14
19
|
end
|
15
20
|
end
|
16
21
|
data = image.render(params.permit(:region, :size, :rotation, :quality, :format))
|
17
|
-
|
22
|
+
headers['Access-Control-Allow-Origin'] = '*'
|
23
|
+
send_data data,
|
24
|
+
status: status,
|
25
|
+
type: Mime::Type.lookup_by_extension(params[:format]),
|
26
|
+
disposition: 'inline'
|
18
27
|
end
|
19
28
|
|
20
29
|
def info
|
21
30
|
image = model.new(image_id)
|
22
|
-
|
31
|
+
headers['Access-Control-Allow-Origin'] = '*'
|
32
|
+
render json: image.info.merge(server_info), content_type: 'application/ld+json'
|
23
33
|
end
|
24
34
|
|
25
35
|
protected
|
26
36
|
|
27
|
-
|
37
|
+
LEVEL1 = 'http://iiif.io/api/image/2/level1.json'
|
38
|
+
|
28
39
|
def model
|
29
40
|
params.fetch(:model, "riiif/image").camelize.constantize
|
30
41
|
end
|
@@ -34,16 +45,22 @@ module Riiif
|
|
34
45
|
end
|
35
46
|
|
36
47
|
def link_header
|
37
|
-
response.headers["Link"] = "<#{
|
48
|
+
response.headers["Link"] = "<#{LEVEL1}>;rel=\"profile\""
|
38
49
|
end
|
39
50
|
|
51
|
+
CONTEXT = '@context'
|
52
|
+
CONTEXT_URI = 'http://iiif.io/api/image/2/context.json'
|
53
|
+
ID = '@id'
|
54
|
+
PROTOCOL = 'protocol'
|
55
|
+
PROTOCOL_URI = 'http://iiif.io/api/image'
|
56
|
+
PROFILE = 'profile'
|
57
|
+
|
40
58
|
def server_info
|
41
59
|
{
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
60
|
+
CONTEXT => CONTEXT_URI,
|
61
|
+
ID => request.original_url.sub('/info.json', ''),
|
62
|
+
PROTOCOL => PROTOCOL_URI,
|
63
|
+
PROFILE => [LEVEL1, 'formats' => model::OUTPUT_FORMATS]
|
47
64
|
}
|
48
65
|
end
|
49
66
|
end
|
data/app/models/riiif/image.rb
CHANGED
@@ -69,7 +69,7 @@ module Riiif
|
|
69
69
|
end
|
70
70
|
|
71
71
|
def decode_quality(quality)
|
72
|
-
return if quality.nil? || ['
|
72
|
+
return if quality.nil? || ['default', 'color'].include?(quality)
|
73
73
|
return quality if ['bitonal', 'grey'].include?(quality)
|
74
74
|
raise InvalidAttributeError, "Unsupported quality: #{quality}"
|
75
75
|
end
|
data/lib/riiif.rb
CHANGED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'digest'
|
2
|
+
require 'cgi'
|
3
|
+
module Riiif
|
4
|
+
class AkubraSystemFileResolver
|
5
|
+
attr_accessor :pathroot, :imagetype, :akubraconfig
|
6
|
+
|
7
|
+
def initialize(pr="/yourfedora/data/datastreamStore/",ir="jp2",ac=[[0,2],[2,2],[4,1]])
|
8
|
+
@pathroot = pr
|
9
|
+
@imagetype = ir
|
10
|
+
@akubraconfig = ac
|
11
|
+
end
|
12
|
+
|
13
|
+
def find(id)
|
14
|
+
Riiif::File.new(path(id))
|
15
|
+
end
|
16
|
+
|
17
|
+
def path(id)
|
18
|
+
search = pattern(id)
|
19
|
+
Dir.glob(search).first || raise(ImageNotFoundError, search)
|
20
|
+
end
|
21
|
+
|
22
|
+
def pattern(id)
|
23
|
+
fullpid = "info:fedora/#{id}/#{@imagetype}/#{@imagetype}.0"
|
24
|
+
md5 = Digest::MD5.new
|
25
|
+
md5.update fullpid
|
26
|
+
digest = md5.hexdigest
|
27
|
+
directorystr = ""
|
28
|
+
@akubraconfig.each { |a| directorystr << digest[a[0],a[1]] << "/" }
|
29
|
+
filename = CGI.escape(fullpid)
|
30
|
+
@pathroot + directorystr + filename
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
data/lib/riiif/routes.rb
CHANGED
@@ -19,11 +19,11 @@ module Riiif
|
|
19
19
|
route_prefix ||= "/#{options[:as]}" if options[:as]
|
20
20
|
get "#{route_prefix}/:id/:region/:size/:rotation/:quality.:format" => "riiif/images#show",
|
21
21
|
constraints: { rotation: ALLOW_DOTS, size: SIZES },
|
22
|
-
defaults: { format: 'jpg', rotation: '0', region: 'full', quality: '
|
22
|
+
defaults: { format: 'jpg', rotation: '0', region: 'full', quality: 'default', model: resource },
|
23
23
|
as: options[:as] || "image"
|
24
24
|
|
25
25
|
get "#{route_prefix}/:id/info.json" => "riiif/images#info", defaults: { format: 'json', model: resource }, as: [options[:as], "info"].compact.join("_")
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
29
|
-
end
|
29
|
+
end
|
data/lib/riiif/version.rb
CHANGED
data/riiif.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.3"
|
22
22
|
spec.add_development_dependency "rake"
|
23
|
-
spec.add_development_dependency "engine_cart"
|
23
|
+
spec.add_development_dependency "engine_cart", '~> 0.8'
|
24
24
|
spec.add_development_dependency "rspec-rails"
|
25
25
|
spec.add_development_dependency "sqlite3"
|
26
26
|
spec.add_dependency 'rails', '> 3.2.0'
|
@@ -4,89 +4,106 @@ require 'open-uri'
|
|
4
4
|
describe Riiif::ImagesController do
|
5
5
|
let(:filename) { File.expand_path('spec/samples/world.jp2') }
|
6
6
|
routes { Riiif::Engine.routes }
|
7
|
-
it "should send images to the service" do
|
8
|
-
image = double
|
9
|
-
expect(Riiif::Image).to receive(:new).with('abcd1234').and_return(image)
|
10
|
-
expect(image).to receive(:render).with("region" => 'full', "size" => 'full',
|
11
|
-
"rotation" => '0', "quality" => 'native',
|
12
|
-
"format" => 'jpg').and_return("IMAGEDATA")
|
13
|
-
get :show, id: 'abcd1234', action: "show", region: 'full', size: 'full',
|
14
|
-
rotation: '0', quality: 'native', format: 'jpg'
|
15
|
-
expect(response).to be_successful
|
16
|
-
expect(response.body).to eq 'IMAGEDATA'
|
17
|
-
expect(response.headers['Link']).to eq '<http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2>;rel="profile"'
|
18
|
-
end
|
19
7
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
8
|
+
describe "#show" do
|
9
|
+
it "should send images to the service" do
|
10
|
+
image = double
|
11
|
+
expect(Riiif::Image).to receive(:new).with('abcd1234').and_return(image)
|
12
|
+
expect(image).to receive(:render).with("region" => 'full', "size" => 'full',
|
13
|
+
"rotation" => '0', "quality" => 'default',
|
14
|
+
"format" => 'jpg').and_return("IMAGEDATA")
|
15
|
+
get :show, id: 'abcd1234', action: "show", region: 'full', size: 'full',
|
16
|
+
rotation: '0', quality: 'default', format: 'jpg'
|
17
|
+
expect(response).to be_successful
|
18
|
+
expect(response.body).to eq 'IMAGEDATA'
|
19
|
+
expect(response.headers['Link']).to eq '<http://iiif.io/api/image/2/level1.json>;rel="profile"'
|
20
|
+
expect(response.headers['Access-Control-Allow-Origin']).to eq '*'
|
21
|
+
end
|
35
22
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
23
|
+
context "with a invalid region" do
|
24
|
+
it "renders 400" do
|
25
|
+
image = double("an image")
|
26
|
+
allow(image).to receive(:render).and_raise Riiif::InvalidAttributeError
|
27
|
+
allow(Riiif::Image).to receive(:new).with('abcd1234').and_return(image)
|
28
|
+
get :show, id: 'abcd1234', action: "show", region: '`szoW0', size: 'full',
|
29
|
+
rotation: '0', quality: 'default', format: 'jpg'
|
30
|
+
expect(response.code).to eq "400"
|
31
|
+
end
|
43
32
|
end
|
44
33
|
|
45
|
-
context "with a
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
34
|
+
context "with a nonexistent image" do
|
35
|
+
it "should error when a default image isn't sent" do
|
36
|
+
expect(Riiif::Image).to receive(:new).with('bad_id').and_raise(OpenURI::HTTPError.new("fail", StringIO.new))
|
37
|
+
expect do
|
38
|
+
get :show, id: 'bad_id', action: "show", region: 'full', size: 'full',
|
39
|
+
rotation: '0', quality: 'default', format: 'jpg'
|
40
|
+
end.to raise_error(StandardError)
|
51
41
|
end
|
52
42
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
end
|
61
|
-
end.twice
|
62
|
-
expect(not_found_image).to receive(:render).with("region" => 'full', "size" => 'full',
|
63
|
-
"rotation" => '0', "quality" => 'native',
|
64
|
-
"format" => 'jpg').and_return("default-image-data")
|
43
|
+
context "with a default image set" do
|
44
|
+
around do |example|
|
45
|
+
old_value = Riiif.not_found_image
|
46
|
+
Riiif.not_found_image = filename
|
47
|
+
example.run
|
48
|
+
Riiif.not_found_image = old_value
|
49
|
+
end
|
65
50
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
51
|
+
it "should send the default 'not found' image for failed http files" do
|
52
|
+
not_found_image = double
|
53
|
+
expect(Riiif::Image).to receive(:new) do |id, file|
|
54
|
+
if file.present?
|
55
|
+
not_found_image
|
56
|
+
else
|
57
|
+
raise Riiif::ImageNotFoundError
|
58
|
+
end
|
59
|
+
end.twice
|
60
|
+
expect(not_found_image).to receive(:render).with("region" => 'full', "size" => 'full',
|
61
|
+
"rotation" => '0', "quality" => 'default',
|
62
|
+
"format" => 'jpg').and_return("default-image-data")
|
71
63
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
else
|
78
|
-
raise Riiif::ImageNotFoundError
|
79
|
-
end
|
80
|
-
end.twice
|
81
|
-
expect(not_found_image).to receive(:render).with("region" => 'full', "size" => 'full',
|
82
|
-
"rotation" => '0', "quality" => 'native',
|
83
|
-
"format" => 'jpg').and_return("default-image-data")
|
64
|
+
get :show, id: 'bad_id', action: "show", region: 'full', size: 'full',
|
65
|
+
rotation: '0', quality: 'default', format: 'jpg'
|
66
|
+
expect(response).to be_not_found
|
67
|
+
expect(response.body).to eq 'default-image-data'
|
68
|
+
end
|
84
69
|
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
70
|
+
it "should send the default 'not found' image for failed files on the filesystem" do
|
71
|
+
not_found_image = double
|
72
|
+
expect(Riiif::Image).to receive(:new) do |id, file|
|
73
|
+
if file.present?
|
74
|
+
not_found_image
|
75
|
+
else
|
76
|
+
raise Riiif::ImageNotFoundError
|
77
|
+
end
|
78
|
+
end.twice
|
79
|
+
expect(not_found_image).to receive(:render).with("region" => 'full', "size" => 'full',
|
80
|
+
"rotation" => '0', "quality" => 'default',
|
81
|
+
"format" => 'jpg').and_return("default-image-data")
|
82
|
+
|
83
|
+
get :show, id: 'bad_id', action: "show", region: 'full', size: 'full',
|
84
|
+
rotation: '0', quality: 'default', format: 'jpg'
|
85
|
+
expect(response).to be_not_found
|
86
|
+
expect(response.body).to eq 'default-image-data'
|
87
|
+
end
|
89
88
|
end
|
90
89
|
end
|
91
90
|
end
|
91
|
+
|
92
|
+
it "returns info" do
|
93
|
+
image = double
|
94
|
+
expect(Riiif::Image).to receive(:new).with('abcd1234').and_return(image)
|
95
|
+
expect(image).to receive(:info).and_return({width: 6000, height: 4000 })
|
96
|
+
get :info, id: 'abcd1234', format: 'json'
|
97
|
+
expect(response).to be_successful
|
98
|
+
json = JSON.parse(response.body)
|
99
|
+
expect(json).to eq "@context" => "http://iiif.io/api/image/2/context.json",
|
100
|
+
"@id" =>"http://test.host/abcd1234",
|
101
|
+
"width" =>6000,
|
102
|
+
"height" =>4000,
|
103
|
+
"profile" => ["http://iiif.io/api/image/2/level1.json", "formats" => ["jpg", "png"]],
|
104
|
+
'protocol' => 'http://iiif.io/api/image'
|
105
|
+
expect(response.headers['Link']).to eq '<http://iiif.io/api/image/2/level1.json>;rel="profile"'
|
106
|
+
expect(response.headers['Content-Type']).to eq 'application/ld+json; charset=utf-8'
|
107
|
+
expect(response.headers['Access-Control-Allow-Origin']).to eq '*'
|
108
|
+
end
|
92
109
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Riiif::AkubraSystemFileResolver do
|
4
|
+
subject { Riiif::AkubraSystemFileResolver.new(Rails.root.join('../spec/samples/'),'jp2',[[0,2],[2,2],[4,1]]) }
|
5
|
+
it "should raise an error when the file isn't found" do
|
6
|
+
expect{subject.find('demo:2')}.to raise_error Riiif::ImageNotFoundError
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should get the jpeg2000 file" do
|
10
|
+
expect(subject.find('demo:1').path).to eq Riiif::File.new(Dir.glob(subject.pathroot + '22/7e/9/info%3Afedora%2Fdemo%3A1%2Fjp2%2Fjp2.0').first).path
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
data/spec/models/image_spec.rb
CHANGED
@@ -35,7 +35,7 @@ describe Riiif::Image do
|
|
35
35
|
before do
|
36
36
|
Riiif::Image.file_resolver = Riiif::HTTPFileResolver.new
|
37
37
|
Riiif::Image.file_resolver.id_to_uri = lambda do |id|
|
38
|
-
"
|
38
|
+
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/a4/#{id}.jpg/600px-#{id}.jpg"
|
39
39
|
end
|
40
40
|
end
|
41
41
|
after do
|
@@ -129,9 +129,9 @@ describe Riiif::Image do
|
|
129
129
|
end
|
130
130
|
|
131
131
|
describe "quality" do
|
132
|
-
it "
|
132
|
+
it "returns the original when specifing default" do
|
133
133
|
expect(subject.image).to receive(:execute).with("convert #{filename} png:-")
|
134
|
-
subject.render(quality: '
|
134
|
+
subject.render(quality: 'default', format: 'png')
|
135
135
|
end
|
136
136
|
it "should return the original when specifing color" do
|
137
137
|
expect(subject.image).to receive(:execute).with("convert #{filename} png:-")
|
@@ -4,43 +4,43 @@ describe "routes" do
|
|
4
4
|
routes { Riiif::Engine.routes }
|
5
5
|
|
6
6
|
describe 'for conversion' do
|
7
|
-
it "routes GET /abcd1234/full/full/0/
|
7
|
+
it "routes GET /abcd1234/full/full/0/default.jpg" do
|
8
8
|
expect(
|
9
|
-
get: "/abcd1234/full/full/0/
|
9
|
+
get: "/abcd1234/full/full/0/default.jpg"
|
10
10
|
).to route_to(controller: "riiif/images", id: 'abcd1234', action: "show",
|
11
11
|
region: 'full', size: 'full', rotation: '0',
|
12
|
-
quality: '
|
12
|
+
quality: 'default', format: 'jpg', model: "riiif/image")
|
13
13
|
end
|
14
14
|
|
15
15
|
it "routes requests with floating point percent size" do
|
16
16
|
expect(
|
17
|
-
get: "/abcd1234/full/pct:12.5/22.5/
|
18
|
-
).to route_to(controller: "riiif/images", id: 'abcd1234', action: "show",
|
19
|
-
region: 'full', size: 'pct:12.5', rotation: '22.5',
|
20
|
-
quality: '
|
17
|
+
get: "/abcd1234/full/pct:12.5/22.5/default.jpg"
|
18
|
+
).to route_to(controller: "riiif/images", id: 'abcd1234', action: "show",
|
19
|
+
region: 'full', size: 'pct:12.5', rotation: '22.5',
|
20
|
+
quality: 'default', format: 'jpg', model: "riiif/image")
|
21
21
|
end
|
22
22
|
it "routes requests with pixel size" do
|
23
23
|
expect(
|
24
|
-
get: "/abcd1234/full/100,50/22.5/
|
25
|
-
).to route_to(controller: "riiif/images", id: 'abcd1234', action: "show",
|
26
|
-
region: 'full', size: '100,50', rotation: '22.5',
|
27
|
-
quality: '
|
24
|
+
get: "/abcd1234/full/100,50/22.5/default.jpg"
|
25
|
+
).to route_to(controller: "riiif/images", id: 'abcd1234', action: "show",
|
26
|
+
region: 'full', size: '100,50', rotation: '22.5',
|
27
|
+
quality: 'default', format: 'jpg', model: "riiif/image")
|
28
28
|
end
|
29
29
|
it "routes requests with dashes in the id" do
|
30
30
|
expect(
|
31
|
-
get: "/abcd-1234-5678/full/full/0/
|
32
|
-
).to route_to(controller: "riiif/images", id: 'abcd-1234-5678', action: "show",
|
33
|
-
region: 'full', size: 'full', rotation: '0',
|
34
|
-
quality: '
|
31
|
+
get: "/abcd-1234-5678/full/full/0/default.jpg"
|
32
|
+
).to route_to(controller: "riiif/images", id: 'abcd-1234-5678', action: "show",
|
33
|
+
region: 'full', size: 'full', rotation: '0',
|
34
|
+
quality: 'default', format: 'jpg', model: "riiif/image")
|
35
35
|
end
|
36
36
|
|
37
37
|
describe "route helper" do
|
38
38
|
it "takes all the options" do
|
39
|
-
expect(image_path('abcd1234', region: 'full', size: '100,50', rotation: '22.5', quality: '
|
40
|
-
format: 'jpg')).to eq '/abcd1234/full/100,50/22.5/
|
39
|
+
expect(image_path('abcd1234', region: 'full', size: '100,50', rotation: '22.5', quality: 'default',
|
40
|
+
format: 'jpg')).to eq '/abcd1234/full/100,50/22.5/default.jpg'
|
41
41
|
end
|
42
42
|
it "has defaults" do
|
43
|
-
expect(image_path('abcd1234', size: '100,50')).to eq '/abcd1234/full/100,50/0/
|
43
|
+
expect(image_path('abcd1234', size: '100,50')).to eq '/abcd1234/full/100,50/0/default.jpg'
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
@@ -49,7 +49,7 @@ describe "routes" do
|
|
49
49
|
it "routes GET /abcd1234/info.json" do
|
50
50
|
expect(
|
51
51
|
get: "/abcd1234/info.json"
|
52
|
-
).to route_to(controller: "riiif/images", id: 'abcd1234',
|
52
|
+
).to route_to(controller: "riiif/images", id: 'abcd1234',
|
53
53
|
action: "info", format: 'json', model: "riiif/image")
|
54
54
|
end
|
55
55
|
it "should have a route helper" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: riiif
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: engine_cart
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
47
|
+
version: '0.8'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
54
|
+
version: '0.8'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec-rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -104,6 +104,7 @@ files:
|
|
104
104
|
- ".gitignore"
|
105
105
|
- ".rspec"
|
106
106
|
- ".travis.yml"
|
107
|
+
- CHANGELOG
|
107
108
|
- Gemfile
|
108
109
|
- LICENSE
|
109
110
|
- README.md
|
@@ -113,6 +114,7 @@ files:
|
|
113
114
|
- app/models/riiif/image.rb
|
114
115
|
- config/routes.rb
|
115
116
|
- lib/riiif.rb
|
117
|
+
- lib/riiif/akubra_system_file_resolver.rb
|
116
118
|
- lib/riiif/engine.rb
|
117
119
|
- lib/riiif/file_system_file_resolver.rb
|
118
120
|
- lib/riiif/http_file_resolver.rb
|
@@ -121,6 +123,7 @@ files:
|
|
121
123
|
- lib/riiif/version.rb
|
122
124
|
- riiif.gemspec
|
123
125
|
- spec/controllers/images_controller_spec.rb
|
126
|
+
- spec/models/akubra_system_file_resolver_spec.rb
|
124
127
|
- spec/models/file_system_file_resolver_spec.rb
|
125
128
|
- spec/models/http_file_resolver_spec.rb
|
126
129
|
- spec/models/image_spec.rb
|
@@ -148,12 +151,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
151
|
version: '0'
|
149
152
|
requirements: []
|
150
153
|
rubyforge_project:
|
151
|
-
rubygems_version: 2.4.5
|
154
|
+
rubygems_version: 2.4.5.1
|
152
155
|
signing_key:
|
153
156
|
specification_version: 4
|
154
157
|
summary: A rails engine that support IIIF requests
|
155
158
|
test_files:
|
156
159
|
- spec/controllers/images_controller_spec.rb
|
160
|
+
- spec/models/akubra_system_file_resolver_spec.rb
|
157
161
|
- spec/models/file_system_file_resolver_spec.rb
|
158
162
|
- spec/models/http_file_resolver_spec.rb
|
159
163
|
- spec/models/image_spec.rb
|