V1_1/Request/PUT_JSON.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 100% 40 / 40 CC 3 SCAR 5.1
CC
3
Cov
100%
create_request
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« V1_1/Request/POST_JSON.pm ↑ Summary
1 package WebService::DS::SOP::Auth::V1_1::Request::PUT_JSON;
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use JSON::XS qw(encode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 ▶use HTTP::Request::Common qw(PUT);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 3 ▶use WebService::DS::SOP::Auth::V1_1::Util qw(create_signature);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 ▶sub create_request {
Subroutine create_request: called CC=3 SCAR=11.0
Pod documented
10 4 my ($class, $uri, $params, $app_secret) = @_;
11  
12 4 ▶ Carp::croak('Missing required parameter: time') if not $params->{time};
Branch: 1 branch
BranchTrueFalseTotal
unless $params->{"time"} 1 3 4
13 3 ▶ Carp::croak('Missing app_secret') if not $app_secret;
Branch: 1 branch
BranchTrueFalseTotal
unless $app_secret 1 2 3
14  
15 2 my $content = encode_json($params);
16 2 my $sig = create_signature($content, $app_secret);
17  
18 2 my $req = PUT $uri, Content => $content;
19 2 $req->headers->header('content-type' => 'application/json');
20 2 $req->headers->header('x-sop-sig' => $sig);
21 2 $req;
22 }
23  
24 3 1;
25  
26 __END__
« V1_1/Request/POST_JSON.pm ↑ Summary