OAuth/Request.pm

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