OAuth/Lite2/ParamMethod.pm

filter: Statementstmt 57.1% 8 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 100% 4 / 4 totaltotal 62.5% 15 / 24 CC 1 SCAR 4.1
CC
1
Cov
57%
match
2.0
parse
2.0
build_request
2.0
CRAP 1.5
« OAuth/Lite2/Client/Error.pm ↑ Summary OAuth/Lite2/ParamMethods.pm »
1 package OAuth::Lite2::ParamMethod;
2  
3 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 147 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod documented
7 147 bless {}, $_[0];
8 }
9  
10 0 ▶sub match {
Subroutine match: not called CC=1 SCAR=6.9
Pod documented
11 0 my ($self, $req) = @_;
12 0 die "abstract method";
13 }
14  
15 0 ▶sub parse {
Subroutine parse: not called CC=1 SCAR=6.9
Pod documented
16 0 my ($self, $req) = @_;
17 0 die "abstract method";
18 }
19  
20 0 ▶sub build_request {
Subroutine build_request: not called CC=1 SCAR=6.9
Pod documented
21 0 my ($self, %params) = @_;
22 0 die "abstract method";
23 }
24  
25 =head1 NAME
26  
27 OAuth::Lite2::ParamMethod - base class of builder/parser for OAuth 2.0 parameters
28  
29 =head1 SYNOPSIS
30  
31 my $meth = OAuth::Lite2::ParamMethod::Foo->new;
32
33 # server side
34 if ($meth->match( $plack_request )) {
35 my ($token, $params) = $meth->parse( $plack_request );
36 }
37  
38 # client side
39 my $http_req = $meth->request_builder(...);
40  
41 =head1 DESCRIPTION
42  
43 base class of builder/parser for OAuth 2.0 parameters
44  
45 =head1 METHODS
46  
47 =head2 new
48  
49 Constructor
50  
51 =head2 match( $plack_request )
52  
53 Returns true if passed L<Plack::Request> object is matched for the type of this method.
54  
55 if ( $meth->match( $plack_request ) ) {
56 ...
57 }
58  
59 =head2 parse( $plack_request )
60  
61 Parse the L<Plack::Request>, and returns access token and oauth parameters.
62  
63 my ($token, $params) = $meth->parse( $plack_request );
64  
65 =head2 build_request( %params )
66  
67 Build L<HTTP::Request> object.
68  
69 my $req = $meth->build_request(
70 url => $url,
71 method => $http_method,
72 token => $access_token,
73 oauth_params => $oauth_params,
74 params => $params,
75 content => $content,
76 headers => $headers,
77 );
78  
79 =head1 SEE ALSO
80  
81 L<OAuth::Lite2::ParamMethods>
82 L<OAuth::Lite2::ParamMethod::AuthHeader>
83 L<OAuth::Lite2::ParamMethod::FormEncodedBody>
84 L<OAuth::Lite2::ParamMethod::URIQueryParameter>
85  
86 =head1 AUTHOR
87  
88 Lyo Kato, E<lt>lyo.kato@gmail.comE<gt>
89  
90 =head1 COPYRIGHT AND LICENSE
91  
92 Copyright (C) 2010 by Lyo Kato
93  
94 This library is free software; you can redistribute it and/or modify
95 it under the same terms as Perl itself, either Perl version 5.8.8 or,
96 at your option, any later version of Perl 5 you may have available.
97  
98 =cut
99  
100 16 1;
101  
« OAuth/Lite2/Client/Error.pm ↑ Summary OAuth/Lite2/ParamMethods.pm »