File Coverage

blib/lib/Google/Ads/AdWords/Constants.pm
Criterion Covered Total %
statement 57 57 100.0
branch n/a
condition n/a
subroutine 19 19 100.0
pod n/a
total 76 76 100.0


line stmt bran cond sub pod time code
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 14     14   968 use strict;
  14         38  
  14         420  
20 14     14   81 use warnings;
  14         30  
  14         383  
21 14     14   76 use version;
  14         28  
  14         75  
22              
23 14     14   5373 use File::HomeDir;
  14         62117  
  14         933  
24 14     14   3859 use File::Spec::Functions;
  14         9840  
  14         1748  
25              
26             # Main version number that the rest of the modules pick up off of.
27             our $VERSION = qv("4.17.0");
28              
29 14         125 use constant DEFAULT_PROPERTIES_FILE =>
30 14     14   109 catfile(File::HomeDir->my_home, "adwords.properties");
  14         30  
31 14     14   1599 use constant DEFAULT_USER_AGENT => "unknown";
  14         35  
  14         736  
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 14     14   86 use constant PROXY_FORMAT_STRING => "%s/api/adwords/%s/%s/%s";
  14         29  
  14         797  
36              
37             # Default current version used if the client is created without the version
38             # parameter.
39 14     14   95 use constant DEFAULT_VERSION => "v201708";
  14         32  
  14         714  
40              
41             # Default alternate URL that points to production servers.
42 14     14   86 use constant DEFAULT_ALTERNATE_URL => "https://adwords.google.com";
  14         27  
  14         720  
43              
44             # Default validation header value passed to the servers.
45 14     14   104 use constant DEFAULT_VALIDATE_ONLY => "false";
  14         41  
  14         640  
46              
47             # Default OAuth scope for AdWords
48 14     14   75 use constant DEFAULT_OAUTH_SCOPE => "https://www.googleapis.com/auth/adwords";
  14         26  
  14         685  
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 14     14   74 use constant MAX_NUM_OF_REQUEST_STATS => 500;
  14         25  
  14         2186  
53              
54             # Mapping of services to namespace group, required to figure out the service
55             # url endpoints.
56             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             AdwordsUserListService => "rm",
67             AlertService => "mcm",
68             BatchJobService => 'cm',
69             BiddingStrategyService => "cm",
70             BudgetOrderService => "billing",
71             BudgetService => "cm",
72             CampaignAdExtensionService => "cm",
73             CampaignBidModifierService => "cm",
74             CampaignCriterionService => "cm",
75             CampaignExtensionSettingService => "cm",
76             CampaignFeedService => "cm",
77             CampaignGroupService => "cm",
78             CampaignGroupPerformanceTargetService => "cm",
79             CampaignService => "cm",
80             CampaignSharedSetService => "cm",
81             ConstantDataService => "cm",
82             ConversionTrackerService => "cm",
83             CustomerService => "mcm",
84             CustomerExtensionSettingService => "cm",
85             CustomerFeedService => "cm",
86             CustomerSyncService => "ch",
87             DataService => "cm",
88             DraftAsyncErrorService => "cm",
89             DraftService => "cm",
90             ExperimentService => "cm",
91             FeedItemService => "cm",
92             FeedMappingService => "cm",
93             FeedService => "cm",
94             GeoLocationService => "cm",
95             LabelService => "cm",
96             LocationCriterionService => "cm",
97             ManagedCustomerService => "mcm",
98             MediaService => "cm",
99             OfflineCallConversionFeedService => "cm",
100             OfflineConversionFeedService => "cm",
101             OfflineDataUploadService => "rm",
102             ReportDefinitionService => "cm",
103             SharedCriterionService => "cm",
104             SharedSetService => "cm",
105             TargetingIdeaService => "o",
106             TrafficEstimatorService => "o",
107             TrialAsyncErrorService => "cm",
108             TrialService => "cm"
109             );
110              
111             # Useful constant to translate micros to dollars and viceversa.
112 14     14   98 use constant MICROS_PER_DOLLAR => 1000000;
  14         30  
  14         687  
113              
114             ########## Reporting Utilities ##########
115              
116 14     14   79 use constant ADHOC_REPORT_DOWNLOAD_URL => "%s/api/adwords/reportdownload/%s";
  14         95  
  14         631  
117 14     14   75 use constant LWP_DEFAULT_TIMEOUT => 300; # 5 minutes.
  14         24  
  14         673  
118 14     14   76 use constant REPORT_SCRUBBED_HEADERS => qw(DeveloperToken Authorization);
  14         28  
  14         767  
119              
120             ########## Paging Utilities ##########
121              
122             # A default number of entries to be retrieved per page.
123 14     14   80 use constant DEFAULT_PAGE_SIZE => 100;
  14         29  
  14         922  
124              
125             # Regular expression representing the LIMIT portion of an AWQL query.
126             # Group 1 => The SELECT clause before LIMIT
127             # Group 2 => Offset defined by LIMIT
128             # Group 3 => Page Size defined by LIMIT
129             # Example: LIMIT 1,3
130 14     14   81 use constant QUERY_LIMIT_REGEX => qr/(.*)LIMIT\s+(\d+)\s*,\s*(\d+).*/;
  14         26  
  14         769  
131              
132             return 1;