Google::Ads::Common::OAuthHandler


Back to Top


NAME

Google::Ads::Common::OAuthHandler

Back to Top


DESCRIPTION

A partial implementation of the Google::Ads::Common::OAuthHandlerInterface manpage that defines most of the logic required to use OAuth against Google Ads endpoints.

It is meant to be specialized and its the _scope manpage method be properly implemented.

Back to Top


ATTRIBUTES

Each of these attributes can be set via Google::Ads::Common::OAuthHandler->new(). Alternatively, there is a get_ and set_ method associated with each attribute for retrieving or setting them dynamically.

request_token_url

Request token URL used to retrieve a request token meant to be later authorized and upgraded to an access token. Defaults to the Google::Ads::Common::Constants::DEFAULT_OAUTH_REQUEST_TOKEN_URL manpage.

authorize_token_url

Authorize token URL used to generate the location the user has to use to a valid request token. Defaults to the Google::Ads::Common::Constants::DEFAULT_OAUTH_AUTHORIZE_TOKEN_URL manpage.

access_token_url

Access token URL used to upgrade an authorized request token. Defaults to the Google::Ads::Common::Constants::DEFAULT_OAUTH_ACCESS_TOKEN_URL manpage.

consumer_key

OAuth consumer key used include in requests, refer to http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html for more information how to request this key. Defaults to the Google::Ads::Common::Constants::DEFAULT_OAUTH_CONSUMER_KEY manpage which is meant to be used only during tests.

consumer_secret

OAuth consumer secret used to sign requests, refer to http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html for more information how to request this key. Defaults to the Google::Ads::Common::Constants::DEFAULT_OAUTH_CONSUMER_KEY manpage which is meant to be used only during tests.

token

OAuth token included in every request, this attribute will hold either a request token while in the process of requesting permission to the user to access his account or an upgraded access token, that can then be kept as foverer unless the user revokes its access, and used to access restricted resources as for example Ads API endpoints. For more information about this process refer to http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html

token_secret

OAuth token secret used to sign every request, this attribute will hold either a request token secret while in the process of requesting permission to the user to access his account or an upgraded access token secret, that can then be kept foverer unless the user revokes its access, and used to access restricted resources as for example Ads API endpoints. For more information about this process refer to http://code.google.com/apis/accounts/docs/RegistrationForWebAppsAuto.html

display_name

OAuth display name include as part of a request token and displayed to the user when authorizing access to your application.

Back to Top


METHODS

get_authorization_url

Refer to the Google::Ads::Common::OAuthHandlerInterface manpage documentation of this method.

upgrade_token

Refer to the Google::Ads::Common::OAuthHandlerInterface manpage documentation of this method.

get_protected_resource_url

Refer to the Google::Ads::Common::OAuthHandlerInterface manpage documentation of this method.

is_oauth_enabled

Refer to the Google::Ads::Common::OAuthHandlerInterface manpage documentation of this method.

_timestamp

Returns a valid OAuth timestamp to be included in every request. The timestamp is expressed in the number of seconds since January 1, 1970 00:00:00 GMT.

_nonce

Returns a valid OAuth nonce to be included in every request. A nonce is a random string, uniquely generated for each request. Which is generated using the more secure Math::Random::MT subroutines with a fallback to the language subroutines if the module can't be loaded.

_scope

Meant to be implemented by subclasses to define the valid XOAuth scope to be included in every request.

Back to Top


LICENSE AND COPYRIGHT

Copyright 2011 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Back to Top


AUTHOR

David Torres <api.davidtorres at gmail.com>

Back to Top


REPOSITORY INFORMATION

 $Rev: $
 $LastChangedBy: $
 $Id: $

Back to Top

 Google::Ads::Common::OAuthHandler