File Coverage

blib/lib/WebService/DS/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::DS::SOP::Auth::V1_1::Request::POST;
2 3     3   78300 use strict;
  3         19  
  3         84  
3 3     3   15 use warnings;
  3         6  
  3         65  
4 3     3   13 use Carp ();
  3         7  
  3         64  
5 3     3   483 use HTTP::Request::Common qw(POST);
  3         19505  
  3         153  
6 3     3   442 use WebService::DS::SOP::Auth::V1_1::Util qw(create_signature);
  3         8  
  3         431  
7              
8             sub create_request {
9 5     5 1 13539 my ($class, $uri, $params, $app_secret) = @_;
10              
11 5 100       47 Carp::croak('Missing required parameter: time') if not $params->{time};
12 3 100       22 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::DS::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::DS::SOP::Auth::V1_1>
45              
46             =head1 LICENSE
47              
48             Copyright (C) dataSpring, Inc.
49             Copyright (C) Research Panel Asia, Inc.
50              
51             This library is free software; you can redistribute it and/or modify
52             it under the same terms as Perl itself.
53              
54             =head1 AUTHOR
55              
56             yowcow E<lt>yoko.oyama [ at ] d8aspring.comE<gt>
57              
58             =cut
59