File Coverage

blib/lib/Google/Ads/GoogleAds/Common/OAuthApplicationsHandlerInterface.pm
Criterion Covered Total %
statement 9 13 69.2
branch n/a
condition n/a
subroutine 3 5 60.0
pod 2 2 100.0
total 14 20 70.0


line stmt bran cond sub pod time code
1             # Copyright 2019, 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              
16             use strict;
17 11     11   105 use warnings;
  11         22  
  11         296  
18 11     11   77 use base qw(Google::Ads::GoogleAds::Common::AuthHandlerInterface);
  11         45  
  11         279  
19 11     11   51  
  11         39  
  11         1560  
20             # Method to retrieve an authorization URL for the user to put into a browser and
21             # request for an authorization code.
22             # Meant to be implemented by a concrete class, which should issue an
23             # authorization code and return a valid URL for the user to authorize.
24             # A callback URL can be passed optionally to redirect the user after the code is
25             # authorized.
26             my ($self, $callback) = @_;
27             die "Needs to be implemented by subclass";
28 0     0 1   }
29 0            
30             # Method to issue an access token with an authorization code. After calling
31             # this method the auth handler should be ready to prepare the HTTP requests
32             # against protected API resources.
33             my ($self, $auth_code) = @_;
34             die "Needs to be implemented by subclass";
35             }
36 0     0 1    
37 0           1;
38              
39             =pod
40              
41             =head1 NAME
42              
43             Google::Ads::GoogleAds::Common::OAuthApplicationsHandlerInterface
44              
45             =head1 DESCRIPTION
46              
47             Abstract interface for OAuth application flows that require user interaction.
48              
49             Meant to be implemented by concrete OAuth handlers that require user intervention
50             for authorizing requests against the API.
51              
52             =head1 METHODS
53              
54             =head2 get_authorization_url
55              
56             Meant to be implemented by a concrete class, which should return a valid URL for
57             the user to authorize the access to the API.
58              
59             =head3 Returns
60              
61             The URL for the user to authorize for an authorization code. The user must login
62             to the account that he wants to grant access to.
63              
64             =head2 issue_access_token
65              
66             Method to obtain/update an access token.
67              
68             =head3 Parameters
69              
70             =over
71              
72             =item *
73              
74             The authorization code returned to your callback URL or printed out if using 'oob'
75             special callback URL.
76              
77             =back
78              
79             =head1 LICENSE AND COPYRIGHT
80              
81             Copyright 2019 Google LLC
82              
83             Licensed under the Apache License, Version 2.0 (the "License");
84             you may not use this file except in compliance with the License.
85             You may obtain a copy of the License at
86              
87             http://www.apache.org/licenses/LICENSE-2.0
88              
89             Unless required by applicable law or agreed to in writing, software
90             distributed under the License is distributed on an "AS IS" BASIS,
91             WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
92             See the License for the specific language governing permissions and
93             limitations under the License.
94              
95             =head1 REPOSITORY INFORMATION
96              
97             $Rev: $
98             $LastChangedBy: $
99             $Id: $
100              
101             =cut