iiif-presentation 1.4.2 → 1.5.0

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.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ruby.yml +8 -1
  3. data/.standard.yml +1 -0
  4. data/Gemfile +5 -5
  5. data/README.md +1 -1
  6. data/Rakefile +4 -2
  7. data/VERSION +1 -1
  8. data/bin/standardrb +16 -0
  9. data/iiif-presentation.gemspec +23 -23
  10. data/lib/iiif/hash_behaviours.rb +29 -33
  11. data/lib/iiif/ordered_hash.rb +33 -33
  12. data/lib/iiif/presentation/abstract_resource.rb +17 -22
  13. data/lib/iiif/presentation/annotation.rb +9 -11
  14. data/lib/iiif/presentation/annotation_list.rb +8 -10
  15. data/lib/iiif/presentation/canvas.rb +11 -13
  16. data/lib/iiif/presentation/collection.rb +7 -9
  17. data/lib/iiif/presentation/image_resource.rb +33 -35
  18. data/lib/iiif/presentation/layer.rb +8 -10
  19. data/lib/iiif/presentation/manifest.rb +9 -12
  20. data/lib/iiif/presentation/range.rb +8 -10
  21. data/lib/iiif/presentation/resource.rb +5 -7
  22. data/lib/iiif/presentation/sequence.rb +8 -11
  23. data/lib/iiif/presentation/service.rb +1 -2
  24. data/lib/iiif/presentation.rb +7 -7
  25. data/lib/iiif/service.rb +121 -102
  26. data/lib/iiif/v3/abstract_resource.rb +127 -130
  27. data/lib/iiif/v3/presentation/annotation.rb +20 -21
  28. data/lib/iiif/v3/presentation/annotation_collection.rb +7 -9
  29. data/lib/iiif/v3/presentation/annotation_page.rb +14 -15
  30. data/lib/iiif/v3/presentation/canvas.rb +21 -22
  31. data/lib/iiif/v3/presentation/choice.rb +14 -15
  32. data/lib/iiif/v3/presentation/collection.rb +7 -8
  33. data/lib/iiif/v3/presentation/image_resource.rb +21 -22
  34. data/lib/iiif/v3/presentation/manifest.rb +18 -19
  35. data/lib/iiif/v3/presentation/nav_place.rb +125 -29
  36. data/lib/iiif/v3/presentation/range.rb +10 -10
  37. data/lib/iiif/v3/presentation/resource.rb +4 -5
  38. data/lib/iiif/v3/presentation/sequence.rb +10 -11
  39. data/lib/iiif/v3/presentation/service.rb +12 -13
  40. data/lib/iiif/v3/presentation.rb +8 -8
  41. data/spec/integration/iiif/presentation/image_resource_spec.rb +54 -58
  42. data/spec/integration/iiif/service_spec.rb +76 -77
  43. data/spec/integration/iiif/v3/abstract_resource_spec.rb +72 -73
  44. data/spec/integration/iiif/v3/presentation/image_resource_spec.rb +53 -56
  45. data/spec/spec_helper.rb +56 -64
  46. data/spec/unit/iiif/hash_behaviours_spec.rb +384 -387
  47. data/spec/unit/iiif/ordered_hash_spec.rb +86 -91
  48. data/spec/unit/iiif/presentation/abstract_resource_spec.rb +64 -70
  49. data/spec/unit/iiif/presentation/annotation_list_spec.rb +1 -3
  50. data/spec/unit/iiif/presentation/annotation_spec.rb +1 -3
  51. data/spec/unit/iiif/presentation/canvas_spec.rb +11 -14
  52. data/spec/unit/iiif/presentation/collection_spec.rb +26 -33
  53. data/spec/unit/iiif/presentation/image_resource_spec.rb +4 -6
  54. data/spec/unit/iiif/presentation/layer_spec.rb +16 -20
  55. data/spec/unit/iiif/presentation/manifest_spec.rb +45 -48
  56. data/spec/unit/iiif/presentation/range_spec.rb +18 -22
  57. data/spec/unit/iiif/presentation/resource_spec.rb +3 -6
  58. data/spec/unit/iiif/presentation/sequence_spec.rb +58 -63
  59. data/spec/unit/iiif/presentation/shared_examples/abstract_resource_only_keys.rb +4 -10
  60. data/spec/unit/iiif/presentation/shared_examples/any_type_keys.rb +5 -9
  61. data/spec/unit/iiif/presentation/shared_examples/array_only_keys.rb +9 -17
  62. data/spec/unit/iiif/presentation/shared_examples/int_only_keys.rb +6 -14
  63. data/spec/unit/iiif/presentation/shared_examples/string_only_keys.rb +6 -13
  64. data/spec/unit/iiif/service_spec.rb +8 -13
  65. data/spec/unit/iiif/v3/abstract_resource_define_methods_for_spec.rb +39 -37
  66. data/spec/unit/iiif/v3/abstract_resource_spec.rb +124 -131
  67. data/spec/unit/iiif/v3/presentation/annotation_collection_spec.rb +14 -17
  68. data/spec/unit/iiif/v3/presentation/annotation_page_spec.rb +71 -69
  69. data/spec/unit/iiif/v3/presentation/annotation_spec.rb +249 -233
  70. data/spec/unit/iiif/v3/presentation/canvas_spec.rb +211 -193
  71. data/spec/unit/iiif/v3/presentation/choice_spec.rb +81 -77
  72. data/spec/unit/iiif/v3/presentation/collection_spec.rb +24 -29
  73. data/spec/unit/iiif/v3/presentation/image_resource_spec.rb +70 -71
  74. data/spec/unit/iiif/v3/presentation/manifest_spec.rb +248 -235
  75. data/spec/unit/iiif/v3/presentation/nav_place_spec.rb +249 -49
  76. data/spec/unit/iiif/v3/presentation/range_spec.rb +28 -29
  77. data/spec/unit/iiif/v3/presentation/resource_spec.rb +83 -82
  78. data/spec/unit/iiif/v3/presentation/sequence_spec.rb +125 -119
  79. data/spec/unit/iiif/v3/presentation/service_spec.rb +123 -124
  80. data/spec/unit/iiif/v3/presentation/shared_examples/abstract_resource_only_keys.rb +4 -8
  81. data/spec/unit/iiif/v3/presentation/shared_examples/any_type_keys.rb +5 -7
  82. data/spec/unit/iiif/v3/presentation/shared_examples/array_only_keys.rb +9 -13
  83. data/spec/unit/iiif/v3/presentation/shared_examples/hash_only_keys.rb +9 -13
  84. data/spec/unit/iiif/v3/presentation/shared_examples/int_only_keys.rb +6 -10
  85. data/spec/unit/iiif/v3/presentation/shared_examples/numeric_only_keys.rb +6 -10
  86. data/spec/unit/iiif/v3/presentation/shared_examples/string_only_keys.rb +6 -10
  87. data/spec/unit/iiif/v3/presentation/shared_examples/uri_only_keys.rb +9 -13
  88. metadata +26 -65
