Sha256: e8f7b4455287c9c8f09e2d6a4a2601cbf64fdfac84d282b50ee413331d50730e
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module Luca class Collection class Endpoint < Sinatra::Base # Index get "/collections/:namespace" do @collection = Luca::Collection.new(namespace: params[:namespace]) @collection.index.to_json end # Show get "/collections/:namespace/:id" do @collection = Luca::Collection.new(namespace: params[:namespace]) @collection.show( params[:id] ).to_json end # Create post "/collections/:namespace" do @collection = Luca::Collection.new(namespace: params[:namespace]) payload = JSON.parse( request.body.read.to_s ) @collection.create(payload).to_json end # Update put "/collections/:namespace/:id" do @collection = Luca::Collection.new(namespace: params[:namespace]) payload = JSON.parse( request.body.read.to_s ) @collection.update(payload).to_json end # Destroy delete "/collections/:namespace/:id" do @collection = Luca::Collection.new(namespace: params[:namespace]) @collection.destroy(params).to_json end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
luca-0.9.89 | lib/luca/collection/endpoint.rb |