Module: DfpApi::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.

Defined Under Namespace

Classes: ApiConfig

Constant Summary collapse

CLIENT_LIB_VERSION =
'0.6.3'
DEFAULT_VERSION =

Set defaults

:v201306
DEFAULT_ENVIRONMENT =
:PRODUCTION
LATEST_VERSION =
:v201306
API_NAME =

Set other constants

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

Configure the services available to each version

{
  :v201203 => [:CompanyService, :CreativeService, :ForecastService,
               :InventoryService, :LineItemCreativeAssociationService,
               :LineItemService, :NetworkService, :OrderService,
               :PlacementService, :ReportService, :UserService,
               :CustomTargetingService, :PublisherQueryLanguageService,
               :LabelService, :ThirdPartySlotService, :ContentService,
               :SuggestedAdUnitService, :CreativeTemplateService,
               :TeamService, :AudienceSegmentService],
  :v201204 => [:CompanyService, :CreativeService, :ForecastService,
               :InventoryService, :LineItemCreativeAssociationService,
               :LineItemService, :NetworkService, :OrderService,
               :PlacementService, :ReportService, :UserService,
               :CustomTargetingService, :PublisherQueryLanguageService,
               :LabelService, :ThirdPartySlotService, :ContentService,
               :SuggestedAdUnitService, :CreativeTemplateService,
               :TeamService, :AudienceSegmentService, :CustomFieldService,
               :UserTeamAssociationService],
  :v201206 => [:CompanyService, :CreativeService, :ForecastService,
               :InventoryService, :LineItemCreativeAssociationService,
               :LineItemService, :NetworkService, :OrderService,
               :PlacementService, :ReportService, :UserService,
               :CustomTargetingService, :PublisherQueryLanguageService,
               :LabelService, :ThirdPartySlotService, :ContentService,
               :SuggestedAdUnitService, :CreativeTemplateService,
               :TeamService, :AudienceSegmentService, :CustomFieldService,
               :UserTeamAssociationService, :CreativeSetService],
  :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]
}
@@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/',
    :v201203 => 'https://www.google.com/apis/ads/publisher/',
    :v201204 => 'https://www.google.com/apis/ads/publisher/',
    :v201206 => '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/'
  }
}
@@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



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

def self.api_name
  API_NAME
end

.client_login_config(key) ⇒ Object



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

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

.default_config_filename ⇒ Object



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

def self.default_config_filename
  DEFAULT_CONFIG_FILENAME
end

.default_environment ⇒ Object



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

def self.default_environment
  DEFAULT_ENVIRONMENT
end

.default_version ⇒ Object

Getters for constants and module variables.



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

def self.default_version
  DEFAULT_VERSION
end

.environment_config(environment, key) ⇒ Object



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

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

.latest_version ⇒ Object



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

def self.latest_version
  LATEST_VERSION
end

.service_config ⇒ Object



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

def self.service_config
  @@service_config
end

.subdir_config ⇒ Object



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

def self.subdir_config
  nil
end