Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
test.rb
-----------------------------------
#!/usr/local/bin/ruby
require 'ripple'
# Create a client interface
client = Riak::Client.new
# Retrieve a bucket
bucket = client.bucket("doc") # a Riak::Bucket
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
# Get an object from the bucket
object = bucket.get("application.js") # a Riak::RObject
puts object.inspect
class Email
include Ripple::Document
property :from, String, :presence => true
property :to, String, :presence => true
property :sent, Time, :default => proc { Time.now }
property :body, String
end
email = Email.find("37458abc752f8413e") # GET /raw/emails/37458abc752f8413e
email.from = "someone@nowhere.net"
email.save # PUT /raw/emails/37458abc752f8413e
reply = Email.new
reply.from = "justin@bashoooo.com"
reply.to = "sean@geeemail.com"
reply.body = "Riak is a good fit for scalable Ruby apps."
reply.save
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.