Apiary uses Thin and some Event Machine goodness to let you declare methods in your Ruby classes as API methods:
class Temperature include Apiary # Include Apiary as a module in your class version '1.0' # Specifies a version prefix for your api get # Marks this method as accessible from GET def c2f(val) # This is now available at /1.0/c2f/:val Float(val) * 9 / 5 + 32 end end
You can start your Temperature API server with
Temperature.run. Apiary will crank up Thin and listen to requests on port 3000:
Apiary is brand new and will likely change, but it looks promising.
Have comments? Send a tweet to @TheChangelog on Twitter.
Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.