NAME

Google::Ads::Common::OAuth1_0aHandler

DESCRIPTION

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

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

ATTRIBUTES

Each of these attributes can be set via Google::Ads::Common::OAuth1_0aHandler->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 Google::Ads::Common::Constants::DEFAULT_OAUTH_REQUEST_TOKEN_URL.

authorize_token_url

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

access_token_url

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

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 Google::Ads::Common::Constants::DEFAULT_OAUTH_CONSUMER_KEY 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 Google::Ads::Common::Constants::DEFAULT_OAUTH_CONSUMER_KEY 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.

METHODS

initialize

Initializes the handler with properties such as the consumer_key and consumer_secret to use for generating authorization requests.

Parameters

  • A required api_client with a reference to the API client object handling the requests against the API.

  • A hash reference with the following keys: { # A consumer key generated from the API console. oAuthConsumerKey => "consumer key", # A consumer secret generated from the API console. oAuthConsumerSecret => "consumer secret", # Display name shown to the user when requesting authorization. oAuthDisplayName => "name", # Optionally an access token and secret can be manually set if authorization # was previosly requested. oAuthToken => "token", oAuthTokenSecret => "secret", }

is_auth_enabled

Refer to Google::Ads::Common::AuthHandlerInterface documentation of this method.

prepare_request

Refer to Google::Ads::Common::AuthHandlerInterface documentation of this method.

get_authorization_url

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

issue_access_token

Refer to Google::Ads::Common::OAuthHandlerInterface 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.

LICENSE AND COPYRIGHT

Copyright 2012 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.

AUTHOR

David Torres <david.t at google.com>

REPOSITORY INFORMATION

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

1 POD Error

The following errors were encountered while parsing the POD:

Around line 330:

You forgot a '=back' before '=head2'