Sulu

Sulu is an ORM library that maps REST-style resources to Ruby objects. It is designed to build applications backed by RESTful APIs instead of databases.

Installation

Add this to your Gemfile

gem "sulu"

Then run bundle install. You're done!

Usage

First, you need to configure Sulu's connection to your API. In Rails, you could add this as an initializer in config/initializers/sulu.rb.

Sulu.configure url: "https://api.yoursite.com" do |sulu|
  sulu.use Faraday::Request::UrlEncoded
  sulu.use Sulu::Middleware::ParseJSON
  sulu.use Faraday::Adapter::NetHttp
end

Models

A Sulu model is a Ruby class that extends Sulu::Resource::Base. Define attributes using the attribute method.

class Person < Sulu::Resource::Base
  attribute :name
  attribute :birthday
  attribute :gender
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request