github
Advanced Search
  • Home
  • Pricing and Signup
  • Explore GitHub
  • Blog
  • Login

bguthrie / resource_full

  • Admin
  • Watch Unwatch
  • Fork
  • Your Fork
  • Pull Request
  • Download Source
    • 9
    • 2
  • Source
  • Commits
  • Network (2)
  • Issues (0)
  • Downloads (4)
  • Wiki (1)
  • Graphs
  • Branch: master

click here to add a description

click here to add a homepage

  • Branches (1)
    • master ✓
  • Tags (4)
    • 0.7.3
    • 0.7.1
    • 0.7.0
    • 0.5.0
Sending Request…
Enable Donations

Pledgie Donations

Once activated, we'll place the following badge in your repository's detail box:
Pledgie_example
This service is courtesy of Pledgie.

A comprehensive resource modelling and querying framework for ActionController. — Read more

  cancel

  cancel
  • Private
  • Read-Only
  • HTTP Read-Only

This URL has Read+Write access

Vijay: Fixing broken tests. 
Vijay Aravamudhan (author)
Sun Jan 31 04:48:24 -0800 2010
commit  20aa082399d6304507f83871824135f9a598f8d9
tree    a7d02ed512bce1c3d33cf46d4d80f4de776808d8
parent  435d34acf43a3cb18fb32bf6c7b117c62a7f93bb
resource_full /
name age
history
message
file .gitignore Loading commit data...
file MIT-LICENSE
file README.rdoc
file Rakefile
file init.rb
file install.rb
directory lib/
directory spec/
file uninstall.rb
README.rdoc

ResourceFull 0.7.5

  • github.com/bguthrie/resource_full/

DESCRIPTION

ResourceFull integrated with ActionController to provide a comprehensive RESTful resource modeling and querying framework. It provides parameter queryability, paging, sorting, separation of controller concerns, multiple formats (HTML, XML, JSON), CRUD access permissions, and API metadata surrounding the resource itself. It’s opinionated but is intended to provide you with as much as possible without limiting your ability to customize its behavior.

GOALS

The major distinguishing features of ResourceFull are:

  • Queryability: the ability to designate certain parameters as queryable, and map them to columns and SQL queries in the underlying model. These queries chain together multiple named or unnamed scopes and can be used either for a SQL SELECT or SELECT COUNT. This functionality may be moved into a separate plugin in the future.
  • Pagination and orderability: it automatically responds to requests for limit, offset, order_by, and order_dir.
  • Implementation: Default implementations for HTML, XML, and JSON controller requests.
  • API documentation: ResourceFull-enabled Rails apps are able to provide automatic documentation of the resources they expose, up to a point. (This is enabled in large part by the queryability functionality and other resource-level descriptors.) It’s my hope that this can eventually be consumed by a Rails resource registrar that acts as the single source of record for multiple REST engines within an organization.

EXAMPLE

  class UsersController < ResourceFull::Base
    identified_by :username, :unless => lambda { |id| id =~ /^[0-9]+$/ }

    queryable_with :city, :state, :from => :address
    queryable_with :name, :columns => [:first_name, :last_name]
    queryable_with :email_address, :fuzzy => true
    queryable_with :is_active, :scope => :active

    orderable_by :city, :from => :address

    responds_to :html
    responds_to :xml, :only => [:read, :update]
  end

  class AddressesController < ResourceFull::Base
    nests_within :users
    queryable_with :city, :state
  end

This allows for the following:

  /users/bguthrie.xml
  /users?name=Guthrie
  /users?email_address=gmail
  /users.xml?city=Chicago&name=Brian,Paul,Alicia&order_by=city&order_dir=asc
  /users.xml?limit=10&offset=30
  /users/bguthrie/addresses

  >> UsersController.to_xml
  => "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<resource>\n  <parameters type=\"array\"/>..."

API DOCUMENTATION

To enable ResourceFull to document your resources at /resources.xml and /resources/<name>/routes.xml, add +map.api+ to your +routes.rb+ file.

CONTRIBUTORS

  • Vijay Aravamudhan
  • Dirk Elmendorf

LICENSE

(The MIT License)

Copyright © 2009 Brian Guthrie

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Blog | Support | Training | Contact | API | Status | Twitter | Help | Security
© 2010 GitHub Inc. All rights reserved. | Terms of Service | Privacy Policy
Powered by the Dedicated Servers and
Cloud Computing of Rackspace Hosting®
Dedicated Server