blob: 1a18ff70ce6c34b3d252f6965c2ac7ce6db5edd0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
package Net::Riak::Role::REST;
# ABSTRACT: role for REST operations
use URI;
use HTTP::Request;
use Moose::Role;
sub _build_path {
my ($self, $path) = @_;
$path = join('/', @$path);
}
sub _build_uri {
my ($self, $path, $params) = @_;
my $uri = URI->new($self->get_host);
$uri->path($self->_build_path($path));
$uri->query_form(%$params);
$uri;
}
sub request {
my ($self, $method, $path, $params) = @_;
my $uri = $self->_build_uri($path, $params);
HTTP::Request->new($method => $uri);
}
1;
|