Configuration is done through the Config class. You can access this class in multiple ways.

Configuration file

You can specify a google_ads_config.rb file to use when instantiating the client.

If you use no arguments when instantiating:

client =

then the library will look in your HOME directory for the file.

Alternatively, you can specify a path:

client ="path/to/file.rb")

in which case the client will look for the file at that filepath.

The easiest way to generate this file is to copy the google_ads_config.rb from the GitHub repo and modify it to include your refresh token, client ID, and client secret.

Dynamic configuration

You can set up the configuration dynamically when instantiating the library, or even afterwards:

client = do |config|
  config.client_id = 'INSERT_CLIENT_ID_HERE'
  # ... more configuration

You can even modify the configuration after instantiation:

client.configure do |config|
  config.login_customer_id = 'INSERT_LOGIN_CUSTOMER_ID_HERE'
  # ... more configuration

Configuration Fields

The Config object supports the following fields.

General fields:

  • refresh_token: Your OAuth refresh token.
  • client_id: Your OAuth client ID.
  • client_secret: Your OAuth client secret.
  • developer_token: Your developer token for accessing the API.
  • login_customer_id: See the login-customer-id documentation.

Logging fields. See the logging guide for complete details.

  • log_level: The minimum log level messages you want logged. For example, specifying 'DEBUG' will ensure you see all log messages, and specifying 'INFO' will exclude DEBUG messages but show all other messages.
  • log_target: Where you want to log to, such as STDERR.
  • logger: Specify your own custom logger. Specifying this will override both log_level and log_target.