com.google.api.ads.common.lib.auth
Class ClientLoginTokens.ForApiBuilder

java.lang.Object
  extended by com.google.api.ads.common.lib.auth.ClientLoginTokens.ForApiBuilder
All Implemented Interfaces:
Builder<ClientLoginTokens>
Enclosing class:
ClientLoginTokens

public static class ClientLoginTokens.ForApiBuilder
extends Object
implements Builder<ClientLoginTokens>

Builder for ClientLoginTokens.


Field Summary
 
Fields inherited from interface com.google.api.ads.common.lib.utils.Builder
DEFAULT_CONFIGURATION_FILENAME
 
Method Summary
 ClientLoginTokens build()
          Constructs this object.
 ClientLoginTokens.ForApiBuilder from(org.apache.commons.configuration.Configuration config)
          Reads properties from the provided Configuration object

Known properties: clientLoginServerUrl - e.g.
 ClientLoginTokens.ForApiBuilder 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
 ClientLoginTokens.ForApiBuilder fromFile(File path)
          Populates this builder from a properties file from a specified path.
 ClientLoginTokens.ForApiBuilder fromFile(String path)
          Populates this builder from a properties file from a specified path.
 ClientLoginTokens.ForApiBuilder fromFile(URL path)
          Populates this builder from a properties file from a specified path.
 ClientLoginTokens.ForApiBuilder withClientLoginServerUrl(String serverUrl)
          Sets the client login server that the token will be fetched typically in the form of https://www.google.com
 ClientLoginTokens.ForApiBuilder withEmailAndPassword(String email, String password)
          Includes email & password to fetch client login token.
 ClientLoginTokens.ForApiBuilder withHttpTransport(com.google.api.client.http.HttpTransport httpTransport)
          Sets the HttpTransport to be used to make the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromFile

public ClientLoginTokens.ForApiBuilder 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<ClientLoginTokens>
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 ClientLoginTokens.ForApiBuilder 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<ClientLoginTokens>
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 ClientLoginTokens.ForApiBuilder 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<ClientLoginTokens>
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 ClientLoginTokens.ForApiBuilder 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<ClientLoginTokens>
Throws:
com.google.api.ads.common.lib.conf.ConfigurationLoadException - if the configuration could not be loaded.

from

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

Known properties: Understands the following properties suffixes:


For example, the AdWords ClientLoginToken can be read from: api.adwords.clientLoginToken

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

withEmailAndPassword

public ClientLoginTokens.ForApiBuilder withEmailAndPassword(String email,
                                                            String password)
Includes email & password to fetch client login token.


withHttpTransport

public ClientLoginTokens.ForApiBuilder withHttpTransport(com.google.api.client.http.HttpTransport httpTransport)
Sets the HttpTransport to be used to make the request. By default, NetHttpTransport will be used, but due to some environment restrictions, you may want to use a different transport, such as UrlFetchTransport for AppEngine.


withClientLoginServerUrl

public ClientLoginTokens.ForApiBuilder withClientLoginServerUrl(String serverUrl)
Sets the client login server that the token will be fetched typically in the form of https://www.google.com


build

public ClientLoginTokens build()
                        throws ValidationException
Description copied from interface: Builder
Constructs this object.

Specified by:
build in interface Builder<ClientLoginTokens>
Throws:
ValidationException - if the provided data is not valid.


Copyright © 2012. All Rights Reserved.