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.9.2'
DEFAULT_VERSION =

Set defaults

:v201408
DEFAULT_ENVIRONMENT =
:PRODUCTION
LATEST_VERSION =
:v201408
API_NAME =

Set other constants

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

Configure the services available to each version

{
  :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],
  :v201311 => [:ActivityGroupService, :ActivityService, :AdRuleService,
               :AudienceSegmentService, :BaseRateService, :CompanyService,
               :ContactService, :ContentBundleService,
               :ContentMetadataKeyHierarchyService, :ContentService,
               :CreativeService, :CreativeSetService,
               :CreativeTemplateService, :CreativeWrapperService,
               :CustomFieldService, :CustomTargetingService,
               :ExchangeRateService, :ForecastService, :InventoryService,
               :LabelService, :LineItemCreativeAssociationService,
               :LineItemService, :LineItemTemplateService, :NetworkService,
               :OrderService, :PlacementService, :ProductService,
               :ProductTemplateService, :ProposalLineItemService,
               :ProposalService, :PublisherQueryLanguageService,
               :RateCardCustomizationService, :RateCardService,
               :ReconciliationOrderReportService,
               :ReconciliationReportRowService,
               :ReconciliationReportService, :ReportService,
               :SuggestedAdUnitService, :TeamService, :UserService,
               :UserTeamAssociationService, :WorkflowRequestService],
  :v201403 => [:ActivityGroupService, :ActivityService, :AdRuleService,
               :AudienceSegmentService, :BaseRateService, :CompanyService,
               :ContactService, :ContentBundleService,
               :ContentMetadataKeyHierarchyService, :ContentService,
               :CreativeService, :CreativeSetService,
               :CreativeTemplateService, :CreativeWrapperService,
               :CustomFieldService, :CustomTargetingService,
               :ExchangeRateService, :ForecastService, :InventoryService,
               :LabelService, :LineItemCreativeAssociationService,
               :LineItemService, :LineItemTemplateService,
               :NetworkService, :LiveStreamEventService,
               :OrderService, :PlacementService, :ProductService,
               :ProductTemplateService, :ProposalLineItemService,
               :ProposalService, :PublisherQueryLanguageService,
               :RateCardCustomizationService,
               :RateCardCustomizationGroupService, :RateCardService,
               :ReconciliationOrderReportService,
               :ReconciliationReportRowService,
               :ReconciliationReportService, :ReportService,
               :SuggestedAdUnitService, :TeamService, :UserService,
               :UserTeamAssociationService, :WorkflowRequestService],
  :v201405 => [:ActivityGroupService, :ActivityService, :AdRuleService,
               :AudienceSegmentService, :BaseRateService, :CompanyService,
               :ContactService, :ContentBundleService,
               :ContentMetadataKeyHierarchyService, :ContentService,
               :CreativeService, :CreativeSetService,
               :CreativeTemplateService, :CreativeWrapperService,
               :CustomFieldService, :CustomTargetingService,
               :ExchangeRateService, :ForecastService, :InventoryService,
               :LabelService, :LineItemCreativeAssociationService,
               :LineItemService, :LineItemTemplateService,
               :NetworkService, :LiveStreamEventService,
               :OrderService, :PlacementService, :ProductService,
               :ProductTemplateService, :ProposalLineItemService,
               :ProposalService, :PublisherQueryLanguageService,
               :RateCardCustomizationService,
               :RateCardCustomizationGroupService, :RateCardService,
               :ReconciliationOrderReportService,
               :ReconciliationReportRowService,
               :ReconciliationReportService, :ReportService,
               :SuggestedAdUnitService, :TeamService, :UserService,
               :UserTeamAssociationService, :WorkflowRequestService],
  :v201408 => [:ActivityGroupService, :ActivityService, :AdRuleService,
               :AudienceSegmentService, :BaseRateService, :CompanyService,
               :ContactService, :ContentBundleService,
               :ContentMetadataKeyHierarchyService, :ContentService,
               :CreativeService, :CreativeSetService,
               :CreativeTemplateService, :CreativeWrapperService,
               :CustomFieldService, :CustomTargetingService,
               :ExchangeRateService, :ForecastService, :InventoryService,
               :LabelService, :LineItemCreativeAssociationService,
               :LineItemService, :LineItemTemplateService,
               :NetworkService, :LiveStreamEventService,
               :OrderService, :PlacementService,
               :PremiumRateService, :ProductService,
               :ProductTemplateService, :ProposalLineItemService,
               :ProposalService, :PublisherQueryLanguageService,
               :RateCardService, :ReconciliationOrderReportService,
               :ReconciliationReportRowService,
               :ReconciliationReportService, :ReportService,
               :SuggestedAdUnitService, :TeamService, :UserService,
               :UserTeamAssociationService, :WorkflowRequestService]
}
@@environment_config =

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

{
  :PRODUCTION => {
    :oauth_scope => 'https://www.googleapis.com/auth/dfp',
    :header_ns => 'https://www.google.com/apis/ads/publisher/',
    :v201306 => 'https://ads.google.com/apis/ads/publisher/',
    :v201308 => 'https://ads.google.com/apis/ads/publisher/',
    :v201311 => 'https://ads.google.com/apis/ads/publisher/',
    :v201403 => 'https://ads.google.com/apis/ads/publisher/',
    :v201405 => 'https://ads.google.com/apis/ads/publisher/',
    :v201408 => 'https://ads.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



204
205
206
# File 'lib/dfp_api/api_config.rb', line 204

def self.api_name
  API_NAME
end

.client_login_config(key) ⇒ Object



221
222
223
# File 'lib/dfp_api/api_config.rb', line 221

def self.(key)
  return @@client_login_config[key]
end

.default_config_filename ⇒ Object



225
226
227
# File 'lib/dfp_api/api_config.rb', line 225

def self.default_config_filename
  DEFAULT_CONFIG_FILENAME
end

.default_environment ⇒ Object



196
197
198
# File 'lib/dfp_api/api_config.rb', line 196

def self.default_environment
  DEFAULT_ENVIRONMENT
end

.default_version ⇒ Object

Getters for constants and module variables.



192
193
194
# File 'lib/dfp_api/api_config.rb', line 192

def self.default_version
  DEFAULT_VERSION
end

.environment_config(environment, key) ⇒ Object



212
213
214
215
# File 'lib/dfp_api/api_config.rb', line 212

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

.latest_version ⇒ Object



200
201
202
# File 'lib/dfp_api/api_config.rb', line 200

def self.latest_version
  LATEST_VERSION
end

.service_config ⇒ Object



208
209
210
# File 'lib/dfp_api/api_config.rb', line 208

def self.service_config
  @@service_config
end

.subdir_config ⇒ Object



217
218
219
# File 'lib/dfp_api/api_config.rb', line 217

def self.subdir_config
  nil
end