Sha256: 36e24c14c84e0551af4e74f79df2cf303104e0b594d562d9a8656da75d8a6944

Contents?: true

Size: 1.66 KB

Versions: 58

Compression:

Stored size: 1.66 KB

Contents

class Hyrax::ResourceSyncController < ApplicationController
  # We don't need locale here
  def default_url_options
    super.except(:locale)
  end

  def source_description
    render_from_cache_as_xml(:source_description)
  end

  def capability_list
    render_from_cache_as_xml(:capability_list)
  end

  def change_list
    render_from_cache_as_xml(:change_list)
  end

  def resource_list
    render_from_cache_as_xml(:resource_list)
  end

  private

    def build_change_list
      Hyrax::ResourceSync::ChangeListWriter.new(capability_list_url: hyrax.capability_list_url,
                                                resource_host: request.host).write
    end

    def build_resource_list
      Hyrax::ResourceSync::ResourceListWriter.new(capability_list_url: hyrax.capability_list_url,
                                                  resource_host: request.host).write
    end

    def build_capability_list
      Hyrax::ResourceSync::CapabilityListWriter.new(resource_list_url: hyrax.resource_list_url,
                                                    change_list_url: hyrax.change_list_url,
                                                    description_url: hyrax.source_description_url).write
    end

    def build_source_description
      Hyrax::ResourceSync::SourceDescriptionWriter.new(capability_list_url: hyrax.capability_list_url).write
    end

    def render_from_cache_as_xml(resource_sync_type)
      # Caching based on host, for multi-tenancy support
      body = Rails.cache.fetch("#{resource_sync_type}_#{request.host}", expires_in: 1.week) do
        send("build_#{resource_sync_type}")
      end
      render body: body, content_type: 'application/xml'
    end
end

Version data entries

58 entries across 58 versions & 2 rubygems

Version Path
hyrax-2.9.6 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.9.5 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.9.4 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.9.3 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.9.2 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.9.1 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.9.0 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.8.0 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.7.2 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.7.1 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.7.0 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.6.0 app/controllers/hyrax/resource_sync_controller.rb
hyrax-3.0.0.pre.rc1 app/controllers/hyrax/resource_sync_controller.rb
hyrax-3.0.0.pre.beta3 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.5.1 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.5.0 app/controllers/hyrax/resource_sync_controller.rb
hyrax-3.0.0.pre.beta2 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.4.1 app/controllers/hyrax/resource_sync_controller.rb
hyrax-3.0.0.pre.beta1 app/controllers/hyrax/resource_sync_controller.rb
hyrax-2.4.0 app/controllers/hyrax/resource_sync_controller.rb