ripple (Ripple namespace) contains an ActiveModel-compatible modeling layer that is inspired by ActiveRecord, DataMapper, and MongoMapper.

Dependencies

riak-client requires ActiveSupport 2.3.5 or later, but the version 3 is recommended. I highly recommend the curb gem for better HTTP client performance.

ripple requires Ruby 1.8.7 or later and versions 3 or above of ActiveModel and ActiveSupport (and their dependencies, including i18n). Please see the Rails 3 beta release notes for installing those gems.

In development, you will also need these gems:

rspec = 2.0.0.beta.11

fakeweb >= 1.2

curb >= 0.6

rack >= 1.0

yard >= 0.5.2

Basic Example

require 'riak'
# Create a client interface
client = Riak::Client.new
# Retrieve a bucket
bucket = client.bucket("doc") # a Riak::Bucket
# Get an object from the bucket
object = bucket.get("index.html") # a Riak::RObject
# Change the object's data and save
object.data = "Hello, world!"
object.store
# Reload an object you already have
object.reload # Works if you have the key and vclock, using conditional GET
object.reload :force => true # Reloads whether you have the vclock or not
# Access more like a hash, client[bucket][key]
client['doc']['index.html'] # the Riak::RObject
# Create a new object
new_one = Riak::RObject.new(bucket, "application.js")
new_one.content_type = "application/javascript" # You must set the content type.
new_one.data = "alert('Hello, World!')"
new_one.store

Configuration Example

When using Ripple, config/ripple.yml should contain your Riak connection information:

development:
port: 8098
host: localhost

How to Contribute

Fork the project on Github. If you have already forked, use git pull --rebase to reapply your changes on top of the mainline. Example:

$ git checkout master
$ git pull --rebase seancribbs master

Create a topic branch. If you’ve already created a topic branch, rebase it on top of changes from the mainline “master” branch. Examples:

New branch:

$ git checkout -b topic

Existing branch:

$ git rebase master

Write an RSpec example, set of examples, and/or Cucumber story that demonstrate the necessity and validity of your changes. Patches without specs will most often be ignored. Just do it, you’ll thank me later. Documentation patches need no specs, of course.

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an “AS IS” BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.