OAuth/AccessToken.pm untested

filter: Statementstmt 0.0% 0 / 23 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 38 CC 1 SCAR 6.9
CC
1
Cov
0%
new
2.0
request
2.0
get
2.0
CRAP 2.0
1 package Net::OAuth::AccessToken;
2 use warnings;
3 use strict;
4 use base qw(Class::Accessor::Fast);
5 __PACKAGE__->mk_accessors(qw/client token token_secret session_handle expires_in authorization_expires_in/);
6  
7 sub new {
8 my $class = shift;
9 my %opts = @_;
10 my $self = bless \%opts, $class;
11 return $self;
12 }
13  
14 sub request {
15 my $self = shift;
16 my ($method, $uri, $header, $content, %params) = @_;
17 my $oauth_req = $self->client->_make_request(
18 'protected resource',
19 request_method => $method,
20 request_url => $self->client->site_url($uri),
21 token => $self->token,
22 token_secret => $self->token_secret,
23 %params,
24 );
25 $oauth_req->sign;
26  
27 return $self->client->request(HTTP::Request->new(
28 $method => $oauth_req->to_url, $header, $content
29 ));
30 }
31  
32 sub get {
33 return shift->request('GET', @_);
34 }
35  
36 sub post {
37 return shift->request('POST', @_);
38 }
39  
40 sub delete {
41 return shift->request('DELETE', @_);
42 }
43  
44 sub put {
45 return shift->request('PUT', @_);
46 }
47  
48 =head1 NAME
49  
50 Net::OAuth::AccessToken - OAuth Access Token
51  
52 =head1 DESCRIPTION
53  
54 WARNING: Net::OAuth::AccessToken is alpha code. The rest of Net::OAuth is quite
55 stable but this particular module is new, and is under-documented and under-tested.
56  
57 =head1 SEE ALSO
58  
59 L<Net::OAuth>
60  
61 =head1 AUTHOR
62  
63 Originally by Keith Grennan <kgrennan@cpan.org>
64  
65 Currently maintained by Robert Rothenberg <rrwo@cpan.org>
66  
67 =head1 LICENSE AND COPYRIGHT
68  
69 Copyright 2007-2012, 2024-2025 Keith Grennan
70  
71 This program is free software; you can redistribute it and/or modify it
72 under the terms of either: the GNU General Public License as published
73 by the Free Software Foundation; or the Artistic License.
74  
75 See http://dev.perl.org/licenses/ for more information.
76  
77 =cut
78  
79  
80 1;