From 83e75f1aad3522c877eab5a73f1ac03426e67c22 Mon Sep 17 00:00:00 2001 From: Mainframe2008 Date: Wed, 30 Jan 2013 20:30:53 +0100 Subject: Update lib/Net/Riak/Role/REST.pm --- lib/Net/Riak/Role/REST.pm | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/Net/Riak/Role/REST.pm b/lib/Net/Riak/Role/REST.pm index 261d573..92ea3ae 100644 --- a/lib/Net/Riak/Role/REST.pm +++ b/lib/Net/Riak/Role/REST.pm @@ -1,4 +1,7 @@ package Net::Riak::Role::REST; +{ + $Net::Riak::Role::REST::VERSION = '0.1600'; +} # ABSTRACT: role for REST operations @@ -8,6 +11,7 @@ use Moose::Role; use MooseX::Types::Moose 'Bool'; use Net::Riak::Types qw/HTTPResponse HTTPRequest/; use Data::Dump 'pp'; +use Data::Dumper; with qw/Net::Riak::Role::REST::Bucket Net::Riak::Role::REST::Object Net::Riak::Role::REST::Link @@ -35,6 +39,12 @@ has disable_return_body => ( default => 0 ); +has ssl => ( + is => 'rw', + isa => Bool, + default => 0 +); + sub _build_path { my ($self, $path) = @_; $path = join('/', @$path); @@ -44,6 +54,7 @@ sub _build_uri { my ($self, $path, $params) = @_; my $uri = URI->new($self->get_host); + if ( $uri =~ /^https:.+/ ) { $self->ssl(1); } $uri->path($self->_build_path($path)); $uri->query_form(%$params); $uri; @@ -61,8 +72,9 @@ sub send_request { my ($self, $req) = @_; $self->http_request($req); + my $r = $self->useragent->request($req); - + $self->http_response($r); if ($ENV{RIAK_VERBOSE}) { @@ -99,3 +111,28 @@ sub stats { } 1; + +__END__ +=pod + +=head1 NAME + +Net::Riak::Role::REST - role for REST operations + +=head1 VERSION + +version 0.1600 + +=head1 AUTHOR + +franck cuny , robin edwards + +=head1 COPYRIGHT AND LICENSE + +This software is copyright (c) 2011 by linkfluence. + +This is free software; you can redistribute it and/or modify it under +the same terms as the Perl 5 programming language system itself. + +=cut + -- cgit v1.2.3