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 13     13   82 use strict;
  13         23  
  13         373  
20 13     13   84 use warnings;
  13         26  
  13         363  
21 13     13   66 use version;
  13         22  
  13         58  
22              
23 13     13   4555 use File::HomeDir;
  13         56182  
  13         800  
24 13     13   3439 use File::Spec::Functions;
  13         9899  
  13         1364  
25              
26             # Main version number that the rest of the modules pick up off of.
27             our $VERSION = qv("4.16.0");
28              
29 13         78 use constant DEFAULT_PROPERTIES_FILE =>
30 13     13   90 catfile(File::HomeDir->my_home, "adwords.properties");
  13         27  
31 13     13   1276 use constant DEFAULT_USER_AGENT => "unknown";
  13         57  
  13         737  
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 13     13   84 use constant PROXY_FORMAT_STRING => "%s/api/adwords/%s/%s/%s";
  13         23  
  13         1612  
36              
37             # Default current version used if the client is created without the version
38             # parameter.
39 13     13   79 use constant DEFAULT_VERSION => "v201708";
  13         27  
  13         648  
40              
41             # Default alternate URL that points to production servers.
42 13     13   77 use constant DEFAULT_ALTERNATE_URL => "https://adwords.google.com";
  13         21  
  13         636  
43              
44             # Default validation header value passed to the servers.
45 13     13   76 use constant DEFAULT_VALIDATE_ONLY => "false";
  13         25  
  13         580  
46              
47             # Default OAuth scope for AdWords
48 13     13   72 use constant DEFAULT_OAUTH_SCOPE => "https://www.googleapis.com/auth/adwords";
  13         23  
  13         631  
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 13     13   72 use constant MAX_NUM_OF_REQUEST_STATS => 500;
  13         37  
  13         2683  
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 13     13   84 use constant MICROS_PER_DOLLAR => 1000000;
  13         23  
  13         589  
113              
114             ########## Reporting Utilities ##########
115              
116 13     13   68 use constant ADHOC_REPORT_DOWNLOAD_URL => "%s/api/adwords/reportdownload/%s";
  13         23  
  13         565  
117 13     13   68 use constant LWP_DEFAULT_TIMEOUT => 300; # 5 minutes.
  13         20  
  13         537  
118 13     13   73 use constant REPORT_SCRUBBED_HEADERS => qw(DeveloperToken Authorization);
  13         27  
  13         636  
119              
120             ########## Paging Utilities ##########
121              
122             # A default number of entries to be retrieved per page.
123 13     13   67 use constant DEFAULT_PAGE_SIZE => 100;
  13         19  
  13         900  
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 13     13   102 use constant QUERY_LIMIT_REGEX => qr/(.*)LIMIT\s+(\d+)\s*,\s*(\d+).*/;
  13         52  
  13         749  
131              
132             return 1;