summaryrefslogtreecommitdiff
path: root/lib/AnyEvent/Riak/Object.pm
diff options
context:
space:
mode:
authorfranck cuny <franck@lumberjaph.net>2010-05-11 11:22:58 +0200
committerfranck cuny <franck@lumberjaph.net>2010-06-08 08:02:41 +0200
commite71ee6fc097b832df6808a4a97f89029d971e196 (patch)
tree65ce4819db1b2ddc104cd20c5d70e5d4136d3920 /lib/AnyEvent/Riak/Object.pm
parentupdate tests (diff)
downloadanyevent-riak-e71ee6fc097b832df6808a4a97f89029d971e196.tar.gz
switch to dzil; rename tests; update changelog
Diffstat (limited to '')
-rw-r--r--lib/AnyEvent/Riak/Object.pm52
1 files changed, 0 insertions, 52 deletions
diff --git a/lib/AnyEvent/Riak/Object.pm b/lib/AnyEvent/Riak/Object.pm
deleted file mode 100644
index d106254..0000000
--- a/lib/AnyEvent/Riak/Object.pm
+++ /dev/null
@@ -1,52 +0,0 @@
-package AnyEvent::Riak::Object;
-
-use Moose;
-use AnyEvent::HTTP;
-
-with qw/
- AnyEvent::Riak::Role::Client
- AnyEvent::Riak::Role::HTTPUtils
- AnyEvent::Riak::Role::CVCB
- /;
-
-has key => (is => 'rw', isa => 'Str');
-has _content => (is => 'rw', isa => 'HashRef', predicate => '_has_content');
-has content_type => (is => 'rw', isa => 'Str', default => 'application/json');
-has bucket => (is => 'rw', isa => 'AnyEvent::Riak::Bucket', required => 1);
-has status => (is => 'rw', isa => 'Int');
-has r => (is => 'rw', isa => 'Int');
-
-sub get {
- my ($self, %options) = @_;
-
- my ($cv, $cb) = $self->cvcb(\%options);
-
- if ($self->_has_content) {
- $cv->send($self->_content);
- }
- else {
- http_request(
- GET => $self->_build_uri(
- [$self->_client->path, $self->bucket->name, $self->key],
- $options{params}
- ),
- headers => $self->_build_headers($options{params}),
- sub {
- my ($body, $headers) = @_;
- if ($body && $headers->{Status} == 200) {
- my $content = JSON::decode_json($body);
- $self->_content($content);
- $cv->send($cb->($self->_content));
- }
- else {
- $cv->send(undef);
- }
- }
- );
- }
- return $cv;
-}
-
-no Moose;
-
-1;