Sha256: a60d611e515e57e0a7975a12c36a7198809117e54e83c24c894f0dac6621ee42

Contents?: true

Size: 1.08 KB

Versions: 5

Compression:

Stored size: 1.08 KB

Contents

= Classy Resources

Think resource_controller, except for Sinatra.

= Installation

  sudo gem install giraffesoft-classy_resources

= Usage

  require 'rubygems'
  require 'sinatra'
  require 'classy_resources'
  require 'classy_resources/active_record'
  # ... or require 'classy_resources/sequel'
  # more ORMs coming (it's also easy to implement your own)...

  define_resource :posts, :member     => [:get, :put, :delete],
                          :collection => [:get, :post],
                          :formats    => [:xml, :json, :yaml]

The above declaration will create the five actions specified, each responding to all of the formats listed.
  
  - GET /resources.format      # => index
  - POST /resources.format     # => create
  - GET /resources/1.format    # => show
  - PUT /resources/1.format    # => update
  - DELETE /resources/1.format # => destroy

Since ClassyResources was designed to be active resource compatible, the params formats and return values are what AR expects.

== Copyright

Copyright (c) 2008 James Golick, Daniel Haran, GiraffeSoft Inc.. See LICENSE for details.

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
giraffesoft-classy_resources-0.1.0 README.rdoc
giraffesoft-classy_resources-0.1.1 README.rdoc
giraffesoft-classy_resources-0.2.0 README.rdoc
giraffesoft-classy_resources-0.2.1 README.rdoc
giraffesoft-classy_resources-0.3.0 README.rdoc