riiif 1.4.1 → 1.4.2

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: 83e09f8e63165428baf455b3547e78819582ec2f
4
- data.tar.gz: 2bb3a70107f4e4ab94c2561e4ab316b7b360beaa
3
+ metadata.gz: ad367b2b2d10b9b46d5944b0d69a3aaf62fe3cdc
4
+ data.tar.gz: 2546fdcfb0322e87f841bd4974b7ff6afbb7772c
5
5
  SHA512:
6
- metadata.gz: 77d9392212565fe905219e1811dea64d8c090e2d5121508286936876b959915c1d9548463085c601e719adbcb7862d3f4cc6b830c2fbec6a23915f07789ca83b
7
- data.tar.gz: 5a2a9866ac295b9a0739f43dcf3209b31c659a279a0afad4d6a7c804e4d8faf27237828363c219d9260f04669191cc5ed5e97d11ddb14a3b17476457b824bdd1
6
+ metadata.gz: cf4a63d5b3f3f81500979374454464cf17daf1b0bd14103a86d4d6e49f38e8aa25cb1f23d5065ce89da0cf5b327c893317b1d33509c760abd1e75965e60c4044
7
+ data.tar.gz: b918a8c2af312223d20e20cfbeb3e0b7b07b42e742f3bf88186791ae1c83937ebf84360ebccc27cce174938927c81967e9726b7ccb32f579d144368adeca4231
@@ -12,16 +12,12 @@ module Riiif
12
12
 
13
13
  class Error < RuntimeError; end
14
14
  class InvalidAttributeError < Error; end
15
- class ImageNotFoundError < Error
16
- attr_reader :original_exception
17
- def initialize(orig = nil)
18
- @original_exception = orig
19
- end
20
- end
15
+ class ImageNotFoundError < Error; end
21
16
  # This error is raised when Riiif can't convert an image
22
17
  class ConversionError < Error; end
23
18
 
24
19
  Transformation = Struct.new(:crop, :size, :quality, :rotation, :format)
25
20
  ImageInformation = Struct.new(:width, :height)
26
21
  mattr_accessor :not_found_image # the image to use when a lookup fails
22
+ mattr_accessor :unauthorized_image # the image to use when a lookup fails
27
23
  end
@@ -69,7 +69,7 @@ module Riiif
69
69
  end
70
70
  end
71
71
  rescue OpenURI::HTTPError => e
72
- raise ImageNotFoundError, e
72
+ raise ImageNotFoundError, e.message
73
73
  end
74
74
  end
75
75
  end
@@ -1,3 +1,3 @@
1
1
  module Riiif
2
- VERSION = '1.4.1'.freeze
2
+ VERSION = '1.4.2'.freeze
3
3
  end
@@ -5,6 +5,20 @@ describe Riiif::ImagesController do
5
5
  let(:filename) { File.expand_path('spec/samples/world.jp2') }
6
6
  routes { Riiif::Engine.routes }
7
7
 
8
+ describe '#error_image' do
9
+ context 'with unauthorized' do
10
+ around do |example|
11
+ old_value = Riiif.unauthorized_image
12
+ Riiif.unauthorized_image = filename
13
+ example.run
14
+ Riiif.unauthorized_image = old_value
15
+ end
16
+ subject { controller.send(:error_image, :unauthorized) }
17
+ it 'gives the path to the image' do
18
+ subject
19
+ end
20
+ end
21
+ end
8
22
  describe '#show' do
9
23
  it 'sends images to the service' do
10
24
  image = double
@@ -17,7 +17,7 @@ describe Riiif::HTTPFileResolver do
17
17
  rescue Riiif::ImageNotFoundError => e
18
18
  end
19
19
  expect(e).to be_a Riiif::ImageNotFoundError
20
- expect(e.original_exception).to be_an OpenURI::HTTPError
20
+ expect(e.message).to eq 'failure'
21
21
  end
22
22
 
23
23
  context 'when basic authentication credentials are set' 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: 1.4.1
4
+ version: 1.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Coyne
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-01 00:00:00.000000000 Z
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties