Module: DfpApi::ApiConfig

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

Overview

Contains helper methods for loading and managing the available services.

Constant Summary collapse

CLIENT_LIB_VERSION =
'0.7.0'
DEFAULT_VERSION =

Set defaults

:v201308
DEFAULT_ENVIRONMENT =
:PRODUCTION
LATEST_VERSION =
:v201308
API_NAME =

Set other constants

'DfpApi'
DEFAULT_CONFIG_FILENAME =
'dfp_api.yml'
@@service_config =

Configure the services available to each version

{
  :v201208 => [:CompanyService, :CreativeService, :ForecastService,
               :InventoryService, :LineItemCreativeAssociationService,
               :LineItemService, :NetworkService, :OrderService,
               :PlacementService, :ReportService, :UserService,
               :CustomTargetingService, :PublisherQueryLanguageService,
               :LabelService, :ThirdPartySlotService, :ContentService,
               :SuggestedAdUnitService, :CreativeTemplateService,
               :TeamService, :AudienceSegmentService, :CustomFieldService,
               :UserTeamAssociationService, :CreativeSetService],
  :v201211 => [:CompanyService, :CreativeService, :ForecastService,
               :InventoryService, :LineItemCreativeAssociationService,
               :LineItemService, :NetworkService, :OrderService,
               :PlacementService, :ReportService, :UserService,
               :CustomTargetingService, :PublisherQueryLanguageService,
               :LabelService, :ThirdPartySlotService, :ContentService,
               :SuggestedAdUnitService, :CreativeTemplateService,
               :TeamService, :AudienceSegmentService, :CustomFieldService,
               :UserTeamAssociationService, :CreativeSetService,
               :CreativeWrapperService],
  :v201302 => [:CompanyService, :CreativeService, :ForecastService,
               :InventoryService, :LineItemCreativeAssociationService,
               :LineItemService, :NetworkService, :OrderService,
               :PlacementService, :ReportService, :UserService,
               :CustomTargetingService, :PublisherQueryLanguageService,
               :LabelService, :ThirdPartySlotService, :ContentService,
               :SuggestedAdUnitService, :CreativeTemplateService,
               :TeamService, :AudienceSegmentService, :CustomFieldService,
               :UserTeamAssociationService, :CreativeSetService,
               :CreativeWrapperService, :ActivityGroupService,
               :ActivityService, :AdRuleService, :ContactService,
               :ContentBundleService],
  :v201306 => [:CompanyService, :CreativeService, :ForecastService,
               :InventoryService, :LineItemCreativeAssociationService,
               :LineItemService, :NetworkService, :OrderService,
               :PlacementService, :ReportService, :UserService,
               :CustomTargetingService, :PublisherQueryLanguageService,
               :LabelService, :ContentService, :SuggestedAdUnitService,
               :CreativeTemplateService, :TeamService,
               :AudienceSegmentService, :CustomFieldService,
               :UserTeamAssociationService, :CreativeSetService,
               :CreativeWrapperService, :ActivityGroupService,
               :ActivityService, :AdRuleService, :ContactService,
               :ContentBundleService, :BaseRateService, :ProductService,
               :ProductTemplateService, :ProposalService,
               :ProposalLineItemService, :RateCardService,
               :RateCardCustomizationService,
               :ReconciliationOrderReportService,
               :ReconciliationReportService,
               :ReconciliationReportRowService,
               :WorkflowActionService, :LineItemTemplateService],
  :v201308 => [:CompanyService, :CreativeService, :ForecastService,
               :InventoryService, :LineItemCreativeAssociationService,
               :LineItemService, :NetworkService, :OrderService,
               :PlacementService, :ReportService, :UserService,
               :CustomTargetingService, :PublisherQueryLanguageService,
               :LabelService, :ContentService, :SuggestedAdUnitService,
               :CreativeTemplateService, :TeamService,
               :AudienceSegmentService, :CustomFieldService,
               :UserTeamAssociationService, :CreativeSetService,
               :CreativeWrapperService, :ActivityGroupService,
               :ActivityService, :AdRuleService, :ContactService,
               :ContentBundleService, :BaseRateService, :ProductService,
               :ProductTemplateService, :ProposalService,
               :ProposalLineItemService, :RateCardService,
               :RateCardCustomizationService,
               :ReconciliationOrderReportService,
               :ReconciliationReportService,
               :ReconciliationReportRowService,
               :WorkflowActionService, :LineItemTemplateService]
}
@@environment_config =

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

{
  :PRODUCTION => {
    :oauth_scope => 'https://www.google.com/apis/ads/publisher/',
    :header_ns => 'https://www.google.com/apis/ads/publisher/',
    :v201208 => 'https://www.google.com/apis/ads/publisher/',
    :v201211 => 'https://www.google.com/apis/ads/publisher/',
    :v201302 => 'https://www.google.com/apis/ads/publisher/',
    :v201306 => 'https://www.google.com/apis/ads/publisher/',
    :v201308 => 'https://www.google.com/apis/ads/publisher/'
  }
}
@@client_login_config =

Auth constants for ClientLogin method.

{
  :AUTH_SERVER => 'https://www.google.com',
  :LOGIN_SERVICE_NAME => 'gam'
}

Class Method Summary collapse

Class Method Details

.api_name ⇒ Object



153
154
155
# File 'lib/dfp_api/api_config.rb', line 153

def self.api_name
  API_NAME
end

.client_login_config(key) ⇒ Object



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

def self.(key)
  return [key]
end

.default_config_filename ⇒ Object



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

def self.default_config_filename
  DEFAULT_CONFIG_FILENAME
end

.default_environment ⇒ Object



145
146
147
# File 'lib/dfp_api/api_config.rb', line 145

def self.default_environment
  DEFAULT_ENVIRONMENT
end

.default_version ⇒ Object

Getters for constants and module variables.



141
142
143
# File 'lib/dfp_api/api_config.rb', line 141

def self.default_version
  DEFAULT_VERSION
end

.environment_config(environment, key) ⇒ Object



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

def self.environment_config(environment, key)
  return @@environment_config.include?(environment) ?
      @@environment_config[environment][key] : nil
end

.latest_version ⇒ Object



149
150
151
# File 'lib/dfp_api/api_config.rb', line 149

def self.latest_version
  LATEST_VERSION
end

.service_config ⇒ Object



157
158
159
# File 'lib/dfp_api/api_config.rb', line 157

def self.service_config
  @@service_config
end

.subdir_config ⇒ Object



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

def self.subdir_config
  nil
end