File Coverage

blib/lib/App/Dochazka/CLI/Commands/RestTest/Interval.pm
Criterion Covered Total %
statement 43 46 93.4
branch n/a
condition n/a
subroutine 12 13 92.3
pod n/a
total 55 59 93.2


line stmt bran cond sub pod time code
1             # *************************************************************************
2             # Copyright (c) 2014-2016, SUSE LLC
3             #
4             # All rights reserved.
5             #
6             # Redistribution and use in source and binary forms, with or without
7             # modification, are permitted provided that the following conditions are met:
8             #
9             # 1. Redistributions of source code must retain the above copyright notice,
10             # this list of conditions and the following disclaimer.
11             #
12             # 2. Redistributions in binary form must reproduce the above copyright
13             # notice, this list of conditions and the following disclaimer in the
14             # documentation and/or other materials provided with the distribution.
15             #
16             # 3. Neither the name of SUSE LLC nor the names of its contributors may be
17             # used to endorse or promote products derived from this software without
18             # specific prior written permission.
19             #
20             # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21             # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22             # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23             # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24             # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25             # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26             # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27             # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28             # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29             # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30             # POSSIBILITY OF SUCH DAMAGE.
31             # *************************************************************************
32             #
33              
34 20     20   265 use 5.012;
  20         41  
35 20     20   61 use strict;
  20         20  
  20         303  
36 20     20   58 use warnings;
  20         20  
  20         6917  
37              
38             # $METHOD interval
39             sub _method_interval {
40 8     8   2877 my ( $ts, $th ) = @_;
41 8         14 my $method = $ts->[0];
42              
43 8         35 return [ $method, "interval", $th->{_REST} ];
44             }
45              
46             # $METHOD interval eid $EID $TSRANGE
47             sub _method_interval_eid {
48 8     8   2867 my ( $ts, $th ) = @_;
49 8         15 my $method = $ts->[0];
50 8         10 my $eid = $th->{_NUM};
51              
52 8         40 return [ $method, "interval/eid/$eid", $th->{_REST} ];
53             }
54              
55             # $METHOD interval eid $EID $TSRANGE
56             sub _method_interval_eid_tsrange {
57 8     8   2924 my ( $ts, $th ) = @_;
58 8         16 my $method = $ts->[0];
59 8         9 my $eid = $th->{_NUM};
60 8         12 my $tsr = $th->{_TSRANGE};
61              
62 8         41 return [ $method, "interval/eid/$eid/$tsr", $th->{_REST} ];
63             }
64              
65             # $METHOD interval fillup
66             sub _method_interval_fillup {
67 0     0   0 my ( $ts, $th ) = @_;
68 0         0 my $method = $ts->[0];
69              
70 0         0 return [ $method, "interval/fillup", $th->{_REST} ];
71             }
72              
73             # $METHOD interval iid $IID $JSON
74             sub _method_interval_iid {
75 8     8   2894 my ( $ts, $th ) = @_;
76 8         16 my $method = $ts->[0];
77 8         11 my $iid = $th->{_NUM};
78              
79 8         45 return [ $method, "interval/iid/$iid", $th->{_REST} ];
80             }
81              
82             # $METHOD interval new
83             sub _method_interval_new {
84 8     8   2927 my ( $ts, $th ) = @_;
85 8         16 my $method = $ts->[0];
86              
87 8         36 return [ $method, "interval/new", $th->{_REST} ];
88             }
89              
90             # $METHOD interval nick $NICK
91             sub _method_interval_nick {
92 8     8   2999 my ( $ts, $th ) = @_;
93 8         17 my $method = $ts->[0];
94 8         9 my $nick = $th->{_TERM};
95              
96 8         39 return [ $method, "interval/nick/$nick", $th->{_REST} ];
97             }
98              
99             # $METHOD interval nick $NICK $TSRANGE
100             sub _method_interval_nick_tsrange {
101 8     8   2950 my ( $ts, $th ) = @_;
102 8         16 my $method = $ts->[0];
103 8         9 my $nick = $th->{_TERM};
104 8         11 my $tsr = $th->{_TSRANGE};
105              
106 8         40 return [ $method, "interval/nick/$nick/$tsr", $th->{_REST} ];
107             }
108              
109             # $METHOD interval self
110             sub _method_interval_self {
111 8     8   2917 my ( $ts, $th ) = @_;
112 8         15 my $method = $ts->[0];
113              
114 8         36 return [ $method, "interval/self", $th->{_REST} ];
115             }
116              
117             # $METHOD interval self $TSRANGE
118             sub _method_interval_self_tsrange {
119 16     16   5829 my ( $ts, $th ) = @_;
120 16         27 my $method = $ts->[0];
121 16         18 my $tsr = $th->{_TSRANGE};
122              
123 16         74 return [ $method, "interval/self/$tsr", $th->{_REST} ];
124             }
125              
126             # # "/interval/summary/?:qualifiers"
127             # if ( $token =~ m/^sum/ ) {
128             # if ( @tokens ) {
129             # die send_req( $method, 'interval/summary/' . join( ' ', @tokens ) );
130             # }
131             # die send_req( $method, "interval/summary" );
132             # }
133              
134             1;