| 1 | # Copyright 2011, Google Inc. All Rights Reserved. | ||
| 2 | # | ||
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 4 | # you may not use this file except in compliance with the License. | ||
| 5 | # You may obtain a copy of the License at | ||
| 6 | # | ||
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
| 8 | # | ||
| 9 | # Unless required by applicable law or agreed to in writing, software | ||
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| 12 | # See the License for the specific language governing permissions and | ||
| 13 | # limitations under the License. | ||
| 14 | # | ||
| 15 | # Module to store package-level constants and default values. | ||
| 16 | |||
| 17 | package Google::Ads::AdWords::Constants; | ||
| 18 | |||
| 19 | 16 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 20 | 16 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 21 | 16 | ▶ | use version; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | 16 | ▶ | use File::HomeDir; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 24 | 16 | ▶ | use File::Spec::Functions; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 25 | |||
| 26 | # Main version number that the rest of the modules pick up off of. | ||
| 27 | 16 | our $VERSION = qv("5.8.2"); | |
| 28 | |||
| 29 | 16 | ▶ | use constant DEFAULT_PROPERTIES_FILE => |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 30 | 16 | catfile(File::HomeDir->my_home, "adwords.properties"); | |
| 31 | 16 | ▶ | use constant DEFAULT_USER_AGENT => "unknown"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 32 | |||
| 33 | # In this format string, the first %s is the URL prefix, the second is the | ||
| 34 | # version, and the third is service name. | ||
| 35 | 16 | ▶ | use constant PROXY_FORMAT_STRING => "%s/api/adwords/%s/%s/%s"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 36 | |||
| 37 | # Default current version used if the client is created without the version | ||
| 38 | # parameter. | ||
| 39 | 16 | ▶ | use constant DEFAULT_VERSION => "v201809"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 40 | |||
| 41 | # Default alternate URL that points to production servers. | ||
| 42 | 16 | ▶ | use constant DEFAULT_ALTERNATE_URL => "https://adwords.google.com"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 43 | |||
| 44 | # Default validation header value passed to the servers. | ||
| 45 | 16 | ▶ | use constant DEFAULT_VALIDATE_ONLY => "false"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 46 | |||
| 47 | # Default OAuth scope for AdWords | ||
| 48 | 16 | ▶ | use constant DEFAULT_OAUTH_SCOPE => "https://www.googleapis.com/auth/adwords"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 49 | |||
| 50 | # Maximum number of request stats to keep in memory, any overflow will result | ||
| 51 | # on droppping older requests stats out of memory. | ||
| 52 | 16 | ▶ | use constant MAX_NUM_OF_REQUEST_STATS => 500; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 53 | |||
| 54 | # Mapping of services to namespace group, required to figure out the service | ||
| 55 | # url endpoints. | ||
| 56 | 16 | our %SERVICE_TO_GROUP = ( | |
| 57 | AccountLabelService => "mcm", | ||
| 58 | AdCustomizerFeedService => "cm", | ||
| 59 | AdGroupAdService => "cm", | ||
| 60 | AdGroupBidModifierService => "cm", | ||
| 61 | AdGroupCriterionService => "cm", | ||
| 62 | AdGroupExtensionSettingService => "cm", | ||
| 63 | AdGroupFeedService => "cm", | ||
| 64 | AdGroupService => "cm", | ||
| 65 | AdParamService => "cm", | ||
| 66 | AdService => "cm", | ||
| 67 | AdwordsUserListService => "rm", | ||
| 68 | AlertService => "mcm", | ||
| 69 | AssetService => "cm", | ||
| 70 | BatchJobService => 'cm', | ||
| 71 | BiddingStrategyService => "cm", | ||
| 72 | BudgetOrderService => "billing", | ||
| 73 | BudgetService => "cm", | ||
| 74 | CampaignAdExtensionService => "cm", | ||
| 75 | CampaignBidModifierService => "cm", | ||
| 76 | CampaignCriterionService => "cm", | ||
| 77 | CampaignExtensionSettingService => "cm", | ||
| 78 | CampaignFeedService => "cm", | ||
| 79 | CampaignGroupService => "cm", | ||
| 80 | CampaignGroupPerformanceTargetService => "cm", | ||
| 81 | CampaignService => "cm", | ||
| 82 | CampaignSharedSetService => "cm", | ||
| 83 | ConstantDataService => "cm", | ||
| 84 | ConversionTrackerService => "cm", | ||
| 85 | CustomAffinityService => "rm", | ||
| 86 | CustomerService => "mcm", | ||
| 87 | CustomerExtensionSettingService => "cm", | ||
| 88 | CustomerFeedService => "cm", | ||
| 89 | CustomerSyncService => "ch", | ||
| 90 | CustomerNegativeCriterionService => "cm", | ||
| 91 | DataService => "cm", | ||
| 92 | DraftAsyncErrorService => "cm", | ||
| 93 | DraftService => "cm", | ||
| 94 | ExperimentService => "cm", | ||
| 95 | FeedItemService => "cm", | ||
| 96 | FeedItemTargetService => "cm", | ||
| 97 | FeedMappingService => "cm", | ||
| 98 | FeedService => "cm", | ||
| 99 | GeoLocationService => "cm", | ||
| 100 | LabelService => "cm", | ||
| 101 | LocationCriterionService => "cm", | ||
| 102 | ManagedCustomerService => "mcm", | ||
| 103 | MediaService => "cm", | ||
| 104 | OfflineCallConversionFeedService => "cm", | ||
| 105 | OfflineConversionAdjustmentFeedService => "cm", | ||
| 106 | OfflineConversionFeedService => "cm", | ||
| 107 | OfflineDataUploadService => "rm", | ||
| 108 | ReportDefinitionService => "cm", | ||
| 109 | SharedCriterionService => "cm", | ||
| 110 | SharedSetService => "cm", | ||
| 111 | TargetingIdeaService => "o", | ||
| 112 | TrafficEstimatorService => "o", | ||
| 113 | TrialAsyncErrorService => "cm", | ||
| 114 | TrialService => "cm" | ||
| 115 | ); | ||
| 116 | |||
| 117 | # Useful constant to translate micros to dollars and viceversa. | ||
| 118 | 16 | ▶ | use constant MICROS_PER_DOLLAR => 1000000; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 119 | |||
| 120 | ########## Reporting Utilities ########## | ||
| 121 | |||
| 122 | 16 | ▶ | use constant ADHOC_REPORT_DOWNLOAD_URL => "%s/api/adwords/reportdownload/%s"; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 123 | 16 | ▶ | use constant LWP_DEFAULT_TIMEOUT => 300; # 5 minutes. |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 124 | 16 | ▶ | use constant REPORT_SCRUBBED_HEADERS => qw(DeveloperToken Authorization); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 125 | |||
| 126 | ########## Paging Utilities ########## | ||
| 127 | |||
| 128 | # A default number of entries to be retrieved per page. | ||
| 129 | 16 | ▶ | use constant DEFAULT_PAGE_SIZE => 100; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 130 | |||
| 131 | # Regular expression representing the LIMIT portion of an AWQL query. | ||
| 132 | # Group 1 => The SELECT clause before LIMIT | ||
| 133 | # Group 2 => Offset defined by LIMIT | ||
| 134 | # Group 3 => Page Size defined by LIMIT | ||
| 135 | # Example: LIMIT 1,3 | ||
| 136 | 16 | ▶ | use constant QUERY_LIMIT_REGEX => qr/(.*)LIMIT\s+(\d+)\s*,\s*(\d+).*/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 137 | |||
| 138 | 16 | return 1; | |