Sha256: 3d2d120ef9f750022992c8f38ddf45c2b069aebd94aee218ade3b2158c5e1dc4

Contents?: true

Size: 648 Bytes

Versions: 2

Compression:

Stored size: 648 Bytes

Contents

ResourceApp.controllers do

  get '/:resource_key', :provides => :json do
    Resource.find_by_resource_key(params[:resource_key])
  end

  post '/', :provides => :json do
    resource = Resource.build(params)
    send_custom_response(resource, nil, [], 201, nil, content_type, [])
  end

  put '/:resource_key/value/:value', :provides => :json do
    resource = Resource.find_by_resource_key(params[:resource_key])
    resource.update_attributes!(:resource_value => params[:value])
    status 204
  end

  put '/:resource_key/delete', :provides => :json do
    Resource.find_by_resource_key(params[:resource_key]).delete
    status 204
  end

end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
apl-library-0.0.90 lib/resource_app/controllers/resource_controller.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/lib/resource_app/controllers/resource_controller.rb