Announcing RiakRest

Paul Rogers riak at dingosky.com
Wed Oct 28 16:18:05 EDT 2009


Hello one and all,

I've created a Ruby gem for RESTfully interaction with a Riak doc  
store. You can get riakrest as a gem using gemcutter: http://gemcutter.org/gems/riakrest 
   Just follow their easy instructions to install gemcutter as a gem  
repository, then run > gem install riakrest.

To view or clone the source via github go to: http://github.com/wcpr/riakrest

The gem provides two levels of Jiak interaction: Core Client and  
Resource. Examples of each are given in the gem rdoc, but here's taste  
of the resource interaction:

require 'riakrest'
include RiakRest

PersonData = JiakDataHash.create(:name,:age)
PersonData.keygen :name

class Person
   include JiakResource
   server      'http://localhost:8002/jiak'
   group       'people'
   data_class  PersonData
   auto_post   true
end

remy = Person.new(:name => 'remy', :age => 10)
puts Person.get('remy').name                # => "remy"

remy.name = "Remy"
remy.update
puts Person.get('remy').name                # => "Remy"

callie = Person.new(:name => 'Callie', :age => 12)
remy.bi_link(callie,'sister').update
callie.update

sisters = remy.walk(Person,'sister')
sisters[0].eql?(callie)                     # => true

remy.delete
callie.delete

There's a lot more descriptions in the rdoc, and there are a few  
examples in the examples directory.

For those familiar with CouchDB and Ruby you'll know that couch is  
accessible to Rubyist because of the gems popping up around it. I hope  
this gem will begin the same for Riak, which IMHO is a gem in the rough.

Go forth and Riak!

Paul



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20091028/abe7f813/attachment-0002.html>


More information about the riak-users mailing list