iiif-presentation 0.2.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/workflows/ruby.yml +35 -0
- data/Gemfile +8 -0
- data/README.md +2 -3
- data/VERSION +1 -1
- data/iiif-presentation.gemspec +1 -1
- data/lib/iiif/hash_behaviours.rb +1 -1
- data/lib/iiif/presentation/abstract_resource.rb +1 -2
- data/lib/iiif/presentation/image_resource.rb +6 -1
- data/lib/iiif/service.rb +11 -9
- data/spec/fixtures/vcr_cassettes/pul_loris_cassette.json +1 -159
- data/spec/integration/iiif/presentation/image_resource_spec.rb +10 -8
- data/spec/integration/iiif/service_spec.rb +7 -0
- data/spec/spec_helper.rb +1 -1
- metadata +9 -12
- data/.travis.yml +0 -11
- data/gemfiles/rails3.gemfile +0 -5
- data/gemfiles/rails4.gemfile +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 39369e50dc0a31ebfdac97d49008eb26e020ac21c595c400906dc6a54de45097
|
4
|
+
data.tar.gz: e127162464e102ef0d2ee9800cf81713e0cd681edde07e3123bf5353b1b1fb90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 230c5a28d5e5dbc405b32f9e6ca1f3d60e7f8e2d3cbbeab85f9650dbf24bb701d0a1c6af1b29d1cd844ac971e11e1ab8a65644cf10f33778e1465d8b1fcc01ad
|
7
|
+
data.tar.gz: 0ab62efe7287d7eaae0ae7ab2a569b18cd2238753569e15857478976a834e5746df1dd919befe211299f31fae63822a735e25fe9da22b5e74b7d05b08457e608
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ "development" ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ "development" ]
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: read
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
test:
|
21
|
+
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
strategy:
|
24
|
+
matrix:
|
25
|
+
ruby-version: ['2.7', '3.0', '3.1', '3.2']
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v3
|
29
|
+
- name: Set up Ruby
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
+
- name: Run tests
|
35
|
+
run: bundle exec rake
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
# O'Sullivan: A Ruby API for working with IIIF Presentation manifests
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/iiif-prezi/osullivan.svg?branch=development)](https://travis-ci.org/iiif-prezi/osullivan)
|
4
3
|
[![Coverage Status](https://coveralls.io/repos/github/iiif-prezi/osullivan/badge.svg?branch=development)](https://coveralls.io/github/iiif-prezi/osullivan?branch=development)
|
5
4
|
|
6
5
|
|
@@ -82,7 +81,7 @@ puts manifest.to_json(pretty: true, force: true) # force: true skips validations
|
|
82
81
|
## Parsing Existing Objects
|
83
82
|
|
84
83
|
Use `IIIF::Service#parse`. It will figure out what the object
|
85
|
-
should be, based on `@type`, and fall back to `
|
84
|
+
should be, based on `@type`, and fall back to `Hash` when
|
86
85
|
it can't e.g.:
|
87
86
|
|
88
87
|
```ruby
|
@@ -133,7 +132,7 @@ puts obj.class
|
|
133
132
|
puts obj.see_also.class
|
134
133
|
|
135
134
|
> IIIF::Presentation::Manifest
|
136
|
-
>
|
135
|
+
> Hash
|
137
136
|
```
|
138
137
|
|
139
138
|
## Validation and Exceptions
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
1.1.0
|
data/iiif-presentation.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.add_development_dependency 'coveralls'
|
21
21
|
spec.add_development_dependency 'webmock'
|
22
22
|
spec.add_development_dependency 'multi_json'
|
23
|
-
spec.add_development_dependency 'vcr', '~>
|
23
|
+
spec.add_development_dependency 'vcr', '~> 5'
|
24
24
|
|
25
25
|
spec.add_dependency 'json'
|
26
26
|
spec.add_dependency 'activesupport', '>= 3.2.18'
|
data/lib/iiif/hash_behaviours.rb
CHANGED
@@ -8,7 +8,7 @@ module IIIF
|
|
8
8
|
# * reject
|
9
9
|
# * replace
|
10
10
|
|
11
|
-
def_delegators :@data, :[], :[]=, :camelize_keys, :delete, :empty?,
|
11
|
+
def_delegators :@data, :[], :[]=, :camelize_keys, :delete, :dig, :empty?,
|
12
12
|
:fetch, :has_key?, :has_value?, :include?, :insert, :insert_after,
|
13
13
|
:insert_before, :key, :key?, :keys, :length, :member?, :shift, :size,
|
14
14
|
:snakeize_keys, :store, :unshift, :value?, :values
|
@@ -46,8 +46,7 @@ module IIIF
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# Initialize a Presentation node
|
49
|
-
# @param [Hash] hsh - Anything in this hash will be added to the Object.
|
50
|
-
# Order is only guaranteed if an ActiveSupport::OrderedHash is passed.
|
49
|
+
# @param [Hash] hsh - Anything in this hash will be added to the Object.
|
51
50
|
# @param [boolean] include_context (default: false). Pass true if the'
|
52
51
|
# context should be included.
|
53
52
|
def initialize(hsh={})
|
@@ -103,7 +103,12 @@ module IIIF
|
|
103
103
|
def get_info(svc_id)
|
104
104
|
conn = Faraday.new("#{svc_id}/info.json") do |c|
|
105
105
|
c.use Faraday::Response::RaiseError
|
106
|
-
|
106
|
+
|
107
|
+
if c.respond_to? :adapter
|
108
|
+
c.adapter Faraday.default_adapter
|
109
|
+
else
|
110
|
+
c.use Faraday::Adapter::NetHttp
|
111
|
+
end
|
107
112
|
end
|
108
113
|
resp = conn.get # raises exceptions that indicate HTTP problems
|
109
114
|
JSON.parse(resp.body)
|
data/lib/iiif/service.rb
CHANGED
@@ -33,9 +33,9 @@ module IIIF
|
|
33
33
|
# Parse from a file path, string, or existing hash
|
34
34
|
def parse(s)
|
35
35
|
ordered_hash = nil
|
36
|
-
if s.kind_of?(String) && File.
|
36
|
+
if s.kind_of?(String) && File.exist?(s)
|
37
37
|
ordered_hash = IIIF::OrderedHash[JSON.parse(IO.read(s))]
|
38
|
-
elsif s.kind_of?(String) && !File.
|
38
|
+
elsif s.kind_of?(String) && !File.exist?(s)
|
39
39
|
ordered_hash = IIIF::OrderedHash[JSON.parse(s)]
|
40
40
|
elsif s.kind_of?(Hash)
|
41
41
|
ordered_hash = IIIF::OrderedHash[s]
|
@@ -206,17 +206,13 @@ module IIIF
|
|
206
206
|
|
207
207
|
hsh.keys.each do |key|
|
208
208
|
new_key = key.underscore == key ? key : key.underscore
|
209
|
-
if
|
210
|
-
new_object[new_key] = IIIF::Service.from_ordered_hash(hsh[key], IIIF::Service)
|
211
|
-
elsif new_key == 'resource'
|
212
|
-
new_object[new_key] = IIIF::Service.from_ordered_hash(hsh[key], IIIF::Presentation::Resource)
|
213
|
-
elsif hsh[key].kind_of?(Hash)
|
214
|
-
new_object[new_key] = IIIF::Service.from_ordered_hash(hsh[key])
|
215
|
-
elsif hsh[key].kind_of?(Array)
|
209
|
+
if hsh[key].kind_of?(Array)
|
216
210
|
new_object[new_key] = []
|
217
211
|
hsh[key].each do |member|
|
218
212
|
if new_key == 'service'
|
219
213
|
new_object[new_key] << IIIF::Service.from_ordered_hash(member, IIIF::Service)
|
214
|
+
elsif new_key == 'resource'
|
215
|
+
new_object[new_key] << IIIF::Service.from_ordered_hash(hsh[key], IIIF::Presentation::Resource)
|
220
216
|
elsif member.kind_of?(Hash)
|
221
217
|
new_object[new_key] << IIIF::Service.from_ordered_hash(member)
|
222
218
|
else
|
@@ -224,6 +220,12 @@ module IIIF
|
|
224
220
|
# Again, no nested arrays, right?
|
225
221
|
end
|
226
222
|
end
|
223
|
+
elsif new_key == 'service'
|
224
|
+
new_object[new_key] = IIIF::Service.from_ordered_hash(hsh[key], IIIF::Service)
|
225
|
+
elsif new_key == 'resource'
|
226
|
+
new_object[new_key] = IIIF::Service.from_ordered_hash(hsh[key], IIIF::Presentation::Resource)
|
227
|
+
elsif hsh[key].kind_of?(Hash)
|
228
|
+
new_object[new_key] = IIIF::Service.from_ordered_hash(hsh[key])
|
227
229
|
else
|
228
230
|
new_object[new_key] = hsh[key]
|
229
231
|
end
|
@@ -1,159 +1 @@
|
|
1
|
-
{
|
2
|
-
"http_interactions": [
|
3
|
-
{
|
4
|
-
"request": {
|
5
|
-
"method": "get",
|
6
|
-
"uri": "http://libimages.princeton.edu/loris2/pudl0001%2F4612422%2F00000001.jp2/info.json",
|
7
|
-
"body": {
|
8
|
-
"encoding": "US-ASCII",
|
9
|
-
"string": ""
|
10
|
-
},
|
11
|
-
"headers": {
|
12
|
-
"User-Agent": [
|
13
|
-
"Faraday v0.9.0"
|
14
|
-
],
|
15
|
-
"Accept-Encoding": [
|
16
|
-
"gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
|
17
|
-
],
|
18
|
-
"Accept": [
|
19
|
-
"*/*"
|
20
|
-
]
|
21
|
-
}
|
22
|
-
},
|
23
|
-
"response": {
|
24
|
-
"status": {
|
25
|
-
"code": 200,
|
26
|
-
"message": "OK"
|
27
|
-
},
|
28
|
-
"headers": {
|
29
|
-
"Server": [
|
30
|
-
"Apache/2.2.22 (Ubuntu)"
|
31
|
-
],
|
32
|
-
"Link": [
|
33
|
-
"<http://iiif.io/api/image/2/level2.json>;rel=\"profile\",<http://iiif.io/api/image/2/context.json>;rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\""
|
34
|
-
],
|
35
|
-
"Access-Control-Allow-Origin": [
|
36
|
-
"*"
|
37
|
-
],
|
38
|
-
"Last-Modified": [
|
39
|
-
"Wed, 26 Nov 2014 21:16:14 GMT"
|
40
|
-
],
|
41
|
-
"Cache-Control": [
|
42
|
-
"max-age=5184000"
|
43
|
-
],
|
44
|
-
"Expires": [
|
45
|
-
"Sun, 25 Jan 2015 21:16:14 GMT"
|
46
|
-
],
|
47
|
-
"Content-Type": [
|
48
|
-
"application/json"
|
49
|
-
],
|
50
|
-
"Content-Length": [
|
51
|
-
"737"
|
52
|
-
],
|
53
|
-
"Accept-Ranges": [
|
54
|
-
"bytes"
|
55
|
-
],
|
56
|
-
"Date": [
|
57
|
-
"Thu, 27 Nov 2014 00:55:14 GMT"
|
58
|
-
],
|
59
|
-
"X-Varnish": [
|
60
|
-
"1471998866 1471996229"
|
61
|
-
],
|
62
|
-
"Age": [
|
63
|
-
"13140"
|
64
|
-
],
|
65
|
-
"Via": [
|
66
|
-
"1.1 varnish"
|
67
|
-
],
|
68
|
-
"Connection": [
|
69
|
-
"keep-alive"
|
70
|
-
]
|
71
|
-
},
|
72
|
-
"body": {
|
73
|
-
"encoding": "UTF-8",
|
74
|
-
"string": "{\"profile\": [\"http://iiif.io/api/image/2/level2.json\", {\"supports\": [\"canonicalLinkHeader\", \"profileLinkHeader\", \"mirroring\", \"rotationArbitrary\", \"sizeAboveFull\"], \"qualities\": [\"default\", \"bitonal\", \"gray\", \"color\"], \"formats\": [\"jpg\", \"png\", \"gif\", \"webp\"]}], \"tiles\": [{\"width\": 1024, \"scaleFactors\": [1, 2, 4, 8, 16, 32]}], \"protocol\": \"http://iiif.io/api/image\", \"sizes\": [{\"width\": 96, \"height\": 225}, {\"width\": 191, \"height\": 450}, {\"width\": 381, \"height\": 900}, {\"width\": 762, \"height\": 1800}, {\"width\": 1524, \"height\": 3600}, {\"width\": 3047, \"height\": 7200}], \"height\": 7200, \"width\": 3047, \"@context\": \"http://iiif.io/api/image/2/context.json\", \"@id\": \"http://libimages.princeton.edu/loris2/pudl0001%2F4612422%2F00000001.jp2\"}"
|
75
|
-
},
|
76
|
-
"http_version": null
|
77
|
-
},
|
78
|
-
"recorded_at": "Thu, 27 Nov 2014 01:00:58 GMT"
|
79
|
-
},
|
80
|
-
{
|
81
|
-
"request": {
|
82
|
-
"method": "get",
|
83
|
-
"uri": "http://libimages.princeton.edu/loris2/xxxx%2F4612422%2F00000001.jp2/info.json",
|
84
|
-
"body": {
|
85
|
-
"encoding": "US-ASCII",
|
86
|
-
"string": ""
|
87
|
-
},
|
88
|
-
"headers": {
|
89
|
-
"User-Agent": [
|
90
|
-
"Faraday v0.9.0"
|
91
|
-
],
|
92
|
-
"Accept-Encoding": [
|
93
|
-
"gzip;q=1.0,deflate;q=0.6,identity;q=0.3"
|
94
|
-
],
|
95
|
-
"Accept": [
|
96
|
-
"*/*"
|
97
|
-
]
|
98
|
-
}
|
99
|
-
},
|
100
|
-
"response": {
|
101
|
-
"status": {
|
102
|
-
"code": 404,
|
103
|
-
"message": "NOT FOUND"
|
104
|
-
},
|
105
|
-
"headers": {
|
106
|
-
"Server": [
|
107
|
-
"Apache/2.2.22 (Ubuntu)"
|
108
|
-
],
|
109
|
-
"Link": [
|
110
|
-
"<http://iiif.io/api/image/2/level2.json>;rel=\"profile\""
|
111
|
-
],
|
112
|
-
"Access-Control-Allow-Origin": [
|
113
|
-
"*"
|
114
|
-
],
|
115
|
-
"Cache-Control": [
|
116
|
-
"max-age=5184000"
|
117
|
-
],
|
118
|
-
"Expires": [
|
119
|
-
"Mon, 26 Jan 2015 10:20:46 GMT"
|
120
|
-
],
|
121
|
-
"Vary": [
|
122
|
-
"Accept-Encoding"
|
123
|
-
],
|
124
|
-
"Content-Type": [
|
125
|
-
"text/plain"
|
126
|
-
],
|
127
|
-
"Content-Length": [
|
128
|
-
"88"
|
129
|
-
],
|
130
|
-
"Accept-Ranges": [
|
131
|
-
"bytes"
|
132
|
-
],
|
133
|
-
"Date": [
|
134
|
-
"Thu, 27 Nov 2014 10:20:46 GMT"
|
135
|
-
],
|
136
|
-
"X-Varnish": [
|
137
|
-
"1472002765"
|
138
|
-
],
|
139
|
-
"Age": [
|
140
|
-
"0"
|
141
|
-
],
|
142
|
-
"Via": [
|
143
|
-
"1.1 varnish"
|
144
|
-
],
|
145
|
-
"Connection": [
|
146
|
-
"keep-alive"
|
147
|
-
]
|
148
|
-
},
|
149
|
-
"body": {
|
150
|
-
"encoding": "UTF-8",
|
151
|
-
"string": "Not Found: could not resolve identifier: xxxx%2F4612422%2F00000001.jp2 (404)"
|
152
|
-
},
|
153
|
-
"http_version": null
|
154
|
-
},
|
155
|
-
"recorded_at": "Thu, 27 Nov 2014 10:26:31 GMT"
|
156
|
-
}
|
157
|
-
],
|
158
|
-
"recorded_with": "VCR 2.9.3"
|
159
|
-
}
|
1
|
+
{"http_interactions":[{"request":{"method":"get","uri":"https://libimages.princeton.edu/loris/pudl0001%2F4612422%2F00000001.jp2/info.json","body":{"encoding":"US-ASCII","string":""},"headers":{"User-Agent":["Faraday v1.0.1"]}},"response":{"status":{"code":200,"message":"OK"},"headers":{"date":["Wed, 17 Jun 2020 19:38:19 GMT"],"server":["Apache/2.4.18 (Ubuntu)"],"link":["<http://iiif.io/api/image/2/level2.json>;rel=\"profile\",<http://iiif.io/api/image/2/context.json>;rel=\"http://www.w3.org/ns/json-ld#context\";type=\"application/ld+json\""],"access-control-allow-origin":["*"],"access-control-allow-methods":["GET"],"access-control-allow-headers":["X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding"],"last-modified":["Sat, 25 Jan 2020 18:37:32 GMT"],"content-length":["753"],"content-type":["application/json"]},"body":{"encoding":"UTF-8","string":"{\"profile\": [\"http://iiif.io/api/image/2/level2.json\", {\"supports\": [\"canonicalLinkHeader\", \"profileLinkHeader\", \"mirroring\", \"rotationArbitrary\", \"regionSquare\", \"sizeAboveFull\"], \"qualities\": [\"default\", \"bitonal\", \"gray\", \"color\"], \"formats\": [\"jpg\", \"png\", \"gif\", \"webp\"]}], \"tiles\": [{\"width\": 1024, \"scaleFactors\": [1, 2, 4, 8, 16, 32]}], \"protocol\": \"http://iiif.io/api/image\", \"sizes\": [{\"width\": 96, \"height\": 225}, {\"width\": 191, \"height\": 450}, {\"width\": 381, \"height\": 900}, {\"width\": 762, \"height\": 1800}, {\"width\": 1524, \"height\": 3600}, {\"width\": 3047, \"height\": 7200}], \"height\": 7200, \"width\": 3047, \"@context\": \"http://iiif.io/api/image/2/context.json\", \"@id\": \"https://libimages.princeton.edu/loris/pudl0001%2F4612422%2F00000001.jp2\"}"},"http_version":null},"recorded_at":"Wed, 17 Jun 2020 19:38:19 GMT"},{"request":{"method":"get","uri":"https://libimages.princeton.edu/loris/xxxx%2F4612422%2F00000001.jp2/info.json","body":{"encoding":"US-ASCII","string":""},"headers":{"User-Agent":["Faraday v1.0.1"]}},"response":{"status":{"code":404,"message":"NOT FOUND"},"headers":{"date":["Wed, 17 Jun 2020 19:38:20 GMT"],"server":["Apache/2.4.18 (Ubuntu)"],"link":["<http://iiif.io/api/image/2/level2.json>;rel=\"profile\""],"access-control-allow-origin":["*"],"access-control-allow-methods":["GET"],"access-control-allow-headers":["X-Requested-With, Content-Type, Origin, Authorization, Accept, Client-Security-Token, Accept-Encoding"],"content-length":["86"],"content-type":["text/plain"]},"body":{"encoding":"UTF-8","string":"Not Found: Source image not found for identifier: xxxx%2F4612422%2F00000001.jp2. (404)"},"http_version":null},"recorded_at":"Wed, 17 Jun 2020 19:38:20 GMT"}],"recorded_with":"VCR 5.1.0"}
|
@@ -7,7 +7,8 @@ describe IIIF::Presentation::ImageResource do
|
|
7
7
|
|
8
8
|
describe 'self#create_image_api_image_resource', vcr: vcr_options do
|
9
9
|
|
10
|
-
|
10
|
+
# 301 moved to https.../loris
|
11
|
+
let(:image_server) { 'https://libimages.princeton.edu/loris' }
|
11
12
|
|
12
13
|
let(:valid_service_id) {
|
13
14
|
id = 'pudl0001%2F4612422%2F00000001.jp2'
|
@@ -31,31 +32,31 @@ describe IIIF::Presentation::ImageResource do
|
|
31
32
|
resource = described_class.create_image_api_image_resource(opts)
|
32
33
|
# expect(resource['@context']).to eq 'http://iiif.io/api/presentation/2/context.json'
|
33
34
|
# @context is only added when we call to_json...
|
34
|
-
expect(resource['@id']).to eq '
|
35
|
+
expect(resource['@id']).to eq 'https://libimages.princeton.edu/loris/pudl0001%2F4612422%2F00000001.jp2/full/!200,200/0/default.jpg'
|
35
36
|
expect(resource['@type']).to eq 'dctypes:Image'
|
36
37
|
expect(resource.format).to eq "image/jpeg"
|
37
38
|
expect(resource.width).to eq 3047
|
38
39
|
expect(resource.height).to eq 7200
|
39
40
|
expect(resource.service['@context']).to eq 'http://iiif.io/api/image/2/context.json'
|
40
|
-
expect(resource.service['@id']).to eq '
|
41
|
+
expect(resource.service['@id']).to eq 'https://libimages.princeton.edu/loris/pudl0001%2F4612422%2F00000001.jp2'
|
41
42
|
expect(resource.service['profile']).to eq 'http://iiif.io/api/image/2/level2.json'
|
42
43
|
end
|
43
|
-
it 'copies over all
|
44
|
+
it 'copies over all the info (when copy_info is true)' do
|
44
45
|
opts = { service_id: valid_service_id, copy_info: true }
|
45
46
|
resource = described_class.create_image_api_image_resource(opts)
|
46
|
-
expect(resource['@id']).to eq '
|
47
|
+
expect(resource['@id']).to eq 'https://libimages.princeton.edu/loris/pudl0001%2F4612422%2F00000001.jp2/full/!200,200/0/default.jpg'
|
47
48
|
expect(resource['@type']).to eq 'dctypes:Image'
|
48
49
|
expect(resource.format).to eq "image/jpeg"
|
49
50
|
expect(resource.width).to eq 3047
|
50
51
|
expect(resource.height).to eq 7200
|
51
52
|
expect(resource.service['@context']).to eq 'http://iiif.io/api/image/2/context.json'
|
52
|
-
expect(resource.service['@id']).to eq '
|
53
|
+
expect(resource.service['@id']).to eq 'https://libimages.princeton.edu/loris/pudl0001%2F4612422%2F00000001.jp2'
|
53
54
|
expect(resource.service['profile']).to eq [
|
54
55
|
'http://iiif.io/api/image/2/level2.json',
|
55
56
|
{
|
56
57
|
'supports' => [
|
57
58
|
'canonicalLinkHeader', 'profileLinkHeader', 'mirroring',
|
58
|
-
'rotationArbitrary', 'sizeAboveFull'
|
59
|
+
'rotationArbitrary', 'regionSquare', 'sizeAboveFull'
|
59
60
|
],
|
60
61
|
'qualities' => ['default', 'bitonal', 'gray', 'color'],
|
61
62
|
'formats'=>['jpg', 'png', 'gif', 'webp']
|
@@ -78,7 +79,8 @@ describe IIIF::Presentation::ImageResource do
|
|
78
79
|
|
79
80
|
describe 'respects the params we supply' do
|
80
81
|
it ':resource_id' do
|
81
|
-
r_id = 'http://example.edu/images/some.jpg'
|
82
|
+
r_id = 'http://example.edu/images/some.jpg'
|
83
|
+
|
82
84
|
opts = { service_id: valid_service_id, resource_id: r_id}
|
83
85
|
resource = described_class.create_image_api_image_resource(opts)
|
84
86
|
expect(resource['@id']).to eq r_id
|
@@ -106,6 +106,13 @@ describe IIIF::Service do
|
|
106
106
|
expect(parsed['service'].class).to be expected_klass
|
107
107
|
end
|
108
108
|
|
109
|
+
it 'works with arrays of services' do
|
110
|
+
expected_klass = IIIF::Service
|
111
|
+
fixture['service'] = [fixture['service']]
|
112
|
+
parsed = described_class.from_ordered_hash(fixture)
|
113
|
+
expect(parsed['service'].first.class).to be expected_klass
|
114
|
+
end
|
115
|
+
|
109
116
|
it 'round-trips' do
|
110
117
|
fp = '/tmp/osullivan-spec.json'
|
111
118
|
parsed = described_class.from_ordered_hash(fixture)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iiif-presentation
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Stroop
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
103
|
+
version: '5'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
110
|
+
version: '5'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: json
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,16 +157,14 @@ executables: []
|
|
157
157
|
extensions: []
|
158
158
|
extra_rdoc_files: []
|
159
159
|
files:
|
160
|
+
- ".github/workflows/ruby.yml"
|
160
161
|
- ".gitignore"
|
161
162
|
- ".rspec"
|
162
|
-
- ".travis.yml"
|
163
163
|
- Gemfile
|
164
164
|
- LICENSE
|
165
165
|
- README.md
|
166
166
|
- Rakefile
|
167
167
|
- VERSION
|
168
|
-
- gemfiles/rails3.gemfile
|
169
|
-
- gemfiles/rails4.gemfile
|
170
168
|
- iiif-presentation.gemspec
|
171
169
|
- lib/iiif/hash_behaviours.rb
|
172
170
|
- lib/iiif/ordered_hash.rb
|
@@ -213,7 +211,7 @@ homepage: https://github.com/iiif/osullivan
|
|
213
211
|
licenses:
|
214
212
|
- Simplified BSD
|
215
213
|
metadata: {}
|
216
|
-
post_install_message:
|
214
|
+
post_install_message:
|
217
215
|
rdoc_options: []
|
218
216
|
require_paths:
|
219
217
|
- lib
|
@@ -228,9 +226,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
228
226
|
- !ruby/object:Gem::Version
|
229
227
|
version: '0'
|
230
228
|
requirements: []
|
231
|
-
|
232
|
-
|
233
|
-
signing_key:
|
229
|
+
rubygems_version: 3.3.26
|
230
|
+
signing_key:
|
234
231
|
specification_version: 4
|
235
232
|
summary: API for working with IIIF Presentation manifests.
|
236
233
|
test_files:
|
data/.travis.yml
DELETED
data/gemfiles/rails3.gemfile
DELETED