Sha256: c6d9d7bbe4a47c543f6bab2b83ab330ec30da3717e6138bc4165bab608c2aac2

Contents?: true

Size: 1.15 KB

Versions: 3

Compression:

Stored size: 1.15 KB

Contents

require_dependency "publish_my_data/application_controller"

module PublishMyData
  class InformationResourcesController < ApplicationController

    include ResourceRendering
    include DataDownload

    respond_to :html, :ttl, :rdf, :nt, :json, :text

    # http://example.com/data/blah
    def data
      uri = "http://#{PublishMyData.local_domain}/data/#{params[:id]}"
      resource = PublishMyData::Resource.find(uri, local: true)
      render_resource(resource)
    end

    # http://example.com/def/blah
    def def
      uri = "http://#{PublishMyData.local_domain}/def/#{params[:id]}"
      resource = PublishMyData::Resource.find(uri, local: true)
      render_resource(resource)
    end

    # http://example.com/def/blah/dump
    def dump
      uri = "http://#{PublishMyData.local_domain}/def/#{params[:id]}"
      resource = PublishMyData::Resource.find(uri, local: true)

      # if we can't find a current download it's cos we haven't generated it yet since ds was modified
      # ... and we should 404.
      url = find_latest_download_url_for_resource(resource)
      raise Tripod::Errors::ResourceNotFound unless url

      redirect_to url
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
publish_my_data-0.0.32 app/controllers/publish_my_data/information_resources_controller.rb
publish_my_data-0.0.31 app/controllers/publish_my_data/information_resources_controller.rb
publish_my_data-0.0.30 app/controllers/publish_my_data/information_resources_controller.rb