Module: AdwordsApi::ApiConfig

Extended by:
AdsCommon::ApiConfig
Defined in:
lib/adwords_api/api_config.rb,
lib/adwords_api/version.rb

Overview

Contains helper methods for loading and managing the available services.

Constant Summary collapse

CLIENT_LIB_VERSION =
'0.5.3'
DEFAULT_VERSION =

Set defaults

:v201109
DEFAULT_ENVIRONMENT =
:PRODUCTION
LATEST_VERSION =
:v201109
API_NAME =

Set other constants

'AdwordsApi'
DEFAULT_CONFIG_FILENAME =
'adwords_api.yml'
@@service_config =

Configure the services available to each version

{
  :v201109 => [
      :AdExtensionOverrideService,
      :AdGroupAdService,
      :AdGroupCriterionService,
      :AdGroupService,
      :AdParamService,
      :AlertService,
      :BulkMutateJobService,
      :CampaignAdExtensionService,
      :CampaignCriterionService,
      :CampaignService,
      :CampaignTargetService,
      :ConstantDataService,
      :ConversionTrackerService,
      :CreateAccountService,
      :CustomerSyncService,
      :DataService,
      :ExperimentService,
      :GeoLocationService,
      :InfoService,
      :LocationCriterionService,
      :MediaService,
      :MutateJobService,
      :ReportDefinitionService,
      :ServicedAccountService,
      :TargetingIdeaService,
      :TrafficEstimatorService,
      :UserListService
  ]
}
@@environment_config =

Configure the different environments, with the base URL for each one

{
  :PRODUCTION => {
    :oauth_scope => 'https://adwords.google.com/api/adwords/',
    :v201109 => 'https://adwords.google.com/api/adwords/'
  },
  :SANDBOX => {
    :oauth_scope => 'https://adwords-sandbox.google.com/api/adwords/',
    :v201109 => 'https://adwords-sandbox.google.com/api/adwords/'
  }
}
@@subdir_config =

Configure the subdirectories for each version / service pair. A missing pair means that only the base URL is used.

{
  # v201109
  [:v201109, :AdExtensionOverrideService] => 'cm/',
  [:v201109, :AdGroupAdService] => 'cm/',
  [:v201109, :AdGroupCriterionService] => 'cm/',
  [:v201109, :AdGroupService] => 'cm/',
  [:v201109, :AdParamService] => 'cm/',
  [:v201109, :AlertService] => 'mcm/',
  [:v201109, :BulkMutateJobService] => 'job/',
  [:v201109, :CampaignAdExtensionService] => 'cm/',
  [:v201109, :CampaignCriterionService] => 'cm/',
  [:v201109, :CampaignService] => 'cm/',
  [:v201109, :CampaignTargetService] => 'cm/',
  [:v201109, :ConstantDataService] => 'cm/',
  [:v201109, :ConversionTrackerService] => 'cm/',
  [:v201109, :CreateAccountService] => 'mcm/',
  [:v201109, :CustomerSyncService] => 'ch/',
  [:v201109, :DataService] => 'cm/',
  [:v201109, :ExperimentService] => 'cm/',
  [:v201109, :GeoLocationService] => 'cm/',
  [:v201109, :InfoService] => 'info/',
  [:v201109, :LocationCriterionService] => 'cm/',
  [:v201109, :MediaService] => 'cm/',
  [:v201109, :MutateJobService] => 'cm/',
  [:v201109, :ReportDefinitionService] => 'cm/',
  [:v201109, :ServicedAccountService] => 'mcm/',
  [:v201109, :TargetingIdeaService] => 'o/',
  [:v201109, :TrafficEstimatorService] => 'o/',
  [:v201109, :UserListService] => 'cm/'
}
@@auth_server_config =

Configure the auth servers to use for each environment

{
  :PRODUCTION => 'https://www.google.com',
  :SANDBOX => 'https://www.google.com'
}
@@headers_config =
{
  :REQUEST_HEADER => 'RequestHeader',
  :AUTH_NAMESPACE_PREAMBLE =>
      'https://adwords.google.com/api/adwords/cm/',
  :LOGIN_SERVICE_NAME => 'adwords'
}

Class Method Summary collapse

Class Method Details

.adhoc_report_download_url(environment, version) ⇒ Object

Get the download URL for Ad Hoc reports.

Args:

  • environment: the service environment to be used

  • version: the API version (as a symbol)

Returns:

  • The endpoint URL (as a string)



208
209
210
211
212
213
214
# File 'lib/adwords_api/api_config.rb', line 208

def self.adhoc_report_download_url(environment, version)
  base = get_wsdl_base(environment, version)
  if base
    base += 'reportdownload/%s' % version.to_s
  end
  return base
end

.api_nameObject



154
155
156
# File 'lib/adwords_api/api_config.rb', line 154

def self.api_name
  API_NAME
end

.auth_server_configObject



170
171
172
# File 'lib/adwords_api/api_config.rb', line 170

def self.auth_server_config
  @@auth_server_config
end

.default_config_filenameObject



174
175
176
# File 'lib/adwords_api/api_config.rb', line 174

def self.default_config_filename
  DEFAULT_CONFIG_FILENAME
end

.default_environmentObject



146
147
148
# File 'lib/adwords_api/api_config.rb', line 146

def self.default_environment
  DEFAULT_ENVIRONMENT
end

.default_versionObject

Getters for constants and module variables.



142
143
144
# File 'lib/adwords_api/api_config.rb', line 142

def self.default_version
  DEFAULT_VERSION
end

.environment_configObject



162
163
164
# File 'lib/adwords_api/api_config.rb', line 162

def self.environment_config
  @@environment_config
end

.headers_configObject



178
179
180
# File 'lib/adwords_api/api_config.rb', line 178

def self.headers_config
  @@headers_config
end

.latest_versionObject



150
151
152
# File 'lib/adwords_api/api_config.rb', line 150

def self.latest_version
  LATEST_VERSION
end

.report_download_url(environment, version) ⇒ Object

Get the download URL for reports.

Args:

  • environment: the service environment to be used

  • version: the API version (as a symbol)

Returns:

  • The endpoint URL (as a string)



191
192
193
194
195
196
197
# File 'lib/adwords_api/api_config.rb', line 191

def self.report_download_url(environment, version)
  base = get_wsdl_base(environment, version)
  if base and service_config[version].include?(:ReportDefinitionService)
    base += 'reportdownload'
  end
  return base
end

.service_configObject



158
159
160
# File 'lib/adwords_api/api_config.rb', line 158

def self.service_config
  @@service_config
end

.subdir_configObject



166
167
168
# File 'lib/adwords_api/api_config.rb', line 166

def self.subdir_config
  @@subdir_config
end