require 'riak'



class RiakClient < Riak::Client
#attr_accessor :bucket

def initialize(hosts="")
return Riak::Client.new(:nodes => [{:http_port => 8091},{:http_port
=>8092},{:http_port=>8093},{:http_port =>8094}])
end

def get_me(bucket, key)
obj = self.bucket(bucket).get(key)
puts obj.data
end

def put_me(bucket, key, data, content_type)
obj=self.bucket(bucket).get_or_new(key)
puts obj.class
obj.content_type=content_type
obj.raw_data=data
obj.store
end
end



if __FILE__ == $0
my_client=RiakClient.new
my_client.put_me("doc", "index.html", "some data goes here", "text/html")
hash=my_client.get_me("doc", "index.html")
end


But I am getting the following errors -

NilClass
riak_client.rb:32:in `put_me': undefined method `content_type=' for
nil:NilClass (NoMethodError)
from riak_client.rb:42:in `<main>'

Do I have to import the RiakObject and RiakClient classes and all? and how
do i do this?
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to