Common/OAuthApplicationsHandlerInterface.pm

filter: Statementstmt 71.4% 10 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 3 / 5 Podpod 100% 2 / 2 totaltotal 71.4% 15 / 21 CC 1 SCAR 3.4
CC
1
Cov
71%
get_authorization_url
2.0
issue_access_token
2.0
BEGIN
1.0
CRAP 1.4
« V26/Services/ReservationService.pm ↑ Summary V26/Services/GoogleAdsService.pm »
1 # Copyright 2022, Google LLC
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14  
15 package Google::Ads::GoogleAds::Common::OAuthApplicationsHandlerInterface;
16  
17 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 11 ▶use base qw(Google::Ads::GoogleAds::Common::AuthHandlerInterface);
Subroutine BEGIN: called CC=1 SCAR=0.0
20  
21 # Method to retrieve an authorization URL for the user to put into a browser and
22 # request for an authorization code.
23 # Meant to be implemented by a concrete class, which should issue an
24 # authorization code and return a valid URL for the user to authorize.
25 # A callback URL can be passed optionally to redirect the user after the code is
26 # authorized.
27 0 ▶sub get_authorization_url {
Subroutine get_authorization_url: not called CC=1 SCAR=6.9
Pod documented
28 0 my ($self, $callback) = @_;
29 0 die "Needs to be implemented by subclass";
30 }
31  
32 # Method to issue an access token with an authorization code. After calling
33 # this method the auth handler should be ready to prepare the HTTP requests
34 # against protected API resources.
35 0 ▶sub issue_access_token {
Subroutine issue_access_token: not called CC=1 SCAR=6.9
Pod documented
36 0 my ($self, $auth_code) = @_;
37 0 die "Needs to be implemented by subclass";
38 }
39  
40 11 1;
41  
42 =pod
43  
44 =head1 NAME
45  
46 Google::Ads::GoogleAds::Common::OAuthApplicationsHandlerInterface
47  
48 =head1 DESCRIPTION
49  
50 Abstract interface for OAuth application flows that require user interaction.
51  
52 Meant to be implemented by concrete OAuth handlers that require user intervention
53 for authorizing requests against the API.
54  
55 =head1 METHODS
56  
57 =head2 get_authorization_url
58  
59 Meant to be implemented by a concrete class, which should return a valid URL for
60 the user to authorize the access to the API.
61  
62 =head3 Returns
63  
64 The URL for the user to authorize for an authorization code. The user must login
65 to the account that he wants to grant access to.
66  
67 =head2 issue_access_token
68  
69 Method to obtain/update an access token.
70  
71 =head3 Parameters
72  
73 =over
74  
75 =item *
76  
77 The authorization code returned to your callback URL.
78  
79 =back
80  
81 =head1 LICENSE AND COPYRIGHT
82  
83 Copyright 2022 Google LLC
84  
85 Licensed under the Apache License, Version 2.0 (the "License");
86 you may not use this file except in compliance with the License.
87 You may obtain a copy of the License at
88  
89 http://www.apache.org/licenses/LICENSE-2.0
90  
91 Unless required by applicable law or agreed to in writing, software
92 distributed under the License is distributed on an "AS IS" BASIS,
93 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
94 See the License for the specific language governing permissions and
95 limitations under the License.
96  
97 =head1 REPOSITORY INFORMATION
98  
99 $Rev: $
100 $LastChangedBy: $
101 $Id: $
102  
103 =cut
« V26/Services/ReservationService.pm ↑ Summary V26/Services/GoogleAdsService.pm »