Sha256: dab86ae4b0ad01a9df47285ee0c94bd43fe23c9f9ef087bd336254fa59f7e94f
Contents?: true
Size: 1.37 KB
Versions: 5
Compression:
Stored size: 1.37 KB
Contents
require 'rack/ldp' require 'sinatra/base' class RDF::Lamprey < Sinatra::Base use Rack::Lint use Rack::LDP::ContentNegotiation use Rack::LDP::Errors use Rack::LDP::Responses use Rack::ConditionalGet use Rack::LDP::Requests # Set defaults in case user has not configured values configure do set :repository, RDF::Repository.new end get '/*' do RDF::LDP::Container.new(RDF::URI(request.url), settings.repository) .create(StringIO.new, 'text/turtle') if settings.repository.empty? RDF::LDP::Resource.find(RDF::URI(request.url), settings.repository) end patch '/*' do RDF::LDP::Resource.find(RDF::URI(request.url), settings.repository) end post '/*' do RDF::LDP::Resource.find(RDF::URI(request.url), settings.repository) end put '/*' do begin RDF::LDP::Resource.find(RDF::URI(request.url), settings.repository) rescue RDF::LDP::NotFound model = request.env.fetch('HTTP_LINK', '') RDF::LDP::Resource.interaction_model(model) .new(RDF::URI(request.url), settings.repository) end end options '/*' do RDF::LDP::Resource.find(RDF::URI(request.url), settings.repository) end head '/*' do RDF::LDP::Resource.find(RDF::URI(request.url), settings.repository) end delete '/*' do RDF::LDP::Resource.find(RDF::URI(request.url), settings.repository) end run! if app_file == $0 end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rdf-ldp-0.9.2 | app/lamprey.rb |
rdf-ldp-0.9.1 | app/lamprey.rb |
rdf-ldp-0.9.0 | app/lamprey.rb |
rdf-ldp-0.8.0 | app/lamprey.rb |
rdf-ldp-0.7.0 | app/lamprey.rb |