riiif 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5a681e454d7f72009fc0888840383238cb2645f
4
- data.tar.gz: 7cb1cd8c2e6da79baf2999c9aa485365aeee1aff
3
+ metadata.gz: b0af476f4ae806dfd50b80d55822b1b4e737bca3
4
+ data.tar.gz: a19cc06b6257e2e8bfc20e10ebca47d842b71521
5
5
  SHA512:
6
- metadata.gz: 32b165e6a1de5c69fd206efb98c6d3efe306d7c86de86a01e965ca08ad39d26d09fc9c814fa010986ced16d399fb8c146ef2e22b8874a3f874e3d4df6d508745
7
- data.tar.gz: b619dc18d55f5df861a197bf8c530f437744dd973897f3440fdf33c2458e81dafa2254cbed9e9028e1e0f142de324b547d2c7148affe8684f81222e9a7d93fc9
6
+ metadata.gz: bcfa15704d359abae49010c15e118f24a4107c56d0f5839a5cb8494216dabf7e6b8207338988b13f54b4ed39d37fa8857e6426a5974d376011d5bcdc1a1036f9
7
+ data.tar.gz: 521ca263dd137a5a96e9d816f84576f04b3e175e0fc7c9382fdc33a88be375ff39a23b288645054f3c64142c9921fbd4c188ad8f0d57bccbf97ab7003ac96a60
data/README.md CHANGED
@@ -129,37 +129,32 @@ Create an initializer like this in `config/initializers/riiif_initializer.rb`
129
129
  Riiif::Image.file_resolver = Riiif::HTTPFileResolver.new
130
130
 
131
131
  # This tells RIIIF how to resolve the identifier to a URI in Fedora
132
- DATASTREAM = 'imageContent'
133
132
  Riiif::Image.file_resolver.id_to_uri = lambda do |id|
134
- connection = ActiveFedora::Base.connection_for_pid(id)
135
- host = connection.config[:url]
136
- path = connection.api.datastream_content_url(id, DATASTREAM, {})
137
- host + '/' + path
133
+ ActiveFedora::Base.id_to_uri(CGI.unescape(id)).tap do |url|
134
+ logger.info "Riiif resolved #{id} to #{url}"
135
+ end
138
136
  end
139
137
 
140
138
  # In order to return the info.json endpoint, we have to have the full height and width of
141
139
  # each image. If you are using hydra-file_characterization, you have the height & width
142
140
  # cached in Solr. The following block directs the info_service to return those values:
143
- HEIGHT_SOLR_FIELD = 'height_isi'
144
- WIDTH_SOLR_FIELD = 'width_isi'
145
141
  Riiif::Image.info_service = lambda do |id, file|
146
- resp = get_solr_response_for_doc_id id
147
- doc = resp.first['response']['docs'].first
148
- { height: doc[HEIGHT_SOLR_FIELD], width: doc[WIDTH_SOLR_FIELD] }
149
- end
150
-
151
- include Blacklight::SolrHelper
152
- def blacklight_config
153
- CatalogController.blacklight_config
142
+ # id will look like a path to a pcdm:file
143
+ # (e.g. rv042t299%2Ffiles%2F6d71677a-4f80-42f1-ae58-ed1063fd79c7)
144
+ # but we just want the id for the FileSet it's attached to.
145
+
146
+ # Capture everything before the first slash
147
+ fs_id = id.sub(/\A([^\/]*)\/.*/, '\1')
148
+ resp = ActiveFedora::SolrService.get("id:#{fs_id}")
149
+ doc = resp['response']['docs'].first
150
+ raise "Unable to find solr document with id:#{fs_id}" unless doc
151
+ { height: doc['height_is'], width: doc['width_is'] }
154
152
  end
155
153
 
156
- ### ActiveSupport::Benchmarkable (used in Blacklight::SolrHelper) depends on a logger method
157
-
158
154
  def logger
159
155
  Rails.logger
160
156
  end
161
157
 
162
-
163
158
  Riiif::Engine.config.cache_duration_in_days = 30
164
159
  ```
165
160
 
@@ -41,7 +41,7 @@ module Riiif
41
41
  # this is a workaround for https://github.com/rails/rails/issues/25087
42
42
  def redirect
43
43
  # This was attempted with just info_path, but it gave a NoMethodError
44
- redirect_to Riiif::Engine.routes.url_helpers.info_path(params[:id])
44
+ redirect_to riiif.info_path(params[:id])
45
45
  end
46
46
 
47
47
  protected
@@ -63,7 +63,7 @@ module Riiif
63
63
  ##
64
64
  # @param [ActiveSupport::HashWithIndifferentAccess] options
65
65
  def decode_options!(options)
66
- raise ArgumentError, 'You must provide a format' unless options[:format]
66
+ raise ArgumentError, "You must provide a format. You provided #{options}" unless options[:format]
67
67
  options[:crop] = decode_region(options.delete(:region))
68
68
  options[:size] = decode_size(options.delete(:size))
69
69
  options[:quality] = decode_quality(options[:quality])
data/lib/riiif/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Riiif
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.1'.freeze
3
3
  end
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.1.0
4
+ version: 1.1.1
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-02-03 00:00:00.000000000 Z
11
+ date: 2017-03-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -190,7 +190,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
190
  version: '0'
191
191
  requirements: []
192
192
  rubyforge_project:
193
- rubygems_version: 2.5.2
193
+ rubygems_version: 2.6.10
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: A rails engine that support IIIF requests