« blib/lib/Google/Ads/Common/MapUtils.pm
↑ Summary
blib/lib/Google/Ads/Common/ReportDownloadError.pm »
| 1 | # Copyright 2013, Google Inc. All Rights Reserved. | ||
| 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::Common::OAuthApplicationsHandlerInterface; | ||
| 16 | |||
| 17 | use base qw(Google::Ads::Common::AuthHandlerInterface); | ||
| 18 | |||
| 19 | # Method to retrieve an authorization URL for the user to put in a | ||
| 20 | # browser and authorize a request token. | ||
| 21 | # Meant to be implemented by a concrete class, which should issue a request | ||
| 22 | # token and return a valid URL for the user to authorize the token. | ||
| 23 | # The implementor must save the request token in the token attribute for later | ||
| 24 | # use by the upgrade_token method. | ||
| 25 | # A callback URL can be passed to re-direct the user after the token is | ||
| 26 | # authorized. | ||
| 27 | sub get_authorization_url { | ||
| 28 | my ($self, $callback) = @_; | ||
| 29 | die "Needs to be implemented by subclass"; | ||
| 30 | } | ||
| 31 | |||
| 32 | # Method to issue an access token given an authorization code. After calling | ||
| 33 | # this method the auth handler should be prepared to prepare HTTP requests | ||
| 34 | # against protected resources. | ||
| 35 | sub issue_access_token { | ||
| 36 | my ($self, $auth_code) = @_; | ||
| 37 | die "Needs to be implemented by subclass"; | ||
| 38 | } | ||
| 39 | |||
| 40 | 1; | ||
| 41 | |||
| 42 | =pod | ||
| 43 | |||
| 44 | =head1 NAME | ||
| 45 | |||
| 46 | Google::Ads::Common::OAuthApplicationsHandlerInterface | ||
| 47 | |||
| 48 | =head1 DESCRIPTION | ||
| 49 | |||
| 50 | Abstract interface for oauth flows that require user interaction. | ||
| 51 | |||
| 52 | Meant 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 | ||
| 60 | for the user to authorize the access to the API. | ||
| 61 | |||
| 62 | =head3 Returns | ||
| 63 | |||
| 64 | The URL for the user to authorize access to his account. The user first must | ||
| 65 | login in the account that want to grant access to. | ||
| 66 | |||
| 67 | =head2 issue_access_token | ||
| 68 | |||
| 69 | Method to upgrade/obtain an authorized access token. | ||
| 70 | |||
| 71 | =head3 Parameters | ||
| 72 | |||
| 73 | =over | ||
| 74 | |||
| 75 | =item * | ||
| 76 | |||
| 77 | The verifier code returned to your callback page or printed out if using 'oob' | ||
| 78 | special callback URL. | ||
| 79 | |||
| 80 | =back | ||
| 81 | |||
| 82 | =head1 LICENSE AND COPYRIGHT | ||
| 83 | |||
| 84 | Copyright 2013 Google Inc. | ||
| 85 | |||
| 86 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 87 | you may not use this file except in compliance with the License. | ||
| 88 | You may obtain a copy of the License at | ||
| 89 | |||
| 90 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 91 | |||
| 92 | Unless required by applicable law or agreed to in writing, software | ||
| 93 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 94 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 95 | See the License for the specific language governing permissions and | ||
| 96 | limitations under the License. | ||
| 97 | |||
| 98 | =head1 AUTHOR | ||
| 99 | |||
| 100 | David Torres E<lt>david.t at google.comE<gt> | ||
| 101 | |||
| 102 | =head1 REPOSITORY INFORMATION | ||
| 103 | |||
| 104 | $Rev: $ | ||
| 105 | $LastChangedBy: $ | ||
| 106 | $Id: $ | ||
| 107 | |||
| 108 | =cut |