File Coverage

blib/lib/Paws/Net/SigninCaller.pm
Criterion Covered Total %
statement 9 28 32.1
branch 0 6 0.0
condition n/a
subroutine 3 5 60.0
pod 0 1 0.0
total 12 40 30.0


line stmt bran cond sub pod time code
1             package Paws::Net::SigninCaller;
2 4     4   1960 use Moose::Role;
  4         8  
  4         25  
3 4     4   17315 use JSON::MaybeXS;
  4         10  
  4         278  
4 4     4   27 use URI::Template;
  4         11  
  4         1173  
5              
6             sub _call_uri {
7 0     0     my ($self, $call, $qparams) = @_;
8 0           my $uri_template = $call->meta->name->_api_uri;
9 0           my $t = URI::Template->new( $uri_template );
10              
11 0           my $uri = $t->process({});
12 0           $uri->query_form(%$qparams);
13 0           return $uri->as_string;
14             }
15              
16             sub prepare_request_for_call {
17 0     0 0   my ($self, $call) = @_;
18              
19 0           my $request = Paws::Net::APIRequest->new();
20              
21 0           $request->method('GET');
22            
23 0           my $qparams;
24 0 0         if ($call->_api_call eq 'getSigninToken') {
    0          
25             #Until we have a way to declare objects that get json-encoded to API calls, we
26             #will have to "hand-encode" the Session Parameter
27 0 0         $qparams = { Action => $call->_api_call,
28             SessionType => 'json',
29             (defined $call->SessionDuration)?(SessionDuration => $call->SessionDuration):(),
30             Session => encode_json({
31             sessionId => $call->SessionId,
32             sessionKey => $call->SessionKey,
33             sessionToken => $call->SessionToken
34             }),
35             };
36             } elsif ($call->_api_call eq 'login') {
37 0           $qparams = { Action => $call->_api_call,
38             Destination => $call->Destination,
39             Issuer => $call->Issuer,
40             SigninToken => $call->SigninToken
41             };
42             } else {
43 0           die "Don't know how to call " . $call->_api_call;
44             }
45              
46 0           my $uri = $self->_call_uri($call, $qparams);
47 0           $request->url($self->_api_endpoint . $uri);
48 0           $request->uri($uri);
49              
50 0           $self->sign($request);
51              
52 0           return $request;
53             }
54             1;