Class: DeliveryJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- DeliveryJob
- Defined in:
- app/jobs/delivery_job.rb
Overview
Delivers derivatives to external services, like GeoServer
Instance Method Summary collapse
- #content_url(file_set) ⇒ Object
-
#perform(message) ⇒ Object
Precondition is that all derivatives are created and saved.
Instance Method Details
#content_url(file_set) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'app/jobs/delivery_job.rb', line 21 def content_url(file_set) case file_set.geo_mime_type when *GeoConcerns::RasterFormatService..map(&:last) return file_set.send(:derivative_url, 'display_raster') when *GeoConcerns::VectorFormatService..map(&:last) return file_set.send(:derivative_url, 'display_vector') else return '' end end |
#perform(message) ⇒ Object
Precondition is that all derivatives are created and saved.
13 14 15 16 17 18 19 |
# File 'app/jobs/delivery_job.rb', line 13 def perform() file_set = ActiveFedora::Base.find(['id']) uri = URI.parse(content_url(file_set)) return if uri.path == '' raise NotImplementedError, 'Only supports file URLs' unless uri.scheme == 'file' GeoConcerns::DeliveryService.new(file_set, uri.path).publish end |