com.google.api.ads.adwords.lib.client
Class AdWordsSession.Builder

java.lang.Object
  extended by com.google.api.ads.adwords.lib.client.AdWordsSession.Builder
All Implemented Interfaces:
Builder<AdWordsSession>
Enclosing class:
AdWordsSession

public static class AdWordsSession.Builder
extends Object
implements Builder<AdWordsSession>

Builder for AdWordsSession.


Field Summary
 
Fields inherited from interface com.google.api.ads.common.lib.utils.Builder
DEFAULT_CONFIGURATION_FILENAME
 
Constructor Summary
AdWordsSession.Builder()
          Constructor.
 
Method Summary
 AdWordsSession build()
          Builds the AdWordsSession.
 AdWordsSession.Builder enablePartialFailure()
          Enables partial failure.
 AdWordsSession.Builder enableReportMoneyInMicros()
          Enable downloading of money values in reports in micros.
 AdWordsSession.Builder from(org.apache.commons.configuration.Configuration config)
          Reads properties from the provided Configuration object.

Known properties: api.adwords.clientLoginToken api.adwords.clientCustomerId api.adwords.userAgent api.adwords.developerToken api.adwords.isPartialFailure api.adwords.environment - e.g.
 AdWordsSession.Builder fromFile()
          Loads credentials from "ads.properties" file in one of the following locations according to the following order: in the current directory, in the user home directory, in the classpath
 AdWordsSession.Builder fromFile(File path)
          Populates this builder from a properties file from a specified path.
 AdWordsSession.Builder fromFile(String path)
          Populates this builder from a properties file from a specified path.
 AdWordsSession.Builder fromFile(URL path)
          Populates this builder from a properties file from a specified path.
 AdWordsSession.Builder withClientCustomerId(String clientCustomerId)
          Includes a clientCustomerId.
 AdWordsSession.Builder withClientLoginToken(String clientLoginToken)
          Includes hard-coded ClientLogin token that will be used instead of fetching a new one.
 AdWordsSession.Builder withDeveloperToken(String developerToken)
          Includes a developer token.
 AdWordsSession.Builder withEndpoint(String endpoint)
          Override the endpoint server.
 AdWordsSession.Builder withEnvironment(AdWordsSession.Environment environment)
          Includes the specified environment, e.g.
 AdWordsSession.Builder withOAuth2Credential(com.google.api.client.auth.oauth2.Credential oAuth2Credential)
          Includes OAuth2 credential to be used for OAuth2 authentication.
 AdWordsSession.Builder withOAuthParameters(com.google.api.client.auth.oauth.OAuthParameters oAuthParameters)
          Includes OAuth parameters to be used for OAuth authentication.
 AdWordsSession.Builder withUserAgent(String userAgent)
          Includes user agent.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AdWordsSession.Builder

public AdWordsSession.Builder()
Constructor.

Method Detail

fromFile

public AdWordsSession.Builder fromFile()
                                throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Description copied from interface: Builder
Loads credentials from "ads.properties" file in one of the following locations according to the following order: in the current directory, in the user home directory, in the classpath

Specified by:
fromFile in interface Builder<AdWordsSession>
Throws:
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be loaded.

fromFile

public AdWordsSession.Builder fromFile(String path)
                                throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Description copied from interface: Builder
Populates this builder from a properties file from a specified path. If not absolute, will look in user home directory, the current classpath and the system classpath.

Specified by:
fromFile in interface Builder<AdWordsSession>
Parameters:
path - the path to try first as a resource, then as a file
Returns:
Builder populated with properties.
Throws:
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be loaded.

fromFile

public AdWordsSession.Builder fromFile(File path)
                                throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Description copied from interface: Builder
Populates this builder from a properties file from a specified path.

Specified by:
fromFile in interface Builder<AdWordsSession>
Parameters:
path - the path to load properties from
Returns:
Builder populated with properties.
Throws:
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be loaded.

fromFile

public AdWordsSession.Builder fromFile(URL path)
                                throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Description copied from interface: Builder
Populates this builder from a properties file from a specified path. If not absolute, will look in user home directory, the current classpath and the system classpath.

Specified by:
fromFile in interface Builder<AdWordsSession>
Parameters:
path - the path to try first as a resource, then as a file
Returns:
Builder populated with properties.
Throws:
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be loaded.

from

public AdWordsSession.Builder from(org.apache.commons.configuration.Configuration config)
Reads properties from the provided Configuration object.

Known properties:

Specified by:
from in interface Builder<AdWordsSession>
Parameters:
config -
Returns:
Builder populated from the Configuration

withClientLoginToken

public AdWordsSession.Builder withClientLoginToken(String clientLoginToken)
Includes hard-coded ClientLogin token that will be used instead of fetching a new one.


withDeveloperToken

public AdWordsSession.Builder withDeveloperToken(String developerToken)
Includes a developer token. Required.


withOAuthParameters

public AdWordsSession.Builder withOAuthParameters(com.google.api.client.auth.oauth.OAuthParameters oAuthParameters)
Includes OAuth parameters to be used for OAuth authentication.


withOAuth2Credential

public AdWordsSession.Builder withOAuth2Credential(com.google.api.client.auth.oauth2.Credential oAuth2Credential)
Includes OAuth2 credential to be used for OAuth2 authentication.


withUserAgent

public AdWordsSession.Builder withUserAgent(String userAgent)
Includes user agent.


withEnvironment

public AdWordsSession.Builder withEnvironment(AdWordsSession.Environment environment)
Includes the specified environment, e.g. AdWordsSession.Environment.SANDBOX The environment and endpoint in AdWords are currently synonymous. Setting an environment will clear out any endpoint you have previously set.


withEndpoint

public AdWordsSession.Builder withEndpoint(String endpoint)
Override the endpoint server. The environment and endpoint in AdWords are currently synonymous. Setting an endpoint will clear out any environment you have previously set.


withClientCustomerId

public AdWordsSession.Builder withClientCustomerId(String clientCustomerId)
Includes a clientCustomerId.


enablePartialFailure

public AdWordsSession.Builder enablePartialFailure()
Enables partial failure. Default is disabled.


enableReportMoneyInMicros

public AdWordsSession.Builder enableReportMoneyInMicros()
Enable downloading of money values in reports in micros.


build

public AdWordsSession build()
                     throws ValidationException
Builds the AdWordsSession.

Specified by:
build in interface Builder<AdWordsSession>
Returns:
the built AdWordsSession
Throws:
ValidationException - if the AdWordsSession did not validate


Copyright © 2012. All Rights Reserved.