@@ -1,119 +1,123 @@
1
1
  describe IIIF::V3::Presentation::Choice do
2
-
3
- describe '#prohibited_keys' do
4
- it 'contains the expected key names' do
2
+ describe "#prohibited_keys" do
3
+ it "contains the expected key names" do
5
4
  keys = described_class::PAGING_PROPERTIES +
6
5
  described_class::CONTENT_RESOURCE_PROPERTIES +
7
- %w{
8
- nav_date
9
- viewing_direction
10
- start_canvas
11
- content_annotations
12
- }
13
- expect(subject.prohibited_keys).to include(*keys)
14
- end
6
+ %w[
7
+ nav_date
8
+ viewing_direction
9
+ start_canvas
10
+ content_annotations
11
+ ]
12
+ expect(subject.prohibited_keys).to include(*keys)
13
+ end
15
14
  end
16
15
 
17
- describe '#any_type_keys' do
18
- it 'default' do
19
- expect(subject.any_type_keys).to include('default')
16
+ describe "#any_type_keys" do
17
+ it "default" do
18
+ expect(subject.any_type_keys).to include("default")
20
19
  end
21
20
  end
22
21
 
23
- describe '#string_only_keys' do
24
- it 'choice_hint' do
25
- expect(subject.string_only_keys).to include('choice_hint')
22
+ describe "#string_only_keys" do
23
+ it "choice_hint" do
24
+ expect(subject.string_only_keys).to include("choice_hint")
26
25
  end
27
26
  end
28
27
 
29
- describe '#array_only_keys' do
30
- it 'items' do
31
- expect(subject.array_only_keys).to include('items')
28
+ describe "#array_only_keys" do
29
+ it "items" do
30
+ expect(subject.array_only_keys).to include("items")
32
31
  end
