What's it about?
It's a framework for developing servers that adhere to the Restful Objects specification. It's main purpose is to be completely transparent to the developer and let him focus mainly on the Domain Model that implements the business logic, thereby abstracting him from the API & HTTP issues of exposing the Restful resources.
So it's like plain old ruby objects, with HTTP Restful steroids for free!
How it looks like?
require 'restful_objects'
class Node
include RestfulObjects::Object
property :label, :string
property :visited, :bool
collection :dendencies, Node
end
class Graph
include RestfulObjects::Object
collection :nodes, Nodo
action :topological_sort, return_value: { list: Nodo }
def topological_sort
list = []
nodex.each { |node| node.visited = false }
unvisited_nodes = nodes
while not unvisited_nodes.empty? do
visit(unvisited_nodes.pop, list)
end
list
end
private
def visit(node, list)
if !node.visited
node.dependencies.each { |dependent_node| visit(dependent_node, list) }
node.visited = true
list << node
end
end
end
Examples
How to install it?
If you have a Ruby environment (> 1.9.3) with RubyGems installed, simply run:
gem install restful_objects
or add,
gem 'restful_objects'
to your's project Gemfile and 'bundle install' it.
If not, consider using Vagrant to setup a VM with all the dependencies and the latest version of the framework following the instructions here:
https://github.com/vizcay/restful_objects_vagrant
Project Status
The source quality is at alpha state, and it was created mostly as a proof of concept. Still is has plenty of specs and a big percentage of the specification implemented, the grey areas are mostly related to errors and validations. It has been developed with MRI and hasn't been tested on other Ruby implementations.
Dependencies
- Ruby 1.9.3 or higher
- Sinatra
- RSpec
- json_expressions for json testing.
Resources
License
MIT License.
Credits
This project has been developed as the main subject of Pablo Vizcay undergradute System's Engineering thesis, directed by Dr. Alejandro Zunino for the U.N.I.C.E.N. University in Tandil - Buenos Aires - Argentina.