summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changes4
-rw-r--r--lib/Net/Riak/Role/PBC/Object.pm2
-rw-r--r--t/01_store_fetch_object.t10
3 files changed, 12 insertions, 4 deletions
diff --git a/Changes b/Changes
index 794ff2c..407889e 100644
--- a/Changes
+++ b/Changes
@@ -1,4 +1,4 @@
-0.15
+0.15 Wed 20 Apr 2011 14:52:22 BST
- fixed link encoding (Simon Wistow)
- added stats method for REST
- added server_info method for PBC
@@ -6,7 +6,7 @@
- added PBC support
- added Test::Riak for running tests on both protocols
- added disable_return_body flag, in REST mode prevents body being returned on store
- - create new object without keys (SymKat <symkat@symkat.com>)
+ - create new object without keys (SymKat <symkat@symkat.com>) (REST only)
DEPRECATIONS
- $object->status please call $object->client->status (for REST only)
diff --git a/lib/Net/Riak/Role/PBC/Object.pm b/lib/Net/Riak/Role/PBC/Object.pm
index 847cac2..f1a82a5 100644
--- a/lib/Net/Riak/Role/PBC/Object.pm
+++ b/lib/Net/Riak/Role/PBC/Object.pm
@@ -8,6 +8,8 @@ use List::Util 'first';
sub store_object {
my ($self, $w, $dw, $object) = @_;
+ die "Storing object without a key is not supported in the PBC interface" unless $object->key;
+
my $value = (ref $object->data && $object->content_type eq 'application/json')
? JSON::encode_json($object->data) : $object->data;
diff --git a/t/01_store_fetch_object.t b/t/01_store_fetch_object.t
index 09f5e99..4c8a1dc 100644
--- a/t/01_store_fetch_object.t
+++ b/t/01_store_fetch_object.t
@@ -17,9 +17,15 @@ test_riak {
is $obj->key, 'foo', 'valid key';
is_deeply $obj->data, $content, 'valid content';
+};
+
+test_riak_rest {
+ my ($client, $bucket_name) = @_;
+ ok my $bucket = $client->bucket($bucket_name), 'got bucket test';
+ my $content = [int(rand(100))];
- ok $obj = $bucket->new_object(undef, $content),
+ ok my $obj = $bucket->new_object(undef, $content),
'created a new riak object without a key';
ok $obj->store, 'store object without key';
ok $obj->key, 'key created';
-};
+}