33
32
  end
34
33
 
35
- describe '#legal_choice_hint_values' do
36
- it 'contains the expected values' do
37
- expect(subject.legal_choice_hint_values).to contain_exactly('client', 'user')
34
+ describe "#legal_choice_hint_values" do
35
+ it "contains the expected values" do
36
+ expect(subject.legal_choice_hint_values).to contain_exactly("client", "user")
38
37
  end
39
38
  end
40
39
 
41
- describe '#legal_viewing_hint_values' do
42
- it 'contains none' do
43
- expect(subject.legal_viewing_hint_values).to contain_exactly('none')
40
+ describe "#legal_viewing_hint_values" do
41
+ it "contains none" do
42
+ expect(subject.legal_viewing_hint_values).to contain_exactly("none")
44
43
  end
45
44
  end
46
45
 
47
- describe '#initialize' do
48
- it 'sets type to Choice by default' do
49
- expect(subject['type']).to eq 'Choice'
46
+ describe "#initialize" do
47
+ it "sets type to Choice by default" do
48
+ expect(subject["type"]).to eq "Choice"
50
49
  end
51
- it 'allows subclasses to override type' do
50
+ it "allows subclasses to override type" do
52
51
  subclass = Class.new(described_class) do
53
- def initialize(hsh={})
54
- hsh = { 'type' => 'a:SubClass' }
55
- super(hsh)
52
+ def initialize(_hsh = {})
53
+ super({"type" => "a:SubClass"})
56
54
  end
57
55
  end
58
56
  sub = subclass.new
59
- expect(sub['type']).to eq 'a:SubClass'
57
+ expect(sub["type"]).to eq "a:SubClass"
60
58
  end
61
- it 'allows type to be passed in' do
62
- my_choice = described_class.new('type' => 'bar')
63
- expect(my_choice.type).to eq 'bar'
59
+ it "allows type to be passed in" do
60
+ my_choice = described_class.new("type" => "bar")
61
+ expect(my_choice.type).to eq "bar"
64
62
  end
65
63
  end
66
64
 
67
- describe '#validate' do
68
- it 'raises an IllegalValueError if choice_hint isn\'t an allowable value' do
65
+ describe "#validate" do
66
+ it "raises an IllegalValueError if choice_hint isn't an allowable value" do
69
67
  exp_err_msg = "choiceHint for #{described_class} must be one of [\"client\", \"user\"]."
70
- subject['choice_hint'] = 'foo'
68
+ subject["choice_hint"] = "foo"
71
69
  expect { subject.validate }.to raise_error IIIF::V3::Presentation::IllegalValueError, exp_err_msg
72
70
  end
73
71
  end
74
72
 
75
- describe 'realistic examples' do
76
- describe 'from digerati' do
77
- let(:item_type) { 'Video' }
78
- let(:item1_id) { 'http://example.org/foo.mp4f' }
79
- let(:item1_mime) { 'video/mp4' }
80
- let(:item1_res) { IIIF::V3::Presentation::Resource.new(
81
- 'id' => item1_id,
82
- 'type' => item_type,
83
- 'format' => item1_mime
84
- )}
85
- let(:item2_id) { 'http://example.org/foo.webm' }
86
- let(:item2_mime) { 'video/webm' }
87
- let(:item2_res) { IIIF::V3::Presentation::Resource.new(
88
- 'id' => item2_id,
89
- 'type' => item_type,
90
- 'format' => item2_mime
91
- )}
92
- let(:choice) { IIIF::V3::Presentation::Choice.new(
93
- 'choiceHint' => 'client',
94
- 'items' => [item1_res, item2_res]
95
- )}
96
- it 'validates' do
97
- expect{choice.validate}.not_to raise_error
73
+ describe "realistic examples" do
74
+ describe "from digerati" do
75
+ let(:item_type) { "Video" }
76
+ let(:item1_id) { "http://example.org/foo.mp4f" }
77
+ let(:item1_mime) { "video/mp4" }
78
+ let(:item1_res) {
79
+ IIIF::V3::Presentation::Resource.new(
80
+ "id" => item1_id,
81
+ "type" => item_type,
82
+ "format" => item1_mime
83
+ )
84
+ }
85
+ let(:item2_id) { "http://example.org/foo.webm" }
86
+ let(:item2_mime) { "video/webm" }
87
+ let(:item2_res) {
88
+ IIIF::V3::Presentation::Resource.new(
89
+ "id" => item2_id,
90
+ "type" => item_type,
91
+ "format" => item2_mime
92
+ )
93
+ }
94
+ let(:choice) {
95
+ IIIF::V3::Presentation::Choice.new(
96
+ "choiceHint" => "client",
97
+ "items" => [item1_res, item2_res]
98
+ )
99
+ }
100
+ it "validates" do
101
+ expect { choice.validate }.not_to raise_error
98
102
  end
