File Coverage

blib/lib/WebService/SOP/Auth/V1_1/Request/POST.pm
Criterion Covered Total %
statement 19 19 100.0
branch 4 4 100.0
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 30 30 100.0


line stmt bran cond sub pod time code
1             package WebService::SOP::Auth::V1_1::Request::POST;
2 3     3   44633 use strict;
  3         6  
  3         85  
3 3     3   11 use warnings;
  3         3  
  3         60  
4 3     3   212 use Carp ();
  3         5  
  3         48  
5 3     3   622 use HTTP::Request::Common qw(POST);
  3         13871  
  3         156  
6 3     3   411 use WebService::SOP::Auth::V1_1::Util qw(create_signature);
  3         5  
  3         336  
7              
8             sub create_request {
9 5     5 1 8841 my ($class, $uri, $params, $app_secret) = @_;
10              
11 5 100       42 Carp::croak('Missing required parameter: time') if not $params->{time};
12 3 100       14 Carp::croak('Missing app_secret') if not $app_secret;
13              
14 2         12 POST $uri => {
15             %$params,
16             sig => create_signature($params, $app_secret),
17             };
18             }
19              
20             1;
21              
22             __END__
23              
24             =encoding utf-8
25              
26             =head1 NAME
27              
28             WebService::SOP::Auth::V1_1::Request::POST
29              
30             =head1 DESCRIPTION
31              
32             To create a valid L<HTTP::Request> object for given C<POST> request parameters.
33              
34             =head1 METHODS
35              
36             =head2 $class->create_request( $uri, $params, $app_secret )
37              
38             Returns L<HTTP::Request> object for a POST request.
39             Request parameters including signature are gathered as POST parameters.
40              
41             =head1 SEE ALSO
42              
43             L<HTTP::Request>
44             L<WebService::SOP::Auth::V1_1>
45              
46             =head1 LICENSE
47              
48             Copyright (C) Research Panel Asia, Inc.
49              
50             This library is free software; you can redistribute it and/or modify
51             it under the same terms as Perl itself.
52              
53             =head1 AUTHOR
54              
55             yowcowvg E<lt>yoko_ohyama [ at ] voyagegroup.comE<gt>
56              
57             =cut
58