« lib/Google/Ads/Common/MediaUtils.pm
↑ Summary
blib/lib/Google/Ads/AdWords/OAuth2ServiceAccountsHandler.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::AdWords::OAuth2ApplicationsHandler; | ||
| 16 | |||
| 17 | use strict; | ||
| 18 | use version; | ||
| 19 | use base qw(Google::Ads::Common::OAuth2ApplicationsHandler); | ||
| 20 | |||
| 21 | # The following needs to be on one line because CPAN uses a particularly hacky | ||
| 22 | # eval() to determine module versions. | ||
| 23 | use Google::Ads::AdWords::Constants; our $VERSION = ${Google::Ads::AdWords::Constants::VERSION}; | ||
| 24 | |||
| 25 | use Class::Std::Fast; | ||
| 26 | |||
| 27 | my %server_of : ATTR(:name<server> :default<"https://adwords.google.com">); | ||
| 28 | |||
| 29 | # Retrieves the XOAuth scope required for AdWords API. | ||
| 30 | sub _scope { | ||
| 31 | my $self = shift; | ||
| 32 | |||
| 33 | return $self->get_server() . "/api/adwords/"; | ||
| 34 | } | ||
| 35 | |||
| 36 | 1; | ||
| 37 | |||
| 38 | |||
| 39 | =pod | ||
| 40 | |||
| 41 | =head1 NAME | ||
| 42 | |||
| 43 | Google::Ads::AdWords::OAuth2ApplicationsHandler | ||
| 44 | |||
| 45 | =head1 DESCRIPTION | ||
| 46 | |||
| 47 | A concrete implementation of | ||
| 48 | L<Google::Ads::Common::OAuth2ApplicationsHandler> that | ||
| 49 | defines the scope required to access AdWords API servers using | ||
| 50 | OAuth2 for Web/Installed Applications, see | ||
| 51 | <https://developers.google.com/accounts/docs/OAuth2> for details of the | ||
| 52 | protocol. | ||
| 53 | |||
| 54 | Refer to the base object L<Google::Ads::Common::OAuth2ApplicationsHandler> | ||
| 55 | for a complete documentation of all the methods supported by this handler class. | ||
| 56 | |||
| 57 | =head1 ATTRIBUTES | ||
| 58 | |||
| 59 | Each of these attributes can be set via the constructor as a hash. | ||
| 60 | Alternatively, there is a get_ and set_ method associated with each attribute | ||
| 61 | for retrieving or setting them dynamically. | ||
| 62 | |||
| 63 | =head2 server | ||
| 64 | |||
| 65 | The API server path to use to construct the scope, defaults to | ||
| 66 | I<https://adwords.google.com> and be changed to | ||
| 67 | I<https://adwords-sandbox.google.com> for use with the Sanbox environment. | ||
| 68 | |||
| 69 | =head1 METHODS | ||
| 70 | |||
| 71 | =head2 _scope | ||
| 72 | |||
| 73 | Method defined by L<Google::Ads::AdWords::AuthTokenHandler> and implemented | ||
| 74 | in this class as a requirement for the OAuth2 protocol. | ||
| 75 | |||
| 76 | =head3 Returns | ||
| 77 | |||
| 78 | Returns the scope used to generate access tokens. | ||
| 79 | |||
| 80 | =head1 LICENSE AND COPYRIGHT | ||
| 81 | |||
| 82 | Copyright 2012 Google Inc. | ||
| 83 | |||
| 84 | Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 85 | you may not use this file except in compliance with the License. | ||
| 86 | You may obtain a copy of the License at | ||
| 87 | |||
| 88 | http://www.apache.org/licenses/LICENSE-2.0 | ||
| 89 | |||
| 90 | Unless required by applicable law or agreed to in writing, software | ||
| 91 | distributed under the License is distributed on an "AS IS" BASIS, | ||
| 92 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 93 | See the License for the specific language governing permissions and | ||
| 94 | limitations under the License. | ||
| 95 | |||
| 96 | =head1 AUTHOR | ||
| 97 | |||
| 98 | David Torres E<lt>david.t at google.comE<gt> | ||
| 99 | |||
| 100 | =head1 REPOSITORY INFORMATION | ||
| 101 | |||
| 102 | $Rev: $ | ||
| 103 | $LastChangedBy: $ | ||
| 104 | $Id: $ | ||
| 105 | |||
| 106 | =cut |