99
- it 'has expected required values' do
100
- expect(choice['type']).to eq 'Choice'
103
+ it "has expected required values" do
104
+ expect(choice["type"]).to eq "Choice"
101
105
  end
102
- it 'has expected additional values' do
106
+ it "has expected additional values" do
103
107
  expect(choice.id).to be_nil
104
- expect(choice['choice_hint']).to eq 'client'
105
- expect(choice.choiceHint).to eq 'client'
106
- expect(choice['items']).to eq [item1_res, item2_res]
107
- first = choice['items'].first
108
+ expect(choice["choice_hint"]).to eq "client"
109
+ expect(choice.choiceHint).to eq "client"
110
+ expect(choice["items"]).to eq [item1_res, item2_res]
111
+ first = choice["items"].first
108
112
  expect(first.keys.size).to eq 3
109
- expect(first['id']).to eq item1_id
110
- expect(first['type']).to eq item_type
111
- expect(first['format']).to eq item1_mime
112
- second = choice['items'].last
113
+ expect(first["id"]).to eq item1_id
114
+ expect(first["type"]).to eq item_type
115
+ expect(first["format"]).to eq item1_mime
116
+ second = choice["items"].last
113
117
  expect(second.keys.size).to eq 3
114
- expect(second['id']).to eq item2_id
115
- expect(second['type']).to eq item_type
116
- expect(second['format']).to eq item2_mime
118
+ expect(second["id"]).to eq item2_id
119
+ expect(second["type"]).to eq item_type
120
+ expect(second["format"]).to eq item2_mime
117
121
  end
118
122
  end
119
123
  end
@@ -1,55 +1,50 @@
1
1
  describe IIIF::V3::Presentation::Collection do
2
-
3
2
  let(:fixed_values) do
