| 1 | package Pingdom::Client; | ||||||||||||||||||||||||||||||
| 2 | { | ||||||||||||||||||||||||||||||
| 3 | 3 | $Pingdom::Client::VERSION = '0.13'; | |||||||||||||||||||||||||||||
| 4 | } | ||||||||||||||||||||||||||||||
| 5 | # ABSTRACT: a perl implementation of a client for the Pingdom REST API. | ||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||
| 7 | 3 | ▶ | use 5.010_000; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 8 | 3 | ▶ | use mro 'c3'; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use feature ':5.10'; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use Moose; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 12 | 3 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use Carp; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 16 | 3 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 17 | 3 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use JSON; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use URI::Escape (); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||
| 21 | # see http://www.pingdom.com/services/api-documentation-rest/ | ||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||
| 23 | # use autodie; | ||||||||||||||||||||||||||||||
| 24 | # use MooseX::Params::Validate; | ||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||
| 26 | 3 | has '_json' => ( | |||||||||||||||||||||||||||||
| 27 | 'is' => 'ro', | ||||||||||||||||||||||||||||||
| 28 | 'isa' => 'JSON', | ||||||||||||||||||||||||||||||
| 29 | 'lazy' => 1, | ||||||||||||||||||||||||||||||
| 30 | 'builder' => '_init_json', | ||||||||||||||||||||||||||||||
| 31 | ); | ||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||
| 33 | 3 | has '_ua' => ( | |||||||||||||||||||||||||||||
| 34 | 'is' => 'rw', | ||||||||||||||||||||||||||||||
| 35 | 'isa' => 'LWP::UserAgent', | ||||||||||||||||||||||||||||||
| 36 | 'lazy' => 1, | ||||||||||||||||||||||||||||||
| 37 | 'builder' => '_init_ua', | ||||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||
| 40 | 3 | has 'username' => ( | |||||||||||||||||||||||||||||
| 41 | 'is' => 'rw', | ||||||||||||||||||||||||||||||
| 42 | 'isa' => 'Str', | ||||||||||||||||||||||||||||||
| 43 | 'required' => 1, | ||||||||||||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||
| 46 | 3 | has 'password' => ( | |||||||||||||||||||||||||||||
| 47 | 'is' => 'rw', | ||||||||||||||||||||||||||||||
| 48 | 'isa' => 'Str', | ||||||||||||||||||||||||||||||
| 49 | 'required' => 1, | ||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||
| 52 | 3 | has 'apikey' => ( | |||||||||||||||||||||||||||||
| 53 | 'is' => 'rw', | ||||||||||||||||||||||||||||||
| 54 | 'isa' => 'Str', | ||||||||||||||||||||||||||||||
| 55 | 'required' => 1, | ||||||||||||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||
| 58 | 3 | has 'apiurl' => ( | |||||||||||||||||||||||||||||
| 59 | 'is' => 'rw', | ||||||||||||||||||||||||||||||
| 60 | 'isa' => 'Str', | ||||||||||||||||||||||||||||||
| 61 | 'default' => 'https://api.pingdom.com', | ||||||||||||||||||||||||||||||
| 62 | ); | ||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||
| 64 | 3 | has 'apiversion' => ( | |||||||||||||||||||||||||||||
| 65 | 'is' => 'rw', | ||||||||||||||||||||||||||||||
| 66 | 'isa' => 'Str', | ||||||||||||||||||||||||||||||
| 67 | 'default' => '2.0', | ||||||||||||||||||||||||||||||
| 68 | ); | ||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||
| 70 | has 'lasterror' => ( | ||||||||||||||||||||||||||||||
| 71 | 'is' => 'rw', | ||||||||||||||||||||||||||||||
| 72 | 'isa' => 'HashRef', | ||||||||||||||||||||||||||||||
| 73 | 1 | ▶ | 'default' => sub { {} }, | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 74 | 3 | ); | |||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||
| 76 | 0 | ▶ | sub _init_ua { | ||||||||||||||||||||||||||||
|
Subroutine
_init_ua: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 77 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||
| 79 | 0 | my $UA = LWP::UserAgent::->new(); | |||||||||||||||||||||||||||||
| 80 | 0 | $UA->agent('Pingdom::Client/0.01'); | |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||
| 82 | 0 | return $UA; | |||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | sub _init_json { | ||||||||||||||||||||||||||||
|
Subroutine
_init_json: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 86 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||
| 88 | 0 | my $JSON = JSON::->new()->utf8(); | |||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||
| 90 | 0 | return $JSON; | |||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | sub _set_lasterror { | ||||||||||||||||||||||||||||
|
Subroutine
_set_lasterror: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 94 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 95 | 0 | my $code = shift; | |||||||||||||||||||||||||||||
| 96 | 0 | my $msg = shift; | |||||||||||||||||||||||||||||
| 97 | 0 | my $longmsg = shift; | |||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||
| 99 | 0 | $self->lasterror()->{'statuscode'} = $code; | |||||||||||||||||||||||||||||
| 100 | 0 | $self->lasterror()->{'statusdesc'} = $msg; | |||||||||||||||||||||||||||||
| 101 | 0 | $self->lasterror()->{'errormessage'} = $longmsg; | |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||
| 103 | 0 | return 1; | |||||||||||||||||||||||||||||
| 104 | } | ||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||
| 106 | 4 | ▶ | sub _validate_params { | ||||||||||||||||||||||||||||
|
Subroutine
_validate_params: called CC=18 SCAR=41.8
| |||||||||||||||||||||||||||||||
| 107 | 4 | my $self = shift; | |||||||||||||||||||||||||||||
| 108 | 4 | my $ref = shift; | |||||||||||||||||||||||||||||
| 109 | 4 | my $params = shift; | |||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||
| 111 | 4 | foreach my $key (keys %{$params}) { | |||||||||||||||||||||||||||||
| 112 | # whine on superflous params | ||||||||||||||||||||||||||||||
| 113 | 9 | ▶ | if(!$ref->{$key}) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 114 | 0 | return; # not a valid param for this operation | |||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||
| 116 | 9 | ▶ | if(ref($ref->{$key})) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 117 | 0 | ▶ | if(ref($ref->{$key}) eq 'Regexp') { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | if($params->{$key} !~ m/$ref->{$key}/) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 119 | # RE didn't match | ||||||||||||||||||||||||||||||
| 120 | 0 | return; | |||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||
| 123 | } else { | ||||||||||||||||||||||||||||||
| 124 | # match String, Int, Bool | ||||||||||||||||||||||||||||||
| 125 | 9 | ▶ | if($ref->{$key} eq 'Str') { | ||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||
| 126 | 2 | ▶ | if($params->{$key} !~ m/^.{1,4096}$/) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 127 | 0 | return; # no string | |||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||||
| 129 | } elsif($ref->{$key} eq 'Int') { | ||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | if($params->{$key} !~ m/^\d+$/) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 131 | 0 | return; # no int | |||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||
| 133 | } elsif($ref->{$key} eq 'Bool') { | ||||||||||||||||||||||||||||||
| 134 | 4 | ▶ | if($params->{$key} !~ m/^(?:true|false)$/) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 135 | 2 | return; # no bool | |||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||
| 137 | } elsif($ref->{$key} eq 'Ids') { | ||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | if($params->{$key} !~ m/^(?:\d+,)*\d+$/) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 139 | 0 | return; # no id list | |||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||
| 141 | } elsif($ref->{$key} eq 'Order') { | ||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | if($params->{$key} !~ m/^(?:ASC|DESC)$/i) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 143 | 0 | return; # not valid value for order | |||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||
| 145 | } elsif($ref->{$key} eq 'Checktype') { | ||||||||||||||||||||||||||||||
| 146 | 3 | ▶ | if($params->{$key} !~ m/^(?:http|httpcustom|tcp|ping|dns|udp|smtp|pop3|imap)$/) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 147 | 0 | return; # not a valid type of check | |||||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||
| 153 | 2 | return 1; | |||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | sub _api_call { | ||||||||||||||||||||||||||||
|
Subroutine
_api_call: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||
| 157 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 158 | 0 | my $method = shift; | |||||||||||||||||||||||||||||
| 159 | 0 | my $url = shift; | |||||||||||||||||||||||||||||
| 160 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||
| 162 | 0 | $method = uc($method); | |||||||||||||||||||||||||||||
| 163 | 0 | $url = $self->apiurl().'/api/'.$self->apiversion().'/'.$url; | |||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||
| 165 | 0 | my $content = ''; | |||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if($params && ref($params) eq 'HASH' ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$params and ref $params eq "HASH"
MC/DC0%0/2
$params and ref $params eq "HASH"
$params
ref $params eq "HASH"
Truth table0%0/3
A and B
A= $paramsB= ref $params eq "HASH"
| |||||||||||||||||||||||||||||||
| 167 | 0 | foreach my $key (keys %{$params}) { | |||||||||||||||||||||||||||||
| 168 | 0 | my $value = $params->{$key}; | |||||||||||||||||||||||||||||
| 169 | # urlencode key and value | ||||||||||||||||||||||||||||||
| 170 | 0 | $key = URI::Escape::uri_escape($key); | |||||||||||||||||||||||||||||
| 171 | 0 | $value = URI::Escape::uri_escape($value); | |||||||||||||||||||||||||||||
| 172 | 0 | $content .= $key.'='.$value.'&'; | |||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | if($method eq 'GET') { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 175 | 0 | $url .= '?'.$content; | |||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||||
| 178 | 0 | my $req = HTTP::Request::->new( $method => $url, ); | |||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if($method ne 'GET') { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 180 | 0 | $req->content_type('application/x-www-form-urlencoded'); | |||||||||||||||||||||||||||||
| 181 | 0 | $req->content($content); | |||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||
| 184 | 0 | $req->authorization_basic( $self->username(), $self->password() ); | |||||||||||||||||||||||||||||
| 185 | 0 | $req->header( 'App-Key', $self->apikey() ); | |||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||
| 187 | 0 | my $res = $self->_ua()->request($req); | |||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if ( $res->is_success() ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 190 | 0 | my $result_ref; | |||||||||||||||||||||||||||||
| 191 | 0 | ▶ | try { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 192 | 0 | $result_ref = $self->_json()->decode($res->content()); | |||||||||||||||||||||||||||||
| 193 | 0 | 1; | |||||||||||||||||||||||||||||
| 194 | 0 | ▶ | } catch { | ||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||
| 195 | 0 | my $msg = 'Unable to decode JSON: '.$_; | |||||||||||||||||||||||||||||
| 196 | 0 | $self->_set_lasterror(901,'JSON-Decode',$msg); | |||||||||||||||||||||||||||||
| 197 | 0 | carp $msg; | |||||||||||||||||||||||||||||
| 198 | 0 | }; | |||||||||||||||||||||||||||||
| 199 | 0 | return $result_ref; | |||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||
| 201 | else { | ||||||||||||||||||||||||||||||
| 202 | 0 | $self->_set_lasterror($res->code(), $res->message(), $res->content()); | |||||||||||||||||||||||||||||
| 203 | 0 | carp "Request to $url failed: ".$res->code().' '.$res->message().' '.$res->content(); | |||||||||||||||||||||||||||||
| 204 | 0 | return; | |||||||||||||||||||||||||||||
| 205 | } | ||||||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||
| 208 | 0 | ▶ | sub actions { | ||||||||||||||||||||||||||||
|
Subroutine
actions: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 209 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 210 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||
| 212 | # Valid params: | ||||||||||||||||||||||||||||||
| 213 | # from - Int | ||||||||||||||||||||||||||||||
| 214 | # to - Int | ||||||||||||||||||||||||||||||
| 215 | # limit - Int (<= 300) | ||||||||||||||||||||||||||||||
| 216 | # offset - Int | ||||||||||||||||||||||||||||||
| 217 | # checkids - String | ||||||||||||||||||||||||||||||
| 218 | # contactids - String | ||||||||||||||||||||||||||||||
| 219 | # status - String (sent,delivered,error,not_delivered,no_credits) | ||||||||||||||||||||||||||||||
| 220 | # via - String (email,sms,twitter,iphone,android) | ||||||||||||||||||||||||||||||
| 221 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 222 | 'from' => 'Int', | ||||||||||||||||||||||||||||||
| 223 | 'to' => 'Int', | ||||||||||||||||||||||||||||||
| 224 | 'limit' => qr/^[0123]?[0-9]?[0-9]$/, | ||||||||||||||||||||||||||||||
| 225 | 'offset' => 'Int', | ||||||||||||||||||||||||||||||
| 226 | 'checkids' => 'Ids', | ||||||||||||||||||||||||||||||
| 227 | 'contactids' => 'Ids', | ||||||||||||||||||||||||||||||
| 228 | 'status' => qr/^(?:sent|delivered|error|not_delivered|no_credits)$/, | ||||||||||||||||||||||||||||||
| 229 | 'via' => qr/^(?:email|sms|twitter|iphone|android)$/, | ||||||||||||||||||||||||||||||
| 230 | }; | ||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 232 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method action'); | |||||||||||||||||||||||||||||
| 233 | 0 | return; | |||||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||
| 236 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 237 | 0 | my $url = 'actions'; | |||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||
| 239 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||
| 241 | 0 | return $result; | |||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | sub analysis { | ||||||||||||||||||||||||||||
|
Subroutine
analysis: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 245 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 246 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 247 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||
| 249 | # Valid params: | ||||||||||||||||||||||||||||||
| 250 | # limit - Int | ||||||||||||||||||||||||||||||
| 251 | # offset - Int | ||||||||||||||||||||||||||||||
| 252 | # from - Int | ||||||||||||||||||||||||||||||
| 253 | # to - Int | ||||||||||||||||||||||||||||||
| 254 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 255 | 'from' => 'Int', | ||||||||||||||||||||||||||||||
| 256 | 'to' => 'Int', | ||||||||||||||||||||||||||||||
| 257 | 'limit' => qr/^[0123]?[0-9]?[0-9]$/, | ||||||||||||||||||||||||||||||
| 258 | 'offset' => 'Int', | ||||||||||||||||||||||||||||||
| 259 | }; | ||||||||||||||||||||||||||||||
| 260 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 261 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method analysis'); | |||||||||||||||||||||||||||||
| 262 | 0 | return; | |||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||
| 265 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 266 | 0 | my $url = 'analysis/'.$checkid; | |||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||
| 268 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||
| 270 | 0 | return $result; | |||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||
| 273 | 0 | ▶ | sub analysis_raw { | ||||||||||||||||||||||||||||
|
Subroutine
analysis_raw: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 274 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 275 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 276 | 0 | my $analysisid = shift; | |||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||
| 278 | # Valid params: | ||||||||||||||||||||||||||||||
| 279 | # none | ||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||
| 281 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 282 | 0 | my $url = 'analysis/'.$checkid.'/'.$analysisid; | |||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||
| 284 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 285 | |||||||||||||||||||||||||||||||
| 286 | 0 | return $result; | |||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||
| 289 | 0 | ▶ | sub checks { | ||||||||||||||||||||||||||||
|
Subroutine
checks: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 290 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 291 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||
| 293 | # Valid params: | ||||||||||||||||||||||||||||||
| 294 | # limit - Int | ||||||||||||||||||||||||||||||
| 295 | # offset - Int | ||||||||||||||||||||||||||||||
| 296 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 297 | 'limit' => qr/^[0123]?[0-9]?[0-9]$/, | ||||||||||||||||||||||||||||||
| 298 | 'offset' => 'Int', | ||||||||||||||||||||||||||||||
| 299 | }; | ||||||||||||||||||||||||||||||
| 300 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 301 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method checks'); | |||||||||||||||||||||||||||||
| 302 | 0 | return; | |||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||
| 305 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 306 | 0 | my $url = 'checks'; | |||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||
| 308 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||
| 310 | 0 | return $result; | |||||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | sub check_details { | ||||||||||||||||||||||||||||
|
Subroutine
check_details: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 314 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 315 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||
| 317 | # Valid params: | ||||||||||||||||||||||||||||||
| 318 | # none | ||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||
| 320 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 321 | 0 | my $url = 'checks/'.$checkid; | |||||||||||||||||||||||||||||
| 322 | |||||||||||||||||||||||||||||||
| 323 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||||
| 325 | 0 | return $result; | |||||||||||||||||||||||||||||
| 326 | } | ||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | sub check_create { | ||||||||||||||||||||||||||||
|
Subroutine
check_create: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 329 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 330 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||
| 332 | # Valid params: | ||||||||||||||||||||||||||||||
| 333 | # name - Str | ||||||||||||||||||||||||||||||
| 334 | # host - Str | ||||||||||||||||||||||||||||||
| 335 | # type - String (http, httpcustom,tcp,ping,dns,udp,smtp,pop3,imap) | ||||||||||||||||||||||||||||||
| 336 | # paused - Bool | ||||||||||||||||||||||||||||||
| 337 | # resolution - Int (1, 5, 15, 30, 60) | ||||||||||||||||||||||||||||||
| 338 | # contactids - Ints | ||||||||||||||||||||||||||||||
| 339 | # sendtoemail - Bool | ||||||||||||||||||||||||||||||
| 340 | # sendtosms - Bool | ||||||||||||||||||||||||||||||
| 341 | # sendtotwitter - Bool | ||||||||||||||||||||||||||||||
| 342 | # sendtoiphone - Bool | ||||||||||||||||||||||||||||||
| 343 | # sendtoandroid - Bool | ||||||||||||||||||||||||||||||
| 344 | # sendnotificationwhendown - Int | ||||||||||||||||||||||||||||||
| 345 | # notifyagainevery - Int | ||||||||||||||||||||||||||||||
| 346 | # notifywhenbackup - Bool | ||||||||||||||||||||||||||||||
| 347 | # ... (many more) | ||||||||||||||||||||||||||||||
| 348 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 349 | 'name' => 'Str', | ||||||||||||||||||||||||||||||
| 350 | 'host' => 'Str', | ||||||||||||||||||||||||||||||
| 351 | 'type' => 'Checktype', | ||||||||||||||||||||||||||||||
| 352 | 'paused' => 'Bool', | ||||||||||||||||||||||||||||||
| 353 | 'resolution' => 'Int', | ||||||||||||||||||||||||||||||
| 354 | 'contactids' => 'Ids', | ||||||||||||||||||||||||||||||
| 355 | 'sendtoemail' => 'Bool', | ||||||||||||||||||||||||||||||
| 356 | 'sendtosms' => 'Bool', | ||||||||||||||||||||||||||||||
| 357 | 'sendtotwitter' => 'Bool', | ||||||||||||||||||||||||||||||
| 358 | 'sendtoiphone' => 'Bool', | ||||||||||||||||||||||||||||||
| 359 | 'sendtoandroid' => 'Bool', | ||||||||||||||||||||||||||||||
| 360 | 'sendnotificationwhendown' => 'Int', | ||||||||||||||||||||||||||||||
| 361 | 'notifyagainevery' => 'Int', | ||||||||||||||||||||||||||||||
| 362 | 'notifywhenbackup' => 'Bool', | ||||||||||||||||||||||||||||||
| 363 | 'url' => 'Str', | ||||||||||||||||||||||||||||||
| 364 | 'encryption' => 'Bool', | ||||||||||||||||||||||||||||||
| 365 | 'port' => 'Int', | ||||||||||||||||||||||||||||||
| 366 | 'auth' => 'Str', | ||||||||||||||||||||||||||||||
| 367 | 'shouldcontain' => 'Str', | ||||||||||||||||||||||||||||||
| 368 | 'shouldnotcontain' => 'Str', | ||||||||||||||||||||||||||||||
| 369 | 'postdata' => 'Str', | ||||||||||||||||||||||||||||||
| 370 | 'additionalurls' => 'Str', | ||||||||||||||||||||||||||||||
| 371 | 'stringtosend' => 'Str', | ||||||||||||||||||||||||||||||
| 372 | 'stringtoexpect' => 'Str', | ||||||||||||||||||||||||||||||
| 373 | 'expectedip' => 'Str', | ||||||||||||||||||||||||||||||
| 374 | 'nameserver' => 'Str', | ||||||||||||||||||||||||||||||
| 375 | }; | ||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 377 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method check_create'); | |||||||||||||||||||||||||||||
| 378 | 0 | return; | |||||||||||||||||||||||||||||
| 379 | } | ||||||||||||||||||||||||||||||
| 380 | |||||||||||||||||||||||||||||||
| 381 | 0 | my $method = 'POST'; | |||||||||||||||||||||||||||||
| 382 | 0 | my $url = 'checks'; | |||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||
| 384 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||
| 386 | 0 | return $result; | |||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||
| 389 | 0 | ▶ | sub check_modify { | ||||||||||||||||||||||||||||
|
Subroutine
check_modify: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 390 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 391 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 392 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||
| 394 | # Valid params: | ||||||||||||||||||||||||||||||
| 395 | # ... | ||||||||||||||||||||||||||||||
| 396 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 397 | 'name' => 'Str', | ||||||||||||||||||||||||||||||
| 398 | 'host' => 'Str', | ||||||||||||||||||||||||||||||
| 399 | 'type' => 'Checktype', | ||||||||||||||||||||||||||||||
| 400 | 'paused' => 'Bool', | ||||||||||||||||||||||||||||||
| 401 | 'resolution' => 'Int', | ||||||||||||||||||||||||||||||
| 402 | 'contactids' => 'Ids', | ||||||||||||||||||||||||||||||
| 403 | 'sendtoemail' => 'Bool', | ||||||||||||||||||||||||||||||
| 404 | 'sendtosms' => 'Bool', | ||||||||||||||||||||||||||||||
| 405 | 'sendtotwitter' => 'Bool', | ||||||||||||||||||||||||||||||
| 406 | 'sendtoiphone' => 'Bool', | ||||||||||||||||||||||||||||||
| 407 | 'sendtoandroid' => 'Bool', | ||||||||||||||||||||||||||||||
| 408 | 'sendnotificationwhendown' => 'Int', | ||||||||||||||||||||||||||||||
| 409 | 'notifyagainevery' => 'Int', | ||||||||||||||||||||||||||||||
| 410 | 'notifywhenbackup' => 'Bool', | ||||||||||||||||||||||||||||||
| 411 | 'url' => 'Str', | ||||||||||||||||||||||||||||||
| 412 | 'encryption' => 'Bool', | ||||||||||||||||||||||||||||||
| 413 | 'port' => 'Int', | ||||||||||||||||||||||||||||||
| 414 | 'auth' => 'Str', | ||||||||||||||||||||||||||||||
| 415 | 'shouldcontain' => 'Str', | ||||||||||||||||||||||||||||||
| 416 | 'shouldnotcontain' => 'Str', | ||||||||||||||||||||||||||||||
| 417 | 'postdata' => 'Str', | ||||||||||||||||||||||||||||||
| 418 | 'additionalurls' => 'Str', | ||||||||||||||||||||||||||||||
| 419 | 'stringtosend' => 'Str', | ||||||||||||||||||||||||||||||
| 420 | 'stringtoexpect' => 'Str', | ||||||||||||||||||||||||||||||
| 421 | 'expectedip' => 'Str', | ||||||||||||||||||||||||||||||
| 422 | 'nameserver' => 'Str', | ||||||||||||||||||||||||||||||
| 423 | }; | ||||||||||||||||||||||||||||||
| 424 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 425 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method check_modify'); | |||||||||||||||||||||||||||||
| 426 | 0 | return; | |||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||
| 429 | 0 | my $method = 'PUT'; | |||||||||||||||||||||||||||||
| 430 | 0 | my $url = 'checks/'.$checkid; | |||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||
| 432 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||
| 434 | 0 | return $result; | |||||||||||||||||||||||||||||
| 435 | } | ||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||
| 437 | 0 | ▶ | sub check_modify_bulk { | ||||||||||||||||||||||||||||
|
Subroutine
check_modify_bulk: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 438 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 439 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||
| 441 | # Valid params: | ||||||||||||||||||||||||||||||
| 442 | # paused - Bool | ||||||||||||||||||||||||||||||
| 443 | # resolution - Int (1, 5, 15, 30, 60)# | ||||||||||||||||||||||||||||||
| 444 | # checkids - Str | ||||||||||||||||||||||||||||||
| 445 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 446 | 'paused' => 'Bool', | ||||||||||||||||||||||||||||||
| 447 | 'resolution' => qr/^(?:1|5|15|30|60)$/, | ||||||||||||||||||||||||||||||
| 448 | 'checkids' => 'Ids', | ||||||||||||||||||||||||||||||
| 449 | }; | ||||||||||||||||||||||||||||||
| 450 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 451 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method check_modify_bulk'); | |||||||||||||||||||||||||||||
| 452 | 0 | return; | |||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||
| 455 | 0 | my $method = 'PUT'; | |||||||||||||||||||||||||||||
| 456 | 0 | my $url = 'checks'; | |||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||
| 458 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||
| 460 | 0 | return $result; | |||||||||||||||||||||||||||||
| 461 | } | ||||||||||||||||||||||||||||||
| 462 | |||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | sub check_delete { | ||||||||||||||||||||||||||||
|
Subroutine
check_delete: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 464 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 465 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||
| 467 | # Valid params: | ||||||||||||||||||||||||||||||
| 468 | # none | ||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||
| 470 | 0 | my $method = 'DELETE'; | |||||||||||||||||||||||||||||
| 471 | 0 | my $url = 'checks/'.$checkid; | |||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||
| 473 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||
| 475 | 0 | return $result; | |||||||||||||||||||||||||||||
| 476 | } | ||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | sub contacts { | ||||||||||||||||||||||||||||
|
Subroutine
contacts: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 479 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 480 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||
| 482 | # Valid params: | ||||||||||||||||||||||||||||||
| 483 | # limit - Int | ||||||||||||||||||||||||||||||
| 484 | # offset - Int | ||||||||||||||||||||||||||||||
| 485 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 486 | 'limit' => qr/^[0123]?[0-9]?[0-9]$/, | ||||||||||||||||||||||||||||||
| 487 | 'offset' => 'Int', | ||||||||||||||||||||||||||||||
| 488 | }; | ||||||||||||||||||||||||||||||
| 489 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 490 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method contacts'); | |||||||||||||||||||||||||||||
| 491 | 0 | return; | |||||||||||||||||||||||||||||
| 492 | } | ||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||
| 494 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 495 | 0 | my $url = 'contacts'; | |||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||
| 497 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||
| 499 | 0 | return $result; | |||||||||||||||||||||||||||||
| 500 | } | ||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||
| 502 | 0 | ▶ | sub contact_create { | ||||||||||||||||||||||||||||
|
Subroutine
contact_create: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 503 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 504 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||
| 506 | # Valid params: | ||||||||||||||||||||||||||||||
| 507 | # name - Str | ||||||||||||||||||||||||||||||
| 508 | # email - Str | ||||||||||||||||||||||||||||||
| 509 | # cellphone - Str | ||||||||||||||||||||||||||||||
| 510 | # countrycode - Str | ||||||||||||||||||||||||||||||
| 511 | # countryiso - Str (iso3166) | ||||||||||||||||||||||||||||||
| 512 | # defaultsmsprovider - String (clickatell,bulksms,esendex,cellsynt) | ||||||||||||||||||||||||||||||
| 513 | # directtwitter - Bool | ||||||||||||||||||||||||||||||
| 514 | # twitteruser - Str | ||||||||||||||||||||||||||||||
| 515 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 516 | 'name' => 'Str', | ||||||||||||||||||||||||||||||
| 517 | 'email' => 'Str', | ||||||||||||||||||||||||||||||
| 518 | 'cellphone' => 'Str', | ||||||||||||||||||||||||||||||
| 519 | 'countryiso' => 'Str', | ||||||||||||||||||||||||||||||
| 520 | 'countrycode' => 'Str', | ||||||||||||||||||||||||||||||
| 521 | 'defaultsmsprovider' => 'Str', | ||||||||||||||||||||||||||||||
| 522 | 'directtwitter' => 'Bool', | ||||||||||||||||||||||||||||||
| 523 | 'twitteruser' => 'Bool', | ||||||||||||||||||||||||||||||
| 524 | }; | ||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 526 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method contact_create'); | |||||||||||||||||||||||||||||
| 527 | 0 | return; | |||||||||||||||||||||||||||||
| 528 | } | ||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||
| 530 | 0 | my $method = 'POST'; | |||||||||||||||||||||||||||||
| 531 | 0 | my $url = 'contacts'; | |||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||||
| 533 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||||
| 535 | 0 | return $result; | |||||||||||||||||||||||||||||
| 536 | } | ||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | sub contact_modify { | ||||||||||||||||||||||||||||
|
Subroutine
contact_modify: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 539 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 540 | 0 | my $contact_id = shift; | |||||||||||||||||||||||||||||
| 541 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||
| 543 | # Valid params: | ||||||||||||||||||||||||||||||
| 544 | # name - String | ||||||||||||||||||||||||||||||
| 545 | # email - String | ||||||||||||||||||||||||||||||
| 546 | # cellphone - String, excl. countrycode and leading zero | ||||||||||||||||||||||||||||||
| 547 | # countrycode - String, tel. | ||||||||||||||||||||||||||||||
| 548 | # countryiso - String, iso3166 | ||||||||||||||||||||||||||||||
| 549 | # defaultsmsprovider - String (clickatell,bulksms,esendex,cellsynt) | ||||||||||||||||||||||||||||||
| 550 | # paused - Boolean | ||||||||||||||||||||||||||||||
| 551 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 552 | 'name' => 'Str', | ||||||||||||||||||||||||||||||
| 553 | 'email' => 'Str', | ||||||||||||||||||||||||||||||
| 554 | 'cellphone' => 'Str', | ||||||||||||||||||||||||||||||
| 555 | 'countryiso' => 'Str', | ||||||||||||||||||||||||||||||
| 556 | 'countrycode' => 'Str', | ||||||||||||||||||||||||||||||
| 557 | 'defaultsmsprovider' => 'Str', | ||||||||||||||||||||||||||||||
| 558 | 'directtwitter' => 'Bool', | ||||||||||||||||||||||||||||||
| 559 | 'twitteruser' => 'Bool', | ||||||||||||||||||||||||||||||
| 560 | }; | ||||||||||||||||||||||||||||||
| 561 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 562 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method contact_modify'); | |||||||||||||||||||||||||||||
| 563 | 0 | return; | |||||||||||||||||||||||||||||
| 564 | } | ||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||
| 566 | 0 | my $method = 'PUT'; | |||||||||||||||||||||||||||||
| 567 | 0 | my $url = 'contacts/'.$contact_id; | |||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||
| 569 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||
| 571 | 0 | return $result; | |||||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | sub contact_delete { | ||||||||||||||||||||||||||||
|
Subroutine
contact_delete: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 575 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 576 | 0 | my $contactid = shift; | |||||||||||||||||||||||||||||
| 577 | |||||||||||||||||||||||||||||||
| 578 | # Valid params: | ||||||||||||||||||||||||||||||
| 579 | # none | ||||||||||||||||||||||||||||||
| 580 | |||||||||||||||||||||||||||||||
| 581 | 0 | my $method = 'DELETE'; | |||||||||||||||||||||||||||||
| 582 | 0 | my $url = 'contacts/'.$contactid; | |||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||
| 584 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||
| 586 | 0 | return $result; | |||||||||||||||||||||||||||||
| 587 | } | ||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||
| 589 | 0 | ▶ | sub credits { | ||||||||||||||||||||||||||||
|
Subroutine
credits: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 590 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||
| 592 | # Valid params: | ||||||||||||||||||||||||||||||
| 593 | # none | ||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||
| 595 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 596 | 0 | my $url = 'credits'; | |||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||
| 598 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||
| 600 | 0 | return $result; | |||||||||||||||||||||||||||||
| 601 | } | ||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||
| 603 | 0 | ▶ | sub probes { | ||||||||||||||||||||||||||||
|
Subroutine
probes: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 604 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 605 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 606 | |||||||||||||||||||||||||||||||
| 607 | # Valid params: | ||||||||||||||||||||||||||||||
| 608 | # limit - Int | ||||||||||||||||||||||||||||||
| 609 | # offset - Int | ||||||||||||||||||||||||||||||
| 610 | # onlyactive - Bool | ||||||||||||||||||||||||||||||
| 611 | # includedeleted - Bool | ||||||||||||||||||||||||||||||
| 612 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 613 | 'onlyactive' => 'Bool', | ||||||||||||||||||||||||||||||
| 614 | 'includedeleted' => 'Bool', | ||||||||||||||||||||||||||||||
| 615 | 'limit' => qr/^[0123]?[0-9]?[0-9]$/, | ||||||||||||||||||||||||||||||
| 616 | 'offset' => 'Int', | ||||||||||||||||||||||||||||||
| 617 | }; | ||||||||||||||||||||||||||||||
| 618 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 619 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method probes'); | |||||||||||||||||||||||||||||
| 620 | 0 | return; | |||||||||||||||||||||||||||||
| 621 | } | ||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||
| 623 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 624 | 0 | my $url = 'probes'; | |||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||
| 626 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||
| 628 | 0 | return $result; | |||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||
| 631 | 0 | ▶ | sub reference { | ||||||||||||||||||||||||||||
|
Subroutine
reference: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 632 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 633 | |||||||||||||||||||||||||||||||
| 634 | # Valid params: | ||||||||||||||||||||||||||||||
| 635 | # none | ||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||
| 637 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 638 | 0 | my $url = 'reference'; | |||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||
| 640 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||
| 642 | 0 | return $result; | |||||||||||||||||||||||||||||
| 643 | } | ||||||||||||||||||||||||||||||
| 644 | |||||||||||||||||||||||||||||||
| 645 | # Method: Get Email Report Subscription List | ||||||||||||||||||||||||||||||
| 646 | # Description: Returns a list of email report subscriptions. | ||||||||||||||||||||||||||||||
| 647 | 0 | ▶ | sub reports_email { | ||||||||||||||||||||||||||||
|
Subroutine
reports_email: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 648 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||
| 650 | # Valid params: | ||||||||||||||||||||||||||||||
| 651 | # none | ||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||
| 653 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 654 | 0 | my $url = 'reports.email'; | |||||||||||||||||||||||||||||
| 655 | |||||||||||||||||||||||||||||||
| 656 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||
| 658 | 0 | return $result; | |||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||
| 661 | # Method: Create Email Report | ||||||||||||||||||||||||||||||
| 662 | # Description: Creates a new email report. | ||||||||||||||||||||||||||||||
| 663 | 0 | ▶ | sub reports_email_create { | ||||||||||||||||||||||||||||
|
Subroutine
reports_email_create: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||
| 664 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 665 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||
| 667 | # Valid params: | ||||||||||||||||||||||||||||||
| 668 | # name - Str - req! | ||||||||||||||||||||||||||||||
| 669 | # checkid - Int | ||||||||||||||||||||||||||||||
| 670 | # frequency - Str (monthly,weekly,daily) | ||||||||||||||||||||||||||||||
| 671 | # contactids - Str | ||||||||||||||||||||||||||||||
| 672 | # additionalemails - Str | ||||||||||||||||||||||||||||||
| 673 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 674 | 'name' => 'Str', | ||||||||||||||||||||||||||||||
| 675 | 'checkid' => 'Int', | ||||||||||||||||||||||||||||||
| 676 | 'frequency' => qr/^(?:daily|weekly|monthly)$/, | ||||||||||||||||||||||||||||||
| 677 | 'contactids' => 'Ids', | ||||||||||||||||||||||||||||||
| 678 | 'additionalemails' => 'Str', | ||||||||||||||||||||||||||||||
| 679 | }; | ||||||||||||||||||||||||||||||
| 680 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 681 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method reports_email_create'); | |||||||||||||||||||||||||||||
| 682 | 0 | return; | |||||||||||||||||||||||||||||
| 683 | } | ||||||||||||||||||||||||||||||
| 684 | 0 | ▶ | if(!$params->{'name'}) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 685 | 0 | return; # required parameter | |||||||||||||||||||||||||||||
| 686 | } | ||||||||||||||||||||||||||||||
| 687 | |||||||||||||||||||||||||||||||
| 688 | 0 | my $method = 'POST'; | |||||||||||||||||||||||||||||
| 689 | 0 | my $url = 'reports.email'; | |||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||
| 691 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||
| 693 | 0 | return $result; | |||||||||||||||||||||||||||||
| 694 | } | ||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||
| 696 | # Method: Modify Email Report | ||||||||||||||||||||||||||||||
| 697 | # Description: Modify an email report. | ||||||||||||||||||||||||||||||
| 698 | 0 | ▶ | sub reports_email_modify { | ||||||||||||||||||||||||||||
|
Subroutine
reports_email_modify: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 699 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 700 | 0 | my $reportid = shift; | |||||||||||||||||||||||||||||
| 701 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||
| 703 | # Valid params: | ||||||||||||||||||||||||||||||
| 704 | # name - Str | ||||||||||||||||||||||||||||||
| 705 | # checkid - Str | ||||||||||||||||||||||||||||||
| 706 | # frequency - Str (monthly, weekly, daily) | ||||||||||||||||||||||||||||||
| 707 | # contactids - Str | ||||||||||||||||||||||||||||||
| 708 | # additionalemails - Str | ||||||||||||||||||||||||||||||
| 709 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 710 | 'name' => 'Str', | ||||||||||||||||||||||||||||||
| 711 | 'checkid' => 'Int', | ||||||||||||||||||||||||||||||
| 712 | 'frequency' => qr/^(?:daily|weekly|monthly)$/, | ||||||||||||||||||||||||||||||
| 713 | 'contactids' => 'Ids', | ||||||||||||||||||||||||||||||
| 714 | 'additionalemails' => 'Str', | ||||||||||||||||||||||||||||||
| 715 | }; | ||||||||||||||||||||||||||||||
| 716 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 717 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method reports_email_modify'); | |||||||||||||||||||||||||||||
| 718 | 0 | return; | |||||||||||||||||||||||||||||
| 719 | } | ||||||||||||||||||||||||||||||
| 720 | |||||||||||||||||||||||||||||||
| 721 | 0 | my $method = 'PUT'; | |||||||||||||||||||||||||||||
| 722 | 0 | my $url = 'reports.email/'.$reportid; | |||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||
| 724 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 725 | |||||||||||||||||||||||||||||||
| 726 | 0 | return $result; | |||||||||||||||||||||||||||||
| 727 | } | ||||||||||||||||||||||||||||||
| 728 | |||||||||||||||||||||||||||||||
| 729 | # Method: Delete Email Report | ||||||||||||||||||||||||||||||
| 730 | # Description: Delete an email report. | ||||||||||||||||||||||||||||||
| 731 | 0 | ▶ | sub reports_email_delete { | ||||||||||||||||||||||||||||
|
Subroutine
reports_email_delete: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 732 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 733 | 0 | my $reportid = shift; | |||||||||||||||||||||||||||||
| 734 | |||||||||||||||||||||||||||||||
| 735 | # Valid params: | ||||||||||||||||||||||||||||||
| 736 | # none | ||||||||||||||||||||||||||||||
| 737 | |||||||||||||||||||||||||||||||
| 738 | 0 | my $method = 'DELETE'; | |||||||||||||||||||||||||||||
| 739 | 0 | my $url = 'reports.email/'.$reportid; | |||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||
| 741 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||
| 743 | 0 | return $result; | |||||||||||||||||||||||||||||
| 744 | } | ||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||
| 746 | # Method: Get Public Report List | ||||||||||||||||||||||||||||||
| 747 | # Description: Returns a list of public (web-based) reports. | ||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | sub reports_public { | ||||||||||||||||||||||||||||
|
Subroutine
reports_public: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 749 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||
| 751 | # Valid params: | ||||||||||||||||||||||||||||||
| 752 | # none | ||||||||||||||||||||||||||||||
| 753 | |||||||||||||||||||||||||||||||
| 754 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 755 | 0 | my $url = 'reports.public'; | |||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||
| 757 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||
| 759 | 0 | return $result; | |||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||
| 762 | # Method: Publish Public Report | ||||||||||||||||||||||||||||||
| 763 | # Description: Activate public report for a specified check. | ||||||||||||||||||||||||||||||
| 764 | 0 | ▶ | sub reports_public_create { | ||||||||||||||||||||||||||||
|
Subroutine
reports_public_create: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 765 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 766 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||
| 768 | # Valid params: | ||||||||||||||||||||||||||||||
| 769 | # none | ||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||
| 771 | 0 | my $method = 'PUT'; | |||||||||||||||||||||||||||||
| 772 | 0 | my $url = 'reports.public/'.$checkid; | |||||||||||||||||||||||||||||
| 773 | |||||||||||||||||||||||||||||||
| 774 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||
| 776 | 0 | return $result; | |||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||
| 779 | # Method: Withdraw Public Report | ||||||||||||||||||||||||||||||
| 780 | # Description: Deactivate public report for a specified check. | ||||||||||||||||||||||||||||||
| 781 | 0 | ▶ | sub reports_public_delete { | ||||||||||||||||||||||||||||
|
Subroutine
reports_public_delete: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 782 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 783 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 784 | |||||||||||||||||||||||||||||||
| 785 | # Valid params: | ||||||||||||||||||||||||||||||
| 786 | # none | ||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||
| 788 | 0 | my $method = 'DELETE'; | |||||||||||||||||||||||||||||
| 789 | 0 | my $url = 'reports.public/'.$checkid; | |||||||||||||||||||||||||||||
| 790 | |||||||||||||||||||||||||||||||
| 791 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 792 | |||||||||||||||||||||||||||||||
| 793 | 0 | return $result; | |||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||
| 796 | # Method: Get Shared Reports (Banners) List | ||||||||||||||||||||||||||||||
| 797 | # Description: Returns a list of shared reports (banners). | ||||||||||||||||||||||||||||||
| 798 | 0 | ▶ | sub reports_shared { | ||||||||||||||||||||||||||||
|
Subroutine
reports_shared: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 799 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||
| 801 | # Valid params: | ||||||||||||||||||||||||||||||
| 802 | # none | ||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||
| 804 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 805 | 0 | my $url = 'reports.shared'; | |||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||
| 807 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 808 | |||||||||||||||||||||||||||||||
| 809 | 0 | return $result; | |||||||||||||||||||||||||||||
| 810 | } | ||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||
| 812 | # Method: Create Shared Report (Banner) | ||||||||||||||||||||||||||||||
| 813 | # Description: Create a shared report (banner). | ||||||||||||||||||||||||||||||
| 814 | 0 | ▶ | sub reports_shared_create { | ||||||||||||||||||||||||||||
|
Subroutine
reports_shared_create: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 815 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 816 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||
| 818 | # Valid params: | ||||||||||||||||||||||||||||||
| 819 | # sharedtype - Str - req! | ||||||||||||||||||||||||||||||
| 820 | # checkid - Int - req! | ||||||||||||||||||||||||||||||
| 821 | # auto - Bool | ||||||||||||||||||||||||||||||
| 822 | # fromyear - Int | ||||||||||||||||||||||||||||||
| 823 | # frommonth - Int | ||||||||||||||||||||||||||||||
| 824 | # fromday - Int | ||||||||||||||||||||||||||||||
| 825 | # toyear - Int | ||||||||||||||||||||||||||||||
| 826 | # tomonth - Int | ||||||||||||||||||||||||||||||
| 827 | # today - Int | ||||||||||||||||||||||||||||||
| 828 | # type - String (uptime, response) | ||||||||||||||||||||||||||||||
| 829 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 830 | 'sharedtype' => 'Str', | ||||||||||||||||||||||||||||||
| 831 | 'checkid' => 'Int', | ||||||||||||||||||||||||||||||
| 832 | 'auto' => 'Bool', | ||||||||||||||||||||||||||||||
| 833 | 'fromyear' => 'Int', | ||||||||||||||||||||||||||||||
| 834 | 'frommonth' => 'Int', | ||||||||||||||||||||||||||||||
| 835 | 'fromday' => 'Int', | ||||||||||||||||||||||||||||||
| 836 | 'toyear' => 'Int', | ||||||||||||||||||||||||||||||
| 837 | 'tomonth' => 'Int', | ||||||||||||||||||||||||||||||
| 838 | 'today' => 'Int', | ||||||||||||||||||||||||||||||
| 839 | 'type' => qr/^(?:uptime|response)$/, | ||||||||||||||||||||||||||||||
| 840 | }; | ||||||||||||||||||||||||||||||
| 841 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 842 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method reports_shared_create'); | |||||||||||||||||||||||||||||
| 843 | 0 | return; | |||||||||||||||||||||||||||||
| 844 | } | ||||||||||||||||||||||||||||||
| 845 | 0 | ▶ | if(!$params->{'sharedtype'} || !$params->{'checkid'}) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$params->{"sharedtype"} and $params->{"checkid"}
MC/DC0%0/2
$params->{"sharedtype"} and $params->{"checkid"}
$params->{"sharedtype"}
$params->{"checkid"}
Truth table0%0/3
A and B
A= $params->{"sharedtype"}B= $params->{"checkid"}
| |||||||||||||||||||||||||||||||
| 846 | 0 | return; # missing req. params | |||||||||||||||||||||||||||||
| 847 | } | ||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||
| 849 | 0 | my $method = 'POST'; | |||||||||||||||||||||||||||||
| 850 | 0 | my $url = 'reports.shared'; | |||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||
| 852 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 853 | |||||||||||||||||||||||||||||||
| 854 | 0 | return $result; | |||||||||||||||||||||||||||||
| 855 | } | ||||||||||||||||||||||||||||||
| 856 | |||||||||||||||||||||||||||||||
| 857 | # Method: Delete Shared Report (Banner) | ||||||||||||||||||||||||||||||
| 858 | # Description: Delete a shared report (banner). | ||||||||||||||||||||||||||||||
| 859 | 0 | ▶ | sub reports_shared_delete { | ||||||||||||||||||||||||||||
|
Subroutine
reports_shared_delete: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 860 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 861 | 0 | my $reportid = shift; | |||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||
| 863 | # Valid params: | ||||||||||||||||||||||||||||||
| 864 | # none | ||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||
| 866 | 0 | my $method = 'DELETE'; | |||||||||||||||||||||||||||||
| 867 | 0 | my $url = 'reports.shared/'.$reportid; | |||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||
| 869 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||
| 871 | 0 | return $result; | |||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||
| 873 | |||||||||||||||||||||||||||||||
| 874 | # Method: Get Raw Check Results | ||||||||||||||||||||||||||||||
| 875 | # Description: Return a list of raw test results for a specified check | ||||||||||||||||||||||||||||||
| 876 | 0 | ▶ | sub results { | ||||||||||||||||||||||||||||
|
Subroutine
results: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 877 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 878 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 879 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||
| 881 | # Valid params: | ||||||||||||||||||||||||||||||
| 882 | # to - Int | ||||||||||||||||||||||||||||||
| 883 | # from - Int | ||||||||||||||||||||||||||||||
| 884 | # probes - Str | ||||||||||||||||||||||||||||||
| 885 | # status - Str | ||||||||||||||||||||||||||||||
| 886 | # limit - Int | ||||||||||||||||||||||||||||||
| 887 | # offset - Int | ||||||||||||||||||||||||||||||
| 888 | # includeanalysis - Bool | ||||||||||||||||||||||||||||||
| 889 | # maxresponse - Int | ||||||||||||||||||||||||||||||
| 890 | # minresponse - Int | ||||||||||||||||||||||||||||||
| 891 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 892 | 'from' => 'Int', | ||||||||||||||||||||||||||||||
| 893 | 'to' => 'Int', | ||||||||||||||||||||||||||||||
| 894 | 'limit' => qr/^[0123]?[0-9]?[0-9]$/, | ||||||||||||||||||||||||||||||
| 895 | 'offset' => 'Int', | ||||||||||||||||||||||||||||||
| 896 | 'probes' => 'Str', | ||||||||||||||||||||||||||||||
| 897 | 'status' => 'Str', | ||||||||||||||||||||||||||||||
| 898 | 'includeanalysis' => 'Bool', | ||||||||||||||||||||||||||||||
| 899 | 'maxresponse' => 'Int', | ||||||||||||||||||||||||||||||
| 900 | 'minresponse' => 'Int', | ||||||||||||||||||||||||||||||
| 901 | }; | ||||||||||||||||||||||||||||||
| 902 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 903 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method results'); | |||||||||||||||||||||||||||||
| 904 | 0 | return; | |||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||
| 907 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 908 | 0 | my $url = 'results/'.$checkid; | |||||||||||||||||||||||||||||
| 909 | |||||||||||||||||||||||||||||||
| 910 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 911 | |||||||||||||||||||||||||||||||
| 912 | 0 | return $result; | |||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||
| 915 | # Method: Get Current Server Time | ||||||||||||||||||||||||||||||
| 916 | # Description: Get the current time of the API server. | ||||||||||||||||||||||||||||||
| 917 | 0 | ▶ | sub servertime { | ||||||||||||||||||||||||||||
|
Subroutine
servertime: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 918 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||
| 920 | # Valid params: | ||||||||||||||||||||||||||||||
| 921 | # none | ||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||
| 923 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 924 | 0 | my $url = 'servertime'; | |||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||
| 926 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||
| 928 | 0 | return $result; | |||||||||||||||||||||||||||||
| 929 | } | ||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||
| 931 | # Method: Get Account Settings | ||||||||||||||||||||||||||||||
| 932 | # Description: Returns all account-specific settings. | ||||||||||||||||||||||||||||||
| 933 | 0 | ▶ | sub settings { | ||||||||||||||||||||||||||||
|
Subroutine
settings: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 934 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 935 | |||||||||||||||||||||||||||||||
| 936 | # Valid params: | ||||||||||||||||||||||||||||||
| 937 | # none | ||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||
| 939 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 940 | 0 | my $url = 'settings'; | |||||||||||||||||||||||||||||
| 941 | |||||||||||||||||||||||||||||||
| 942 | 0 | my $result = $self->_api_call($method,$url,{}); | |||||||||||||||||||||||||||||
| 943 | |||||||||||||||||||||||||||||||
| 944 | 0 | return $result; | |||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||
| 947 | # Method: Modify Account Settings | ||||||||||||||||||||||||||||||
| 948 | # Description: Modify account-specific settings. | ||||||||||||||||||||||||||||||
| 949 | 0 | ▶ | sub settings_modify { | ||||||||||||||||||||||||||||
|
Subroutine
settings_modify: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 950 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 951 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 952 | |||||||||||||||||||||||||||||||
| 953 | # Valid params: | ||||||||||||||||||||||||||||||
| 954 | # firstname - Str | ||||||||||||||||||||||||||||||
| 955 | # lastname - Str | ||||||||||||||||||||||||||||||
| 956 | # company - Str | ||||||||||||||||||||||||||||||
| 957 | # email - Str | ||||||||||||||||||||||||||||||
| 958 | # cellphone - Str | ||||||||||||||||||||||||||||||
| 959 | # cellcountrycode - Int | ||||||||||||||||||||||||||||||
| 960 | # cellcountryiso - Str (iso3166) | ||||||||||||||||||||||||||||||
| 961 | # phone - Str | ||||||||||||||||||||||||||||||
| 962 | # phonecountrycode - Int | ||||||||||||||||||||||||||||||
| 963 | # phonecountryiso - Str (iso3166) | ||||||||||||||||||||||||||||||
| 964 | # address - Str | ||||||||||||||||||||||||||||||
| 965 | # address2 - Str | ||||||||||||||||||||||||||||||
| 966 | # zip - Str | ||||||||||||||||||||||||||||||
| 967 | # location - Str | ||||||||||||||||||||||||||||||
| 968 | # state - Str | ||||||||||||||||||||||||||||||
| 969 | # countryiso - Str (iso3166) | ||||||||||||||||||||||||||||||
| 970 | # vatcode - Str | ||||||||||||||||||||||||||||||
| 971 | # autologout - Bool | ||||||||||||||||||||||||||||||
| 972 | # regionid - Int | ||||||||||||||||||||||||||||||
| 973 | # timezoneid - Int | ||||||||||||||||||||||||||||||
| 974 | # datetimeformatid - Int | ||||||||||||||||||||||||||||||
| 975 | # numberformatid - Int | ||||||||||||||||||||||||||||||
| 976 | # pubrcustomdesign - Bool | ||||||||||||||||||||||||||||||
| 977 | # pubrtextcolor - Str | ||||||||||||||||||||||||||||||
| 978 | # pubrbackgroundcolor - Str | ||||||||||||||||||||||||||||||
| 979 | # pubrlogourl - Str | ||||||||||||||||||||||||||||||
| 980 | # pubrmonths - Str (none, all, 3) | ||||||||||||||||||||||||||||||
| 981 | # pubrshowoverview - Bool | ||||||||||||||||||||||||||||||
| 982 | # pubrcustomdomain - Bool | ||||||||||||||||||||||||||||||
| 983 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 984 | 'firstname' => 'Str', | ||||||||||||||||||||||||||||||
| 985 | 'lastname' => 'Str', | ||||||||||||||||||||||||||||||
| 986 | 'company' => 'Str', | ||||||||||||||||||||||||||||||
| 987 | 'email' => 'Str', | ||||||||||||||||||||||||||||||
| 988 | 'cellphone' => 'Str', | ||||||||||||||||||||||||||||||
| 989 | 'cellcountrycode' => 'Int', | ||||||||||||||||||||||||||||||
| 990 | 'cellcountryiso' => 'Str', | ||||||||||||||||||||||||||||||
| 991 | 'phone' => 'Str', | ||||||||||||||||||||||||||||||
| 992 | 'phonecountrycode' => 'Int', | ||||||||||||||||||||||||||||||
| 993 | 'phonecountryiso' => 'Str', | ||||||||||||||||||||||||||||||
| 994 | 'address' => 'Str', | ||||||||||||||||||||||||||||||
| 995 | 'address2' => 'Str', | ||||||||||||||||||||||||||||||
| 996 | 'zip' => 'Str', | ||||||||||||||||||||||||||||||
| 997 | 'location' => 'Str', | ||||||||||||||||||||||||||||||
| 998 | 'state' => 'Str', | ||||||||||||||||||||||||||||||
| 999 | 'countryiso' => 'Str', | ||||||||||||||||||||||||||||||
| 1000 | 'vatcode' => 'Str', | ||||||||||||||||||||||||||||||
| 1001 | 'autologout' => 'Bool', | ||||||||||||||||||||||||||||||
| 1002 | 'regionid' => 'Int', | ||||||||||||||||||||||||||||||
| 1003 | 'timezoneid' => 'Int', | ||||||||||||||||||||||||||||||
| 1004 | 'datetimeformatid' => 'Int', | ||||||||||||||||||||||||||||||
| 1005 | 'numberformatid' => 'Int', | ||||||||||||||||||||||||||||||
| 1006 | 'pubrcustomdesign' => 'Bool', | ||||||||||||||||||||||||||||||
| 1007 | 'pubrtextcolor' => 'Str', | ||||||||||||||||||||||||||||||
| 1008 | 'pubrbackgroundcolor' => 'Str', | ||||||||||||||||||||||||||||||
| 1009 | 'pubrlogourl' => 'Str', | ||||||||||||||||||||||||||||||
| 1010 | 'pubrmonths' => qr/^(?:none|all|3)$/, | ||||||||||||||||||||||||||||||
| 1011 | 'pubrshowoverview' => 'Bool', | ||||||||||||||||||||||||||||||
| 1012 | 'pubrcustomdomain' => 'Bool', | ||||||||||||||||||||||||||||||
| 1013 | }; | ||||||||||||||||||||||||||||||
| 1014 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 1015 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method settings modify'); | |||||||||||||||||||||||||||||
| 1016 | 0 | return; | |||||||||||||||||||||||||||||
| 1017 | } | ||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||
| 1019 | 0 | my $method = 'PUT'; | |||||||||||||||||||||||||||||
| 1020 | 0 | my $url = 'settings'; | |||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||
| 1022 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||
| 1024 | 0 | return $result; | |||||||||||||||||||||||||||||
| 1025 | } | ||||||||||||||||||||||||||||||
| 1026 | |||||||||||||||||||||||||||||||
| 1027 | # Method: Get A Response Time / Uptime Average | ||||||||||||||||||||||||||||||
| 1028 | # Description: Get a summarized response time / uptime value for a specified check and time period. | ||||||||||||||||||||||||||||||
| 1029 | 0 | ▶ | sub summary_average { | ||||||||||||||||||||||||||||
|
Subroutine
summary_average: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 1030 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 1031 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 1032 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||
| 1034 | # Valid params: | ||||||||||||||||||||||||||||||
| 1035 | # from - Int | ||||||||||||||||||||||||||||||
| 1036 | # to - Int | ||||||||||||||||||||||||||||||
| 1037 | # probes - Str | ||||||||||||||||||||||||||||||
| 1038 | # includeuptime - Bool | ||||||||||||||||||||||||||||||
| 1039 | # bycountry - Bool | ||||||||||||||||||||||||||||||
| 1040 | # byprobe - Bool | ||||||||||||||||||||||||||||||
| 1041 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 1042 | 'from' => 'Int', | ||||||||||||||||||||||||||||||
| 1043 | 'to' => 'Int', | ||||||||||||||||||||||||||||||
| 1044 | 'probes' => 'Str', | ||||||||||||||||||||||||||||||
| 1045 | 'includeuptime' => 'Bool', | ||||||||||||||||||||||||||||||
| 1046 | 'bycountry' => 'Bool', | ||||||||||||||||||||||||||||||
| 1047 | 'byprobe' => 'Bool', | ||||||||||||||||||||||||||||||
| 1048 | }; | ||||||||||||||||||||||||||||||
| 1049 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 1050 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method summary_average'); | |||||||||||||||||||||||||||||
| 1051 | 0 | return; | |||||||||||||||||||||||||||||
| 1052 | } | ||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||
| 1054 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 1055 | 0 | my $url = 'summary.average/'.$checkid; | |||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||
| 1057 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||
| 1059 | 0 | return $result; | |||||||||||||||||||||||||||||
| 1060 | } | ||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||
| 1062 | # Method: Get Response Time Averages For Each Hour Of The Day | ||||||||||||||||||||||||||||||
| 1063 | # Description: Returns the average response time for each hour of the day (0-23) for a specific check over a selected time period. I.e. it shows you what an average day looks like during that time period. | ||||||||||||||||||||||||||||||
| 1064 | 0 | ▶ | sub summary_hoursofday { | ||||||||||||||||||||||||||||
|
Subroutine
summary_hoursofday: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 1065 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 1066 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 1067 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||
| 1069 | # Valid params: | ||||||||||||||||||||||||||||||
| 1070 | # from - Int | ||||||||||||||||||||||||||||||
| 1071 | # to - Int | ||||||||||||||||||||||||||||||
| 1072 | # probes - Str | ||||||||||||||||||||||||||||||
| 1073 | # uselocaltime - Bool | ||||||||||||||||||||||||||||||
| 1074 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 1075 | 'from' => 'Int', | ||||||||||||||||||||||||||||||
| 1076 | 'to' => 'Int', | ||||||||||||||||||||||||||||||
| 1077 | 'probes' => 'Str', | ||||||||||||||||||||||||||||||
| 1078 | 'uselocaltime' => 'Bool', | ||||||||||||||||||||||||||||||
| 1079 | }; | ||||||||||||||||||||||||||||||
| 1080 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 1081 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method summary_hoursofday'); | |||||||||||||||||||||||||||||
| 1082 | 0 | return; | |||||||||||||||||||||||||||||
| 1083 | } | ||||||||||||||||||||||||||||||
| 1084 | |||||||||||||||||||||||||||||||
| 1085 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 1086 | 0 | my $url = 'summary.hoursofday/'.$checkid; | |||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||
| 1088 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 1089 | |||||||||||||||||||||||||||||||
| 1090 | 0 | return $result; | |||||||||||||||||||||||||||||
| 1091 | } | ||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||
| 1093 | # Method: Get Outages List | ||||||||||||||||||||||||||||||
| 1094 | # Description: Get a list of status changes for a specified check and time period. | ||||||||||||||||||||||||||||||
| 1095 | 0 | ▶ | sub summary_outage { | ||||||||||||||||||||||||||||
|
Subroutine
summary_outage: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 1096 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 1097 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 1098 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||
| 1100 | # Valid params: | ||||||||||||||||||||||||||||||
| 1101 | # from - Int | ||||||||||||||||||||||||||||||
| 1102 | # to - Int | ||||||||||||||||||||||||||||||
| 1103 | # order - Str (asc, desc) | ||||||||||||||||||||||||||||||
| 1104 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 1105 | 'from' => 'Int', | ||||||||||||||||||||||||||||||
| 1106 | 'to' => 'Int', | ||||||||||||||||||||||||||||||
| 1107 | 'order' => 'Order', | ||||||||||||||||||||||||||||||
| 1108 | }; | ||||||||||||||||||||||||||||||
| 1109 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 1110 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method summary_outage'); | |||||||||||||||||||||||||||||
| 1111 | 0 | return; | |||||||||||||||||||||||||||||
| 1112 | } | ||||||||||||||||||||||||||||||
| 1113 | |||||||||||||||||||||||||||||||
| 1114 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 1115 | 0 | my $url = 'summary.outage/'.$checkid; | |||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||
| 1117 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||
| 1119 | 0 | return $result; | |||||||||||||||||||||||||||||
| 1120 | } | ||||||||||||||||||||||||||||||
| 1121 | |||||||||||||||||||||||||||||||
| 1122 | # Method: Get Intervals Of Average Response Time And Uptime | ||||||||||||||||||||||||||||||
| 1123 | # Description: Get the average response time and uptime for a list of intervals. Useful for generating graphs. | ||||||||||||||||||||||||||||||
| 1124 | 0 | ▶ | sub summary_performance { | ||||||||||||||||||||||||||||
|
Subroutine
summary_performance: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 1125 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 1126 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 1127 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 1128 | |||||||||||||||||||||||||||||||
| 1129 | # Valid params: | ||||||||||||||||||||||||||||||
| 1130 | # from - Int | ||||||||||||||||||||||||||||||
| 1131 | # to - Int | ||||||||||||||||||||||||||||||
| 1132 | # resolution - Str (hour, day, week) | ||||||||||||||||||||||||||||||
| 1133 | # includeuptime - Bool | ||||||||||||||||||||||||||||||
| 1134 | # probes - Str | ||||||||||||||||||||||||||||||
| 1135 | # order - Str (asc, desc) | ||||||||||||||||||||||||||||||
| 1136 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 1137 | 'from' => 'Int', | ||||||||||||||||||||||||||||||
| 1138 | 'to' => 'Int', | ||||||||||||||||||||||||||||||
| 1139 | 'resolution' => qr/^(?:hour|day|week)$/i, | ||||||||||||||||||||||||||||||
| 1140 | 'includeuptime' => 'Bool', | ||||||||||||||||||||||||||||||
| 1141 | 'probes' => 'Str', | ||||||||||||||||||||||||||||||
| 1142 | 'order' => 'Order', | ||||||||||||||||||||||||||||||
| 1143 | }; | ||||||||||||||||||||||||||||||
| 1144 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 1145 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method summary_performance'); | |||||||||||||||||||||||||||||
| 1146 | 0 | return; | |||||||||||||||||||||||||||||
| 1147 | } | ||||||||||||||||||||||||||||||
| 1148 | |||||||||||||||||||||||||||||||
| 1149 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 1150 | 0 | my $url = 'summary.performance/'.$checkid; | |||||||||||||||||||||||||||||
| 1151 | |||||||||||||||||||||||||||||||
| 1152 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 1153 | |||||||||||||||||||||||||||||||
| 1154 | 0 | return $result; | |||||||||||||||||||||||||||||
| 1155 | } | ||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||
| 1157 | # Method: Get Active Probes For A Period | ||||||||||||||||||||||||||||||
| 1158 | # Description: Get a list of probes that performed tests for a specified check during a specified period. | ||||||||||||||||||||||||||||||
| 1159 | 0 | ▶ | sub summary_probes { | ||||||||||||||||||||||||||||
|
Subroutine
summary_probes: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 1160 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 1161 | 0 | my $checkid = shift; | |||||||||||||||||||||||||||||
| 1162 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||||
| 1164 | # Valid params: | ||||||||||||||||||||||||||||||
| 1165 | # from - Int - req! | ||||||||||||||||||||||||||||||
| 1166 | # to - Int | ||||||||||||||||||||||||||||||
| 1167 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 1168 | 'from' => 'Int', | ||||||||||||||||||||||||||||||
| 1169 | 'to' => 'Int', | ||||||||||||||||||||||||||||||
| 1170 | }; | ||||||||||||||||||||||||||||||
| 1171 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 1172 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method summary_probes'); | |||||||||||||||||||||||||||||
| 1173 | 0 | return; | |||||||||||||||||||||||||||||
| 1174 | } | ||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||
| 1176 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 1177 | 0 | my $url = 'summary.probes/'.$checkid; | |||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||
| 1179 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||||
| 1181 | 0 | return $result; | |||||||||||||||||||||||||||||
| 1182 | } | ||||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||||
| 1184 | # Method: Make A Single Test | ||||||||||||||||||||||||||||||
| 1185 | # Description: Performs a single test using a specified Pingdom probe against a specified target. Please note that this method is meant to be used sparingly, not to set up your own monitoring solution. | ||||||||||||||||||||||||||||||
| 1186 | 0 | ▶ | sub single { | ||||||||||||||||||||||||||||
|
Subroutine
single: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 1187 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 1188 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||
| 1190 | # Valid params: | ||||||||||||||||||||||||||||||
| 1191 | # host - Str - req! | ||||||||||||||||||||||||||||||
| 1192 | # type - Str (http, httpcustom, tcp, ping, dns, udp, smtp, pop3, imap) - req! | ||||||||||||||||||||||||||||||
| 1193 | # probeid - Int | ||||||||||||||||||||||||||||||
| 1194 | # TODO handle requestheader X ... | ||||||||||||||||||||||||||||||
| 1195 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 1196 | 'host' => 'Str', | ||||||||||||||||||||||||||||||
| 1197 | 'type' => 'Checktype', | ||||||||||||||||||||||||||||||
| 1198 | 'probeid' => 'Int', | ||||||||||||||||||||||||||||||
| 1199 | 'url' => 'Str', | ||||||||||||||||||||||||||||||
| 1200 | 'encryption' => 'Bool', | ||||||||||||||||||||||||||||||
| 1201 | 'port' => 'Int', | ||||||||||||||||||||||||||||||
| 1202 | 'auth' => 'Str', | ||||||||||||||||||||||||||||||
| 1203 | 'shouldcontain' => 'Str', | ||||||||||||||||||||||||||||||
| 1204 | 'shouldnotcontain' => 'Str', | ||||||||||||||||||||||||||||||
| 1205 | 'postdata' => 'Str', | ||||||||||||||||||||||||||||||
| 1206 | 'additionalurls' => 'Str', | ||||||||||||||||||||||||||||||
| 1207 | 'stringtosend' => 'Str', | ||||||||||||||||||||||||||||||
| 1208 | 'stringtoexpect' => 'Str', | ||||||||||||||||||||||||||||||
| 1209 | 'expectedip' => 'Str', | ||||||||||||||||||||||||||||||
| 1210 | 'nameserver' => 'Str', | ||||||||||||||||||||||||||||||
| 1211 | }; | ||||||||||||||||||||||||||||||
| 1212 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 1213 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method single'); | |||||||||||||||||||||||||||||
| 1214 | 0 | return; | |||||||||||||||||||||||||||||
| 1215 | } | ||||||||||||||||||||||||||||||
| 1216 | 0 | ▶ | if(!$params->{'host'} || !$params->{'type'}) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$params->{"host"} and $params->{"type"}
MC/DC0%0/2
$params->{"host"} and $params->{"type"}
$params->{"host"}
$params->{"type"}
Truth table0%0/3
A and B
A= $params->{"host"}B= $params->{"type"}
| |||||||||||||||||||||||||||||||
| 1217 | 0 | return; # missing req. arg host | |||||||||||||||||||||||||||||
| 1218 | } | ||||||||||||||||||||||||||||||
| 1219 | |||||||||||||||||||||||||||||||
| 1220 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 1221 | 0 | my $url = 'single'; | |||||||||||||||||||||||||||||
| 1222 | |||||||||||||||||||||||||||||||
| 1223 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 1224 | |||||||||||||||||||||||||||||||
| 1225 | 0 | return $result; | |||||||||||||||||||||||||||||
| 1226 | } | ||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||
| 1228 | # Method: Make A Traceroute | ||||||||||||||||||||||||||||||
| 1229 | # Description: Perform a traceroute to a specified target from a specified Pingdom probe. | ||||||||||||||||||||||||||||||
| 1230 | 0 | ▶ | sub traceroute { | ||||||||||||||||||||||||||||
|
Subroutine
traceroute: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||
| 1231 | 0 | my $self = shift; | |||||||||||||||||||||||||||||
| 1232 | 0 | my $params = shift; | |||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||
| 1234 | # Valid params: | ||||||||||||||||||||||||||||||
| 1235 | # host - Str - req! | ||||||||||||||||||||||||||||||
| 1236 | # probeid - Int | ||||||||||||||||||||||||||||||
| 1237 | 0 | my $ref = { | |||||||||||||||||||||||||||||
| 1238 | 'host' => 'Str', | ||||||||||||||||||||||||||||||
| 1239 | 'probeid' => 'Int', | ||||||||||||||||||||||||||||||
| 1240 | }; | ||||||||||||||||||||||||||||||
| 1241 | 0 | ▶ | if(!$self->_validate_params($ref,$params)) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 1242 | 0 | $self->_set_lasterror(902,'Validate','Failed to validate params for method traceroute'); | |||||||||||||||||||||||||||||
| 1243 | 0 | return; | |||||||||||||||||||||||||||||
| 1244 | } | ||||||||||||||||||||||||||||||
| 1245 | 0 | ▶ | if(!$params->{'host'}) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 1246 | 0 | return; | |||||||||||||||||||||||||||||
| 1247 | } | ||||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||||
| 1249 | 0 | my $method = 'GET'; | |||||||||||||||||||||||||||||
| 1250 | 0 | my $url = 'traceroute'; | |||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||
| 1252 | 0 | my $result = $self->_api_call($method,$url,$params); | |||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||
| 1254 | 0 | return $result; | |||||||||||||||||||||||||||||
| 1255 | } | ||||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||||
| 1257 | 3 | ▶ | no Moose; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 1258 | 3 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||
| 1260 | 3 | 1; | |||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||
| 1262 | __END__ | ||||||||||||||||||||||||||||||