OAuth/Request.pm

filter: Statementstmt 100% 48 / 48 Branchbran 50.0% 2 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 2 totaltotal 93.5% 58 / 62 CC 3 SCAR 4.8
CC
3
Cov
96%
signature_key
3.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.6
« OAuth/V1_0A/UserAuthResponse.pm ↑ Summary OAuth/ConsumerRequest.pm »
1 package Net::OAuth::Request;
2 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use base qw/Net::OAuth::Message/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 10 ▶use URI::QueryParam;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 10 ▶use Net::OAuth;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 our $VERSION = '0.31';
10  
11 10 __PACKAGE__->mk_classdata(required_message_params => [qw/
12 consumer_key
13 signature_method
14 timestamp
15 nonce
16 /]);
17  
18 10 __PACKAGE__->mk_classdata(optional_message_params => [qw/
19 version
20 signature
21 /]);
22  
23 10 __PACKAGE__->mk_classdata(required_api_params => [qw/
24 request_method
25 request_url
26 consumer_secret
27 /]);
28  
29 10 __PACKAGE__->mk_classdata(optional_api_params => [qw/
30 signature_key
31 token_secret
32 extra_params
33 protocol_version
34 /]);
35  
36 10 __PACKAGE__->mk_classdata(signature_elements => [qw/
37 request_method
38 normalized_request_url
39 normalized_message_parameters
40 /]);
41  
42 __PACKAGE__->mk_classdata(all_message_params => [
43 10 @{__PACKAGE__->required_message_params},
44 10 @{__PACKAGE__->optional_message_params},
45 ]);
46  
47 __PACKAGE__->mk_classdata(all_api_params => [
48 10 @{__PACKAGE__->required_api_params},
49 10 @{__PACKAGE__->optional_api_params},
50 ]);
51  
52 __PACKAGE__->mk_classdata(all_params => [
53 10 @{__PACKAGE__->all_api_params},
54 10 @{__PACKAGE__->all_message_params},
55 ]);
56  
57 __PACKAGE__->mk_accessors(
58 10 @{__PACKAGE__->all_params},
59 );
60  
61 sub signature_key {
62 36 ▶ my $self = shift;
Subroutine signature_key: called CC=3 SCAR=11.2
Pod undocumented
63 # For some sig methods (I.e. RSA), users will pass in their own key
64 36 my $key = $self->get('signature_key');
65 36 ▶ unless (defined $key) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $key) 36 0 36
66 36 $key = Net::OAuth::Message::encode($self->consumer_secret) . '&';
67 36 ▶ $key .= Net::OAuth::Message::encode($self->token_secret) if $self->can('token_secret');
Branch: 1 branch
BranchTrueFalseTotal
if $self->can("token_secret") 36 0 36
68 }
69 36 return $key;
70 }
71  
72 sub normalized_request_url {
73 32 ▶ my $self = shift;
Subroutine normalized_request_url: called CC=1 SCAR=0.0
Pod undocumented
74 32 my $url = $self->request_url;
75 32 Net::OAuth::Message::_ensure_uri_object($url);
76 32 $url = $url->clone;
77 32 $url->query(undef);
78 32 return $url;
79 }
80  
81  
82 =head1 NAME
83  
84 Net::OAuth::Request - base class for OAuth requests
85  
86 =head1 SEE ALSO
87  
88 L<Net::OAuth>, L<http://oauth.net>
89  
90 =head1 AUTHOR
91  
92 Originally by Keith Grennan <kgrennan@cpan.org>
93  
94 Currently maintained by Robert Rothenberg <rrwo@cpan.org>
95  
96 =head1 COPYRIGHT & LICENSE
97  
98 Copyright 2007-2012, 2024-2025 Keith Grennan
99  
100 This program is free software; you can redistribute it and/or modify it
101 under the same terms as Perl itself.
102  
103 =cut
104  
105 10 1;
« OAuth/V1_0A/UserAuthResponse.pm ↑ Summary OAuth/ConsumerRequest.pm »