4
3
  {
5
4
  "@context" => [
6
5
  "http://iiif.io/api/presentation/3/context.json",
7
6
  "http://www.w3.org/ns/anno.jsonld"
8
7
  ],
9
- 'id' => 'http://example.org/iiif/collection/top',
10
- 'type' => 'Collection',
11
- 'label' => 'Top Level Collection for Example Organization',
12
- 'description' => 'Description of Collection',
13
- 'attribution' => 'Provided by Example Organization',
14
-
15
- 'collections' => [
16
- { 'id' => 'http://example.org/iiif/collection/part1',
17
- 'type' => 'Collection',
18
- 'label' => 'Sub Collection 1'
19
- },
20
- { 'id' => 'http://example.org/iiif/collection/part2',
21
- 'type' => 'Collection',
22
- 'label' => 'Sub Collection 2'
23
- }
8
+ "id" => "http://example.org/iiif/collection/top",
9
+ "type" => "Collection",
10
+ "label" => "Top Level Collection for Example Organization",
11
+ "description" => "Description of Collection",
12
+ "attribution" => "Provided by Example Organization",
13
+
14
+ "collections" => [
15
+ {"id" => "http://example.org/iiif/collection/part1",
16
+ "type" => "Collection",
17
+ "label" => "Sub Collection 1"},
18
+ {"id" => "http://example.org/iiif/collection/part2",
19
+ "type" => "Collection",
20
+ "label" => "Sub Collection 2"}
24
21
  ],
25
- 'manifests' => [
26
- { 'id' => 'http://example.org/iiif/book1/manifest',
27
- 'type' => 'Manifest',
28
- 'label' => 'Book 1'
29
- }
22
+ "manifests" => [
23
+ {"id" => "http://example.org/iiif/book1/manifest",
24
+ "type" => "Manifest",
25
+ "label" => "Book 1"}
30
26
  ]
31
27
  }
32
28
  end
33
29
 
34
- describe '#initialize' do
35
- it 'sets type to Collection by default' do
36
- expect(subject['type']).to eq 'Collection'
30
+ describe "#initialize" do
31
+ it "sets type to Collection by default" do
32
+ expect(subject["type"]).to eq "Collection"
37
33
  end
38
34
  end
39
35
 
40
36
  describe "#{described_class}.define_methods_for_array_only_keys" do
41
- it_behaves_like 'it has the appropriate methods for array-only keys v3'
37
+ it_behaves_like "it has the appropriate methods for array-only keys v3"
42
38
  end
43
39
 
44
40
  describe "#{described_class}.define_methods_for_string_only_keys" do
45
- it_behaves_like 'it has the appropriate methods for string-only keys v3'
41
+ it_behaves_like "it has the appropriate methods for string-only keys v3"
46
42
  end
47
43
 
48
44
  describe "#{described_class}.define_methods_for_any_type_keys" do
49
- it_behaves_like 'it has the appropriate methods for any-type keys v3'
45
+ it_behaves_like "it has the appropriate methods for any-type keys v3"
50
46
  end
51
47
 
52
- describe '#validate' do
48
+ describe "#validate" do
53
49
  end
54
-
55
50
  end
@@ -1,155 +1,154 @@
1
1
  describe IIIF::V3::Presentation::ImageResource do
2
-
3
- describe '#initialize' do
4
- it 'sets type to Image' do
5
- expect(subject['type']).to eq 'Image'
2
+ describe "#initialize" do
3
+ it "sets type to Image" do
4
+ expect(subject["type"]).to eq "Image"
6
5
  end
7
6
  end
8
7
 
9
- describe 'realistic examples' do
10
- let(:img_id) { 'https://example.org/image/iiif/abc666' }
8
+ describe "realistic examples" do
9
+ let(:img_id) { "https://example.org/image/iiif/abc666" }
11
10
  let(:image_v2_service) {
12
11
  IIIF::V3::Presentation::Service.new(
13
- '@context' => 'http://iiif.io/api/image/2/context.json',
14
- '@id' => img_id,
15
- 'id' => img_id,
16
- 'profile' => 'http://iiif.io/api/image/2/level1.json'
12
+ "@context" => "http://iiif.io/api/image/2/context.json",
13
+ "@id" => img_id,
14
+ "id" => img_id,
15
+ "profile" => "http://iiif.io/api/image/2/level1.json"
17
16
  )
18
17
  }
19
- let(:img_mimetype) { 'image/jpeg' }
18
+ let(:img_mimetype) { "image/jpeg" }
20
19
  let(:width) { 999 }
21
20
  let(:height) { 666 }
22
- describe 'stanford' do
23
- describe 'thumbnail per purl code' do
21
+ describe "stanford" do
22
+ describe "thumbnail per purl code" do
24
23
  let(:thumb_id) { "#{img_id}/full/!400,400/0/default.jpg" }
25
24
  let(:thumb_object) {
26
25
  thumb = IIIF::V3::Presentation::ImageResource.new
27
- thumb['type'] = 'Image'
28
- thumb['id'] = thumb_id
26
+ thumb["type"] = "Image"
27
+ thumb["id"] = thumb_id
29
28
  thumb.format = img_mimetype
30
29
  thumb.service = [image_v2_service]
31
30
  thumb
32
31
  }
33
- it 'validates' do
34
- expect{thumb_object.validate}.not_to raise_error
32
+ it "validates" do
33
+ expect { thumb_object.validate }.not_to raise_error
35
34
  end
36
- it 'has expected required values' do
37
- expect(thumb_object.type).to eq 'Image'
35
+ it "has expected required values" do
36
+ expect(thumb_object.type).to eq "Image"
38
37
  expect(thumb_object.id).to eq thumb_id
39
38
  end
40
- it 'has expected additional values' do
39
+ it "has expected additional values" do
41
40
  expect(thumb_object.format).to eq img_mimetype
42
41
  expect(thumb_object.service.first).to eq image_v2_service
43
42
  end
44
43
  end
45
- describe 'full size per purl code' do
44
+ describe "full size per purl code" do
46
45
  let(:full_id) { "#{img_id}/full/full/0/default.jpg" }
47
46
  let(:image_object) {
48
47
  img = IIIF::V3::Presentation::ImageResource.new
49
- img['id'] = full_id
48
+ img["id"] = full_id
50
49
  img.format = img_mimetype
51
50
  img.height = height
52
51
  img.width = width
53
52
  img.service = [image_v2_service]
54
53
  img
55
54
  }
56
- describe 'world visible' do
57
- it 'validates' do
58
- expect{image_object.validate}.not_to raise_error
55
+ describe "world visible" do
56
+ it "validates" do
57
+ expect { image_object.validate }.not_to raise_error
59
58
  end
60
- it 'has expected required values' do
61
- expect(image_object.type).to eq 'Image'
59
+ it "has expected required values" do
60
+ expect(image_object.type).to eq "Image"
62
61
  expect(image_object.id).to eq full_id
63
62
  end
64
- it 'has expected additional values' do
63
+ it "has expected additional values" do
65
64
  expect(image_object.format).to eq img_mimetype
66
65
  expect(image_object.height).to eq height
67
66
  expect(image_object.width).to eq width
68
67
  expect(image_object.service.first).to eq image_v2_service
69
68
  end
70
- it 'has expected service value' do
69
+ it "has expected service value" do
71
70
  img_service_obj = image_object.service.first
72
71
  expect(img_service_obj.class).to eq IIIF::V3::Presentation::Service
73
72
  expect(img_service_obj.keys.size).to eq 4
74
73
  expect(img_service_obj.id).to eq img_id
75
- expect(img_service_obj['@id']).to eq img_id
74
+ expect(img_service_obj["@id"]).to eq img_id
76
75
  expect(img_service_obj.profile).to eq IIIF::V3::Presentation::Service::IIIF_IMAGE_V2_LEVEL1_PROFILE
77
76
  end
78
77
  end
79
- describe 'requires login' do
80
- let(:service_label) { 'login message' }
81
- let(:token_service_id) { 'https://example.org/iiif/token' }
78
+ describe "requires login" do
79
+ let(:service_label) { "login message" }
80
+ let(:token_service_id) { "https://example.org/iiif/token" }
82
81
  let(:login_service) {
83
82
  IIIF::V3::Presentation::Service.new(
84
- 'id' => 'https://example.org/auth/iiif',
85
- 'profile' => 'http://iiif.io/api/auth/1/login',
86
- 'label' => service_label,
87
- 'service' => [{
88
- 'id' => token_service_id,
89
- 'profile' => 'http://iiif.io/api/auth/1/token'
83
+ "id" => "https://example.org/auth/iiif",
84
+ "profile" => "http://iiif.io/api/auth/1/login",
85
+ "label" => service_label,
86
+ "service" => [{
87
+ "id" => token_service_id,
88
+ "profile" => "http://iiif.io/api/auth/1/token"
90
89
  }]
91
90
  )
92
91
  }
93
92
  let(:image_object_w_login) {
94
93
  img = image_object
95
- img.service.first['service'] = [login_service]
94
+ img.service.first["service"] = [login_service]
96
95
  img
97
96
  }
98
- it 'validates' do
99
- expect{image_object_w_login.validate}.not_to raise_error
97
+ it "validates" do
98
+ expect { image_object_w_login.validate }.not_to raise_error
100
99
  end
101
- it 'has expected service value' do
100
+ it "has expected service value" do
102
101
  img_service_obj = image_object_w_login.service.first
103
102
  expect(img_service_obj.class).to eq IIIF::V3::Presentation::Service
104
103
  expect(img_service_obj.keys.size).to eq 5
105
104
  expect(img_service_obj.id).to eq img_id
106
- expect(img_service_obj['@id']).to eq img_id
105
+ expect(img_service_obj["@id"]).to eq img_id
107
106
  expect(img_service_obj.profile).to eq IIIF::V3::Presentation::Service::IIIF_IMAGE_V2_LEVEL1_PROFILE
108
107
  expect(img_service_obj.service.class).to eq Array
109
108
  expect(img_service_obj.service.size).to eq 1
110
109
 
111
110
  login_service_obj = img_service_obj.service.first
112
111
  expect(login_service_obj.keys.size).to eq 4
113
- expect(login_service.id).to eq 'https://example.org/auth/iiif'
112
+ expect(login_service.id).to eq "https://example.org/auth/iiif"
114
113
  expect(login_service.profile).to eq IIIF::V3::Presentation::Service::IIIF_AUTHENTICATION_V1_LOGIN_PROFILE
115
114
  expect(login_service.label).to eq service_label
116
115
  expect(login_service.service.class).to eq Array
117
116
  expect(login_service.service.size).to eq 1
118
117
 
119
118
  token_service_obj = login_service_obj.service.first
120
- expect(token_service_obj['id']).to eq token_service_id
121
- expect(token_service_obj['profile']).to eq IIIF::V3::Presentation::Service::IIIF_AUTHENTICATION_V1_TOKEN_PROFILE
119
+ expect(token_service_obj["id"]).to eq token_service_id
120
+ expect(token_service_obj["profile"]).to eq IIIF::V3::Presentation::Service::IIIF_AUTHENTICATION_V1_TOKEN_PROFILE
122
121
  end
123
122
  end
124
123
  end
125
124
  end
126
- describe 'image examples from http://prezi3.iiif.io/api/presentation/3.0' do
125
+ describe "image examples from http://prezi3.iiif.io/api/presentation/3.0" do
127
126
  let(:image_object) {
128
127
  IIIF::V3::Presentation::ImageResource.new({
129
- 'id' => "#{img_id}/full/full/0/default.jpg",
130
- 'type' => 'dctypes:Image',
131
- 'format' => img_mimetype,
132
- 'height' => height,
133
- 'width' => width,
134
- 'service' => [image_v2_service]
135
- })
128
+ "id" => "#{img_id}/full/full/0/default.jpg",
129
+ "type" => "dctypes:Image",
130
+ "format" => img_mimetype,
131
+ "height" => height,
132
+ "width" => width,
133
+ "service" => [image_v2_service]
134
+ })
136
135
  }
137
- describe 'simpler' do
138
- it 'validates' do
139
- expect{image_object.validate}.not_to raise_error
136
+ describe "simpler" do
137
+ it "validates" do
138
+ expect { image_object.validate }.not_to raise_error
140
139
  end
141
- it 'has expected required values' do
140
+ it "has expected required values" do
142
141
  expect(image_object.id).to eq "#{img_id}/full/full/0/default.jpg"
143
- expect(image_object.type).to eq 'dctypes:Image'
142
+ expect(image_object.type).to eq "dctypes:Image"
144
143
  end
145
- it 'has expected additional values' do
144
+ it "has expected additional values" do
146
145
  expect(image_object.format).to eq img_mimetype
147
146
  expect(image_object.height).to eq height
148
147
  expect(image_object.width).to eq width
149
148
  expect(image_object.service.first).to eq image_v2_service
150
149
  end
151
150
  end
152
- describe 'height and width in service' do
151
+ describe "height and width in service" do
153
152
  # {
154
153
  # "id": "http://example.org/images/book1-page2/full/1500,2000/0/default.jpg",
155
154
  # "type": "dctypes:Image",
@@ -167,21 +166,21 @@ describe IIIF::V3::Presentation::ImageResource do
167
166
  # }
168
167
  let(:img_obj) {
169
168
  img = image_object
170
- img.service.first['height'] = 6666
171
- img.service.first['width'] = 9999
172
- img.service.first['tiles'] = [{"width" => 512, "scaleFactors" => [1,2,4,8,16]}]
169
+ img.service.first["height"] = 6666
170
+ img.service.first["width"] = 9999
171
+ img.service.first["tiles"] = [{"width" => 512, "scaleFactors" => [1, 2, 4, 8, 16]}]
173
172
  img
174
173
  }
175
- it 'validates' do
176
- expect{img_obj.validate}.not_to raise_error
174
+ it "validates" do
175
+ expect { img_obj.validate }.not_to raise_error
177
176
  end
178
- it 'has expected service value' do
177
+ it "has expected service value" do
179
178
  service_obj = img_obj.service.first
180
179
  expect(service_obj.class).to eq IIIF::V3::Presentation::Service
181
180
  expect(service_obj.keys.size).to eq 7
182
- expect(service_obj['height']).to eq 6666
183
- expect(service_obj['width']).to eq 9999
184
- expect(service_obj['tiles']).to eq [{"width" => 512, "scaleFactors" => [1,2,4,8,16]}]
181
+ expect(service_obj["height"]).to eq 6666
182
+ expect(service_obj["width"]).to eq 9999
183
+ expect(service_obj["tiles"]).to eq [{"width" => 512, "scaleFactors" => [1, 2, 4, 8, 16]}]
185
184
  end
186
185
  end
187
186
  end