File Coverage

lib/REST/Cypher.pm
Criterion Covered Total %
statement 20 20 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 1 1 100.0
total 28 28 100.0


line stmt bran cond sub pod time code
1             package REST::Cypher;
2             {
3             $REST::Cypher::DIST = 'REST-Cypher';
4             }
5             $REST::Cypher::VERSION = '0.0.2'; # TRIAL
6 2     2   134102 use strict;
  2         5  
  2         63  
7 2     2   10 use warnings;
  2         4  
  2         84  
8              
9 2     2   1836 use Moo;
  2         29432  
  2         12  
10 2     2   4902 use MooX::Types::MooseLike::Base qw/Bool/;
  2         14060  
  2         173  
11 2     2   1727 use MooseX::Params::Validate;
  2         9400297  
  2         13  
12              
13 2     2   1944 use REST::Cypher::Agent;
  2         9  
  2         568  
14              
15             has agent => (
16             is => 'rw',
17             lazy => 1,
18             writer => '_set_agent',
19              
20             default => sub {
21             REST::Cypher::Agent->new(
22             base_url => $_[0]->rest_base_url,
23             debug => $_[0]->debug,
24             );
25             },
26             );
27              
28             has server => (
29             is => 'ro',
30             required => 1,
31             default => 'localhost',
32             );
33              
34             has server_port => (
35             is => 'ro',
36             required => 1,
37             default => '7474',
38             );
39              
40             has rest_base_url => (
41             is => 'ro',
42             lazy => 1,
43             default => sub {
44             sprintf(
45             'http://%s:%d',
46             $_[0]->server,
47             $_[0]->server_port,
48             );
49             },
50             );
51              
52             has debug => (
53             is => 'rw',
54             isa => Bool,
55             default => 0,
56             );
57              
58             sub query {
59 2     2 1 101 my ($self, %params) = validated_hash(
60             \@_,
61             query_string => { isa => 'Str' },
62             );
63              
64             my $response = $self->agent->POST(
65             query_string => $params{query_string}
66 2         1061 );
67             }
68              
69             1;
70             # ABSTRACT: REST::Cypher needs a more meaningful abstract
71              
72             =pod
73              
74             =encoding UTF-8
75              
76             =head1 NAME
77              
78             REST::Cypher - REST::Cypher needs a more meaningful abstract
79              
80             =head1 VERSION
81              
82             version 0.0.2
83              
84             =head1 ATTRIBUTES
85              
86             =head2 agent
87              
88             =head2 server
89              
90             =head2 server_port
91              
92             =head2 rest_base_url
93              
94             =head2 debug
95              
96             =head1 METHODS
97              
98             =head2 query($self, %params)
99              
100             Send a Cypher query to the server,
101              
102             =head1 AUTHOR
103              
104             Chisel <chisel@chizography.net>
105              
106             =head1 COPYRIGHT AND LICENSE
107              
108             This software is copyright (c) 2014 by Chisel Wright.
109              
110             This is free software; you can redistribute it and/or modify it under
111             the same terms as the Perl 5 programming language system itself.
112              
113             =cut
114              
115             __END__
116             # vim: ts=8 sts=4 et sw=4 sr sta