ArangoDB2/Endpoint.pm

filter: Statementstmt 62.5% 20 / 32 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 6 / 10 Podpod 100% 4 / 4 totaltotal 62.5% 30 / 48 CC 2 SCAR 7.8
CC
2
Cov
59%
create
6.0
delete
2.0
list
2.0
CRAP 2.2
« ArangoDB2/Graph/Edge.pm ↑ Summary ArangoDB2/Admin.pm »
1 package ArangoDB2::Endpoint;
2  
3 22 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 22 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 22 ▶use base qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
7 ArangoDB2::Base
8 22 );
9  
10 22 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 22 ▶use JSON::XS;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 22 ▶use URI::Escape qw(uri_escape);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 22 my $JSON = JSON::XS->new->utf8;
15  
16  
17  
18 ###############
19 # API METHODS #
20 ###############
21  
22 # create
23 #
24 # POST /_api/endpoint
25 sub create
26 0 ▶{
Subroutine create: not called CC=2 SCAR=17.9
Pod documented
27 0 my($self, $args) = @_;
28 # process request args
29 0 $args = $self->_build_args($args, ['name', 'databases']);
30 # use name for endpoint param
31 0 $args->{endpoint} = $args->{name};
32 # make request
33 0 ▶ my $res = $self->arango->http->post(
Branch: 1 branch
BranchTrueFalseTotal
my $res = $self->arango->http->post("/_api/endpoint", undef, $JSON->encode($args)) or return 0 0 0
34 '/_api/endpoint',
35 undef,
36 $JSON->encode($args),
37 ) or return;
38 # if request was success copy args to self
39 0 $self->_build_self($args, ['name', 'databases']);
40  
41 0 return $self;
42 }
43  
44 # delete
45 #
46 # DELETE /_api/endpoint/{name}
47 sub delete
48 0 ▶{
Subroutine delete: not called CC=1 SCAR=6.9
Pod documented
49 0 my($self, $args) = @_;
50 # process request args
51 0 $args = $self->_build_args($args, ['name']);
52 # make request
53 return $self->arango->http->delete(
54 '/_api/endpoint/'.uri_escape( $args->{name} )
55 0 );
56 }
57  
58 # list
59 #
60 # GET /_api/endpoint
61 sub list
62 0 ▶{
Subroutine list: not called CC=1 SCAR=6.9
Pod documented
63 0 my($self) = @_;
64  
65 0 return $self->arango->http->get('/_api/endpoint');
66 }
67  
68 ####################
69 # PROPERTY METHODS #
70 ####################
71  
72 0 ▶sub databases { shift->_get_set('databases', @_) }
Subroutine databases: not called CC=1 SCAR=6.9
Pod documented
73  
74 22 1;
75  
76 __END__
« ArangoDB2/Graph/Edge.pm ↑ Summary ArangoDB2/Admin.pm »