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

Set defaults

:v201708
DEFAULT_ENVIRONMENT =
:PRODUCTION
LATEST_VERSION =
:v201708
API_NAME =

Set other constants

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

Configure the services available to each version

{
  :v201611 => [:ActivityGroupService, :ActivityService,
               :AdExclusionRuleService, :AdRuleService,
               :AudienceSegmentService, :BaseRateService, :CompanyService,
               :ContactService, :ContentBundleService,
               :ContentMetadataKeyHierarchyService, :ContentService,
               :CreativeService, :CreativeSetService,
               :CreativeTemplateService, :CreativeWrapperService,
               :CustomFieldService, :CustomTargetingService,
               :ExchangeRateService, :ForecastService, :InventoryService,
               :LabelService, :LineItemCreativeAssociationService,
               :LineItemService, :LineItemTemplateService,
               :LiveStreamEventService, :MobileApplicationService,
               :NetworkService, :OrderService, :PackageService,
               :ProductPackageService, :ProductPackageItemService,
               :PlacementService, :PremiumRateService, :ProductService,
               :ProductTemplateService, :ProposalLineItemService,
               :ProposalService, :PublisherQueryLanguageService,
               :RateCardService, :ReconciliationOrderReportService,
               :ReconciliationLineItemReportService,
               :ReconciliationReportRowService,
               :ReconciliationReportService, :ReportService,
               :SuggestedAdUnitService,
               :TeamService, :UserService,
               :UserTeamAssociationService, :WorkflowRequestService],
  :v201702 => [:ActivityGroupService, :ActivityService,
               :AdExclusionRuleService, :AdRuleService,
               :AudienceSegmentService, :BaseRateService, :CompanyService,
               :ContactService, :ContentBundleService,
               :ContentMetadataKeyHierarchyService, :ContentService,
               :CreativeService, :CreativeSetService,
               :CreativeTemplateService, :CreativeWrapperService,
               :CustomFieldService, :CustomTargetingService,
               :ExchangeRateService, :ForecastService, :InventoryService,
               :LabelService, :LineItemCreativeAssociationService,
               :LineItemService, :LineItemTemplateService,
               :LiveStreamEventService, :MobileApplicationService,
               :NativeStyleService, :NetworkService, :OrderService,
               :PackageService, :ProductPackageService,
               :ProductPackageItemService, :PlacementService,
               :PremiumRateService, :ProductService,
               :ProductTemplateService, :ProposalLineItemService,
               :ProposalService, :PublisherQueryLanguageService,
               :RateCardService, :ReconciliationOrderReportService,
               :ReconciliationLineItemReportService,
               :ReconciliationReportRowService,
               :ReconciliationReportService, :ReportService,
               :SuggestedAdUnitService, :TeamService, :UserService,
               :UserTeamAssociationService, :WorkflowRequestService],
  :v201705 => [:ActivityGroupService, :ActivityService,
               :AdExclusionRuleService, :AdRuleService,
               :AudienceSegmentService, :BaseRateService, :CompanyService,
               :ContactService, :ContentBundleService,
               :ContentMetadataKeyHierarchyService, :ContentService,
               :CreativeService, :CreativeSetService,
               :CreativeTemplateService, :CreativeWrapperService,
               :CustomFieldService, :CustomTargetingService,
               :ExchangeRateService, :ForecastService, :InventoryService,
               :LabelService, :LineItemCreativeAssociationService,
               :LineItemService, :LineItemTemplateService,
               :LiveStreamEventService, :MobileApplicationService,
               :NativeStyleService, :NetworkService, :OrderService,
               :PackageService, :ProductPackageService,
               :ProductPackageItemService, :PlacementService,
               :PremiumRateService, :ProductService,
               :ProductTemplateService, :ProposalLineItemService,
               :ProposalService, :PublisherQueryLanguageService,
               :RateCardService, :ReconciliationOrderReportService,
               :ReconciliationLineItemReportService,
               :ReconciliationReportRowService,
               :ReconciliationReportService, :ReportService,
               :SuggestedAdUnitService, :TeamService, :UserService,
               :UserTeamAssociationService, :WorkflowRequestService],
  :v201708 => [:ActivityGroupService, :ActivityService,
               :AdExclusionRuleService, :AdRuleService,
               :AudienceSegmentService, :BaseRateService, :CompanyService,
               :ContactService, :ContentBundleService,
               :ContentMetadataKeyHierarchyService, :ContentService,
               :CreativeService, :CreativeSetService,
               :CreativeTemplateService, :CreativeWrapperService,
               :CustomFieldService, :CustomTargetingService,
               :ExchangeRateService, :ForecastService, :InventoryService,
               :LabelService, :LineItemCreativeAssociationService,
               :LineItemService, :LineItemTemplateService,
               :LiveStreamEventService, :MobileApplicationService,
               :NativeStyleService, :NetworkService, :OrderService,
               :PackageService, :ProductPackageService,
               :ProductPackageItemService, :PlacementService,
               :PremiumRateService, :ProductService,
               :ProductTemplateService, :ProposalLineItemService,
               :ProposalService, :PublisherQueryLanguageService,
               :RateCardService, :ReconciliationOrderReportService,
               :ReconciliationLineItemReportService,
               :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/',
    :v201611 => 'https://ads.google.com/apis/ads/publisher/',
    :v201702 => 'https://ads.google.com/apis/ads/publisher/',
    :v201705 => 'https://ads.google.com/apis/ads/publisher/',
    :v201708 => 'https://ads.google.com/apis/ads/publisher/',
  }
}

Class Method Summary collapse

Class Method Details

.api_name ⇒ Object



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

def self.api_name
  API_NAME
end

.default_config_filename ⇒ Object



186
187
188
# File 'lib/dfp_api/api_config.rb', line 186

def self.default_config_filename
  DEFAULT_CONFIG_FILENAME
end

.default_environment ⇒ Object



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

def self.default_environment
  DEFAULT_ENVIRONMENT
end

.default_version ⇒ Object

Getters for constants and module variables.



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

def self.default_version
  DEFAULT_VERSION
end

.environment_config(environment, key) ⇒ Object



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

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

.latest_version ⇒ Object



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

def self.latest_version
  LATEST_VERSION
end

.service_config ⇒ Object



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

def self.service_config
  @@service_config
end

.subdir_config ⇒ Object



182
183
184
# File 'lib/dfp_api/api_config.rb', line 182

def self.subdir_config
  nil
end