No commit activity in last 3 years
No release in over 3 years
Marley is a framework for quickly building RESTful web services and applications. Development is fast for two reasons: Marley implements lots of sensible defaults, all of which can be overridden and most of which can be overridden easily. And Marley servers exchange only data and metadata with clients.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.16

Runtime

~> 1.6
~> 1.4
~> 3
 Project Readme

Marley¶ ↑

Marley is a framework for building RESTful web services and applications with roughly _O(n)_ lines code where n is lines of DDL.

It consists of several parts:

  • A simple Rack application that acts as request parser/router.

  • A default controller for ORM model classes.

  • A plugin system similar to Sequel’s.

  • Marley Joints - A framework for creating reusable Marley resource sets.

  • Reggae - A JSON data format

The point of the whole thing is to minimize the amount of non-model (non-datacentric) code that needs to be written to implement a web service/application.

Please see the examples/forum.rb and the included Joints’ code to get a basic idea of what a Marley application looks like.


Marley Resources¶ ↑

Marley resources are constants in the Marley::Resources namespace.

  • A resource must respond either to a #controller method or to one or more REST verbs (#rest_get, #rest_post, #rest_put, or #rest_delete).

  • A #controller method must return an object that responds to one or more REST verbs.

  • REST verb methods should return an object with a #to_json method.

The Parser/Router¶ ↑

The parser splits the request path on ‘/’ and treats the first part as the requested resource. If no resource is specified in the request, it uses the default resource.

if the resource has a REST method corresponding the the request verb, the parser calls that method and sends the return value to the client.

The parser also traps various errors and returns the appropriate error message to the client.

:include: rdoc/plugins.rdoc

The Default Model Controller¶ ↑

One of the things that the RestConvenience Sequel plugin does is add a #controller method to affected models. This method instantiates and returns a ModelController object for the model in question. At initialization, the Controller parses the request path to determine the model instances to which the request refers.

:include: rdoc/joints.rdoc

:include: rdoc/reggae.rdoc

Jamaica¶ ↑

The default Marley client is “Jamaica”, which consists of JS/CSS for browsers. It has now been moved to a separate repository at github.com/herbdaily/jamaica