public static class DfpSession.Builder extends Object implements Builder<DfpSession>
DfpSession
.
Implementation is not thread-safe.
DEFAULT_CONFIGURATION_FILENAME
Constructor and Description |
---|
DfpSession.Builder()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
DfpSession |
build()
Builds the
DfpSession . |
DfpSession.Builder |
from(org.apache.commons.configuration.Configuration config)
Reads properties from the provided
Configuration object.Known properties: api.dfp.applicationName api.dfp.networkCode api.dfp.endpoint Deprecated: api.dfp.clientLoginToken - use OAuth2 instead. |
DfpSession.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
|
DfpSession.Builder |
fromFile(File path)
Populates this builder from a properties file from a specified path.
|
DfpSession.Builder |
fromFile(String path)
Populates this builder from a properties file from a specified path.
|
DfpSession.Builder |
fromFile(URL path)
Populates this builder from a properties file from a specified path.
|
DfpSession.Builder |
withApplicationName(String applicationName)
Includes application name (any string of your choice).
|
DfpSession.Builder |
withClientLoginToken(String clientLoginToken)
Deprecated.
It is encouraged that you switch to OAuth2 at your earliest
convenience. Please see the OfflineCredentials utility for
generating offline credentials easily.
|
DfpSession.Builder |
withEndpoint(String endpoint)
Override the endpoint server.
|
DfpSession.Builder |
withNetworkCode(String networkCode)
Includes network code.
|
DfpSession.Builder |
withOAuth2Credential(com.google.api.client.auth.oauth2.Credential oAuth2Credential)
Includes OAuth2 credential to be used for OAuth2 authentication.
|
public DfpSession.Builder fromFile() throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<DfpSession>
com.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public DfpSession.Builder fromFile(String path) throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<DfpSession>
path
- the path to try first as a resource, then as a filecom.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public DfpSession.Builder fromFile(File path) throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<DfpSession>
path
- the path to load properties fromcom.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public DfpSession.Builder fromFile(URL path) throws com.google.api.ads.common.lib.conf.ConfigurationLoadException
Builder
fromFile
in interface Builder<DfpSession>
path
- the path to try first as a resource, then as a filecom.google.api.ads.common.lib.conf.ConfigurationLoadException
- if the configuration could not be
loaded.public DfpSession.Builder from(org.apache.commons.configuration.Configuration config)
Configuration
object.from
in interface Builder<DfpSession>
config
- the configuration@Deprecated public DfpSession.Builder withClientLoginToken(String clientLoginToken)
public DfpSession.Builder withOAuth2Credential(com.google.api.client.auth.oauth2.Credential oAuth2Credential)
public DfpSession.Builder withNetworkCode(String networkCode)
public DfpSession.Builder withApplicationName(String applicationName)
public DfpSession.Builder withEndpoint(String endpoint)
public DfpSession build() throws ValidationException
DfpSession
.build
in interface Builder<DfpSession>
DfpSession
ValidationException
- if the DfpSession
did not validateCopyright © 2014. All Rights Reserved.