google-ads-googleads 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +7 -0
- data/Rakefile +6 -2
- data/google_ads_config.rb +19 -0
- data/lib/google/ads/google_ads/config.rb +11 -0
- data/lib/google/ads/google_ads/deprecation.rb +100 -0
- data/lib/google/ads/google_ads/factories/v1/enums.rb +1170 -1170
- data/lib/google/ads/google_ads/factories/v1/operations.rb +1269 -1269
- data/lib/google/ads/google_ads/factories/v1/resources.rb +2366 -2366
- data/lib/google/ads/google_ads/factories/v1/services.rb +310 -310
- data/lib/google/ads/google_ads/google_ads_client.rb +63 -78
- data/lib/google/ads/google_ads/service_lookup.rb +154 -0
- data/lib/google/ads/google_ads/v1/services/account_budget_proposal_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/account_budget_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_ad_label_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_ad_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_audience_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_bid_modifier_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_criterion_label_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_criterion_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_criterion_simulation_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_extension_setting_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_feed_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_label_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_group_simulation_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_parameter_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/ad_schedule_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/age_range_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/asset_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/bidding_strategy_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/billing_setup_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_audience_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_bid_modifier_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_budget_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_criterion_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_criterion_simulation_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_draft_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_experiment_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_extension_setting_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_feed_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_label_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/campaign_shared_set_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/carrier_constant_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/change_status_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/click_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/conversion_action_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/conversion_adjustment_upload_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/conversion_upload_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/custom_interest_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/customer_client_link_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/customer_client_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/customer_extension_setting_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/customer_feed_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/customer_label_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/customer_manager_link_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/customer_negative_criterion_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/customer_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/detail_placement_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/display_keyword_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/domain_category_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/dynamic_search_ads_search_term_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/expanded_landing_page_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/extension_feed_item_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/feed_item_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/feed_item_target_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/feed_mapping_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/feed_placeholder_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/feed_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/gender_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/geo_target_constant_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/geographic_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/google_ads_field_service_client_config.json +5 -5
- data/lib/google/ads/google_ads/v1/services/google_ads_service_client_config.json +5 -5
- data/lib/google/ads/google_ads/v1/services/group_placement_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/hotel_group_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/hotel_performance_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/keyword_plan_ad_group_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/keyword_plan_campaign_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/keyword_plan_idea_service_client_config.json +5 -5
- data/lib/google/ads/google_ads/v1/services/keyword_plan_keyword_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/keyword_plan_negative_keyword_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/keyword_plan_service_client_config.json +6 -6
- data/lib/google/ads/google_ads/v1/services/keyword_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/label_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/landing_page_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/language_constant_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/location_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/managed_placement_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/media_file_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/merchant_center_link_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/mobile_app_category_constant_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/mobile_device_constant_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/mutate_job_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/operating_system_version_constant_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/paid_organic_search_term_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/parental_status_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/payments_account_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/product_bidding_category_constant_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/product_group_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/recommendation_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/remarketing_action_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/search_term_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/shared_criterion_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/shared_set_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/shopping_performance_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/topic_constant_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/topic_view_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/user_interest_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/user_list_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/v1/services/video_service_client_config.json +4 -4
- data/lib/google/ads/google_ads/version.rb +1 -1
- metadata +5 -3
@@ -52,18 +52,24 @@ require 'google/ads/google_ads/wrapper_util'
|
|
52
52
|
require 'google/ads/google_ads/logging_interceptor'
|
53
53
|
require 'google/ads/google_ads/factories'
|
54
54
|
require 'google/ads/google_ads/errors'
|
55
|
-
require 'google/ads/google_ads/
|
55
|
+
require 'google/ads/google_ads/service_lookup'
|
56
|
+
require 'google/ads/google_ads/deprecation'
|
57
|
+
require 'google/ads/google_ads/v1/services/google_ads_service_client'
|
56
58
|
|
57
59
|
require 'google/gax'
|
58
60
|
|
59
61
|
require 'logger'
|
62
|
+
require 'json'
|
63
|
+
require 'openssl'
|
64
|
+
require 'signet/oauth_2/client'
|
60
65
|
|
61
66
|
module Google
|
62
67
|
module Ads
|
63
68
|
module GoogleAds
|
64
69
|
class GoogleAdsClient
|
65
70
|
|
66
|
-
DEFAULT_CONFIG_FILENAME =
|
71
|
+
DEFAULT_CONFIG_FILENAME = "google_ads_config.rb".freeze
|
72
|
+
SCOPE = "https://www.googleapis.com/auth/adwords".freeze
|
67
73
|
|
68
74
|
attr_reader :logger
|
69
75
|
# Allow setting the lookup_util manually for users who use it before creating the client.
|
@@ -116,80 +122,28 @@ module Google
|
|
116
122
|
def service(name=nil, version = default_api_version)
|
117
123
|
service_path = ENV['GOOGLEADS_SERVICE_PATH']
|
118
124
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
rescue ArgumentError => e
|
130
|
-
if e.message.start_with?("invalid value for Integer")
|
131
|
-
raise ArgumentError.new("Invalid value for login_customer_id, must be integer")
|
132
|
-
end
|
133
|
-
end
|
134
|
-
if login_customer_id <= 0 || login_customer_id > 9_999_999_999
|
135
|
-
raise ArgumentError.new(
|
136
|
-
"Invalid login_customer_id. Must be an integer " \
|
137
|
-
"0 < x <= 9,999,999,999. Got #{login_customer_id}"
|
138
|
-
)
|
139
|
-
end
|
140
|
-
headers[:"login-customer-id"] = login_customer_id.to_s # header values must be strings
|
141
|
-
end
|
142
|
-
|
143
|
-
if logger
|
144
|
-
logging_interceptor = Google::Ads::GoogleAds::LoggingInterceptor.new(logger)
|
145
|
-
end
|
146
|
-
|
147
|
-
if name.nil?
|
148
|
-
services = Factories.at_version(version).services.new(
|
149
|
-
service_path: service_path,
|
150
|
-
logging_interceptor: logging_interceptor,
|
151
|
-
credentials: get_updater_proc,
|
152
|
-
metadata: headers,
|
153
|
-
exception_transformer: ERROR_TRANSFORMER
|
154
|
-
)
|
155
|
-
|
156
|
-
patch_delegator = Class.new do
|
157
|
-
def initialize(services, headers, patch_callable)
|
158
|
-
@services = services
|
159
|
-
@headers = headers
|
160
|
-
@patch_callable = patch_callable
|
161
|
-
end
|
162
|
-
|
163
|
-
def respond_to_missing?(sym, include_private=false)
|
164
|
-
@services.respond_to?(sym, include_private)
|
165
|
-
end
|
166
|
-
|
167
|
-
def method_missing(name, *args)
|
168
|
-
@services.public_send(name, *args) do |cls|
|
169
|
-
@patch_callable.call(cls, @headers)
|
170
|
-
cls
|
171
|
-
end
|
172
|
-
end
|
173
|
-
end
|
174
|
-
patch_delegator.new(services, headers, method(:patch_lro_headers))
|
175
|
-
else
|
176
|
-
class_to_return = lookup_util.raw_service(name, version)
|
177
|
-
class_to_return = Class.new(class_to_return) do
|
178
|
-
unless service_path.nil? || service_path.empty?
|
179
|
-
const_set('SERVICE_ADDRESS', service_path.freeze)
|
180
|
-
end
|
125
|
+
ServiceLookup.new(
|
126
|
+
name,
|
127
|
+
version,
|
128
|
+
lookup_util,
|
129
|
+
service_path,
|
130
|
+
@logger,
|
131
|
+
@config,
|
132
|
+
make_channel,
|
133
|
+
).call
|
134
|
+
end
|
181
135
|
|
182
|
-
|
183
|
-
|
136
|
+
def make_channel
|
137
|
+
default_target = "googleads.googleapis.com:443"
|
138
|
+
target = ENV.fetch('GOOGLEADS_SERVICE_PATH', default_target)
|
184
139
|
|
185
|
-
|
140
|
+
channel_args = {
|
141
|
+
GRPC::Core::Channel::MAX_MESSAGE_LENGTH => 64*1000*1000
|
142
|
+
}
|
186
143
|
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
exception_transformer: ERROR_TRANSFORMER
|
191
|
-
)
|
192
|
-
end
|
144
|
+
call_creds = GRPC::Core::CallCredentials.new(get_credentials)
|
145
|
+
chan_creds = GRPC::Core::ChannelCredentials.new.compose(call_creds)
|
146
|
+
GRPC::Core::Channel.new(target, channel_args, chan_creds)
|
193
147
|
end
|
194
148
|
|
195
149
|
def patch_lro_headers(class_to_return, headers)
|
@@ -204,6 +158,7 @@ module Google
|
|
204
158
|
if name.nil?
|
205
159
|
Factories.at_version(version).resources
|
206
160
|
else
|
161
|
+
deprecate("Calling `google_ads_client.resource(<ResourceType>)` is deprecated, please use `google_ads_client.service.<resource_type>` instead")
|
207
162
|
lookup_util.resource(name, version)
|
208
163
|
end
|
209
164
|
end
|
@@ -216,6 +171,7 @@ module Google
|
|
216
171
|
if name.nil?
|
217
172
|
Factories.at_version(version).operations
|
218
173
|
else
|
174
|
+
deprecate("Calling `google_ads_client.resource(<OperationType>)` is deprecated, please use `google_ads_client.service.<operation_type>` instead")
|
219
175
|
lookup_util.operation(name, version)
|
220
176
|
end
|
221
177
|
end
|
@@ -229,6 +185,7 @@ module Google
|
|
229
185
|
if name.nil?
|
230
186
|
Factories.at_version(version).enums
|
231
187
|
else
|
188
|
+
deprecate("Calling `google_ads_client.resource(<EnumType>)` is deprecated, please use `google_ads_client.service.<enum_type>` instead")
|
232
189
|
lookup_util.enum(name, version)
|
233
190
|
end
|
234
191
|
end
|
@@ -292,9 +249,11 @@ module Google
|
|
292
249
|
raise gax_error
|
293
250
|
end
|
294
251
|
|
295
|
-
def get_credentials
|
252
|
+
def get_credentials
|
296
253
|
if @config.authentication
|
297
254
|
@config.authentication
|
255
|
+
elsif @config.keyfile
|
256
|
+
get_service_account_credentials
|
298
257
|
else
|
299
258
|
get_updater_proc
|
300
259
|
end
|
@@ -302,16 +261,34 @@ module Google
|
|
302
261
|
|
303
262
|
# Provides the service a method by which to obtain an access token to
|
304
263
|
# authenticate API requests.
|
305
|
-
def get_updater_proc
|
306
|
-
|
307
|
-
token_credential_uri:
|
264
|
+
def get_updater_proc
|
265
|
+
Signet::OAuth2::Client.new(
|
266
|
+
token_credential_uri: "https://www.googleapis.com/oauth2/v3/token",
|
308
267
|
client_id: @config.client_id,
|
309
268
|
client_secret: @config.client_secret,
|
310
269
|
refresh_token: @config.refresh_token,
|
311
|
-
scope: [
|
270
|
+
scope: [SCOPE]
|
312
271
|
).updater_proc
|
313
272
|
end
|
314
273
|
|
274
|
+
# Provides a Google::Auth::Credentials initialized with a keyfile
|
275
|
+
# specified in the config.
|
276
|
+
def get_service_account_credentials
|
277
|
+
raise 'config.impersonate required if keyfile specified' unless @config.impersonate
|
278
|
+
keyfile = File.read(@config.keyfile)
|
279
|
+
keyfile = JSON.parse(keyfile)
|
280
|
+
Google::Auth::Credentials.new(
|
281
|
+
Signet::OAuth2::Client.new(
|
282
|
+
token_credential_uri: "https://accounts.google.com/o/oauth2/token",
|
283
|
+
audience: "https://accounts.google.com/o/oauth2/token",
|
284
|
+
issuer: keyfile.fetch("client_email"),
|
285
|
+
signing_key: OpenSSL::PKey::RSA.new(keyfile.fetch("private_key")),
|
286
|
+
person: @config.impersonate,
|
287
|
+
scope: [SCOPE],
|
288
|
+
)
|
289
|
+
)
|
290
|
+
end
|
291
|
+
|
315
292
|
# Create the default logger, useful if the user hasn't defined one.
|
316
293
|
def create_default_logger()
|
317
294
|
if @config.logger.nil?
|
@@ -330,6 +307,14 @@ module Google
|
|
330
307
|
def default_api_version
|
331
308
|
Google::Ads::GoogleAds.default_api_version
|
332
309
|
end
|
310
|
+
|
311
|
+
def deprecate(deprecation)
|
312
|
+
@deprecation ||= Google::Ads::GoogleAds::Deprecation.new(
|
313
|
+
@config.treat_deprecation_warnings_as_errors,
|
314
|
+
@config.warn_on_all_deprecations,
|
315
|
+
)
|
316
|
+
@deprecation.deprecate(deprecation)
|
317
|
+
end
|
333
318
|
end
|
334
319
|
end
|
335
320
|
end
|
@@ -0,0 +1,154 @@
|
|
1
|
+
require 'google/ads/google_ads/patch_lro_headers'
|
2
|
+
|
3
|
+
module Google
|
4
|
+
module Ads
|
5
|
+
module GoogleAds
|
6
|
+
class ServiceLookup
|
7
|
+
def initialize(name, version, lookup_util, service_path, logger, config, credentials_or_channel)
|
8
|
+
@name = name
|
9
|
+
@version = version
|
10
|
+
@lookup_util = lookup_util
|
11
|
+
@service_path = service_path
|
12
|
+
@logger = logger
|
13
|
+
@config = config
|
14
|
+
@credentials_or_channel = credentials_or_channel
|
15
|
+
end
|
16
|
+
|
17
|
+
def call
|
18
|
+
if logger
|
19
|
+
logging_interceptor = Google::Ads::GoogleAds::LoggingInterceptor.new(logger)
|
20
|
+
end
|
21
|
+
|
22
|
+
if name.nil?
|
23
|
+
services = Factories.at_version(version).services.new(**{
|
24
|
+
service_path: service_path,
|
25
|
+
logging_interceptor: logging_interceptor,
|
26
|
+
}.merge(gax_service_params))
|
27
|
+
apply_patch_delegator(services)
|
28
|
+
else
|
29
|
+
class_to_return = lookup_util.raw_service(name, version)
|
30
|
+
setup_service_class(class_to_return)
|
31
|
+
class_to_return.new(
|
32
|
+
**gax_service_params
|
33
|
+
)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def gax_service_params
|
40
|
+
{
|
41
|
+
credentials: credentials_or_channel,
|
42
|
+
metadata: headers,
|
43
|
+
exception_transformer: ERROR_TRANSFORMER
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
def setup_service_class(service_class)
|
48
|
+
service_path = @service_path
|
49
|
+
logging_interceptor = @logging_interceptor
|
50
|
+
class_to_return = Class.new(service_class) do
|
51
|
+
unless service_path.nil? || service_path.empty?
|
52
|
+
const_set('SERVICE_ADDRESS', service_path.freeze)
|
53
|
+
end
|
54
|
+
|
55
|
+
const_set('GRPC_INTERCEPTORS', [logging_interceptor].compact)
|
56
|
+
end
|
57
|
+
|
58
|
+
patch_lro_headers(class_to_return)
|
59
|
+
end
|
60
|
+
|
61
|
+
def apply_patch_delegator(services)
|
62
|
+
patch_delegator = Class.new do
|
63
|
+
def initialize(services, patch_callable)
|
64
|
+
@services = services
|
65
|
+
@patch_callable = patch_callable
|
66
|
+
end
|
67
|
+
|
68
|
+
def respond_to_missing?(sym, include_private=false)
|
69
|
+
@services.respond_to?(sym, include_private)
|
70
|
+
end
|
71
|
+
|
72
|
+
def method_missing(name, *args)
|
73
|
+
@services.public_send(name, *args) do |cls|
|
74
|
+
@patch_callable.call(cls)
|
75
|
+
cls
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
patch_delegator.new(services, method(:patch_lro_headers))
|
80
|
+
end
|
81
|
+
|
82
|
+
def headers
|
83
|
+
headers = {
|
84
|
+
:"developer-token" => config.developer_token
|
85
|
+
}
|
86
|
+
|
87
|
+
if config.login_customer_id
|
88
|
+
validate_login_customer_id
|
89
|
+
headers[:"login-customer-id"] = config.login_customer_id.to_s # header values must be strings
|
90
|
+
end
|
91
|
+
|
92
|
+
headers
|
93
|
+
end
|
94
|
+
|
95
|
+
def patch_lro_headers(class_to_return)
|
96
|
+
PatchLROHeaders.new(class_to_return, headers).call
|
97
|
+
end
|
98
|
+
|
99
|
+
def validate_login_customer_id
|
100
|
+
begin
|
101
|
+
login_customer_id = Integer(config.login_customer_id)
|
102
|
+
rescue ArgumentError => e
|
103
|
+
if e.message.start_with?("invalid value for Integer")
|
104
|
+
raise ArgumentError.new("Invalid value for login_customer_id, must be integer")
|
105
|
+
end
|
106
|
+
end
|
107
|
+
if login_customer_id <= 0 || login_customer_id > 9_999_999_999
|
108
|
+
raise ArgumentError.new(
|
109
|
+
"Invalid login_customer_id. Must be an integer " \
|
110
|
+
"0 < x <= 9,999,999,999. Got #{login_customer_id}"
|
111
|
+
)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
ERROR_TRANSFORMER = Proc.new do |gax_error|
|
116
|
+
begin
|
117
|
+
gax_error.status_details.each do |detail|
|
118
|
+
# If there is an underlying GoogleAdsFailure, throw that one.
|
119
|
+
if detail.is_a?(
|
120
|
+
Google::Ads::GoogleAds::V1::Errors::GoogleAdsFailure)
|
121
|
+
raise Google::Ads::GoogleAds::Errors::GoogleAdsError.new(
|
122
|
+
detail)
|
123
|
+
end
|
124
|
+
if detail.is_a?(Google::Protobuf::Any)
|
125
|
+
type = Google::Protobuf::DescriptorPool.generated_pool.lookup(
|
126
|
+
detail.type_name).msgclass
|
127
|
+
failure = detail.unpack(type)
|
128
|
+
raise Google::Ads::GoogleAds::Errors::GoogleAdsError.new(
|
129
|
+
failure)
|
130
|
+
end
|
131
|
+
end
|
132
|
+
rescue Google::Ads::GoogleAds::Errors::GoogleAdsError
|
133
|
+
# If we raised this, bubble it out.
|
134
|
+
raise
|
135
|
+
rescue NoMethodError
|
136
|
+
# Sometimes status_details is just a String; in that case, we should
|
137
|
+
# just raise the original exception.
|
138
|
+
end
|
139
|
+
# If we don't find an error of the correct type, or if we run into an
|
140
|
+
# error while processing, just throw the original.
|
141
|
+
raise gax_error
|
142
|
+
end
|
143
|
+
|
144
|
+
attr_reader :name
|
145
|
+
attr_reader :version
|
146
|
+
attr_reader :service_path
|
147
|
+
attr_reader :logger
|
148
|
+
attr_reader :config
|
149
|
+
attr_reader :credentials_or_channel
|
150
|
+
attr_reader :lookup_util
|
151
|
+
end
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
data/lib/google/ads/google_ads/v1/services/account_budget_proposal_service_client_config.json
CHANGED
@@ -10,13 +10,13 @@
|
|
10
10
|
},
|
11
11
|
"retry_params": {
|
12
12
|
"default": {
|
13
|
-
"initial_retry_delay_millis":
|
13
|
+
"initial_retry_delay_millis": 5000,
|
14
14
|
"retry_delay_multiplier": 1.3,
|
15
15
|
"max_retry_delay_millis": 60000,
|
16
|
-
"initial_rpc_timeout_millis":
|
16
|
+
"initial_rpc_timeout_millis": 3600000,
|
17
17
|
"rpc_timeout_multiplier": 1.0,
|
18
|
-
"max_rpc_timeout_millis":
|
19
|
-
"total_timeout_millis":
|
18
|
+
"max_rpc_timeout_millis": 3600000,
|
19
|
+
"total_timeout_millis": 3600000
|
20
20
|
}
|
21
21
|
},
|
22
22
|
"methods": {
|
@@ -10,13 +10,13 @@
|
|
10
10
|
},
|
11
11
|
"retry_params": {
|
12
12
|
"default": {
|
13
|
-
"initial_retry_delay_millis":
|
13
|
+
"initial_retry_delay_millis": 5000,
|
14
14
|
"retry_delay_multiplier": 1.3,
|
15
15
|
"max_retry_delay_millis": 60000,
|
16
|
-
"initial_rpc_timeout_millis":
|
16
|
+
"initial_rpc_timeout_millis": 3600000,
|
17
17
|
"rpc_timeout_multiplier": 1.0,
|
18
|
-
"max_rpc_timeout_millis":
|
19
|
-
"total_timeout_millis":
|
18
|
+
"max_rpc_timeout_millis": 3600000,
|
19
|
+
"total_timeout_millis": 3600000
|
20
20
|
}
|
21
21
|
},
|
22
22
|
"methods": {
|
@@ -10,13 +10,13 @@
|
|
10
10
|
},
|
11
11
|
"retry_params": {
|
12
12
|
"default": {
|
13
|
-
"initial_retry_delay_millis":
|
13
|
+
"initial_retry_delay_millis": 5000,
|
14
14
|
"retry_delay_multiplier": 1.3,
|
15
15
|
"max_retry_delay_millis": 60000,
|
16
|
-
"initial_rpc_timeout_millis":
|
16
|
+
"initial_rpc_timeout_millis": 3600000,
|
17
17
|
"rpc_timeout_multiplier": 1.0,
|
18
|
-
"max_rpc_timeout_millis":
|
19
|
-
"total_timeout_millis":
|
18
|
+
"max_rpc_timeout_millis": 3600000,
|
19
|
+
"total_timeout_millis": 3600000
|
20
20
|
}
|
21
21
|
},
|
22
22
|
"methods": {
|
@@ -10,13 +10,13 @@
|
|
10
10
|
},
|
11
11
|
"retry_params": {
|
12
12
|
"default": {
|
13
|
-
"initial_retry_delay_millis":
|
13
|
+
"initial_retry_delay_millis": 5000,
|
14
14
|
"retry_delay_multiplier": 1.3,
|
15
15
|
"max_retry_delay_millis": 60000,
|
16
|
-
"initial_rpc_timeout_millis":
|
16
|
+
"initial_rpc_timeout_millis": 3600000,
|
17
17
|
"rpc_timeout_multiplier": 1.0,
|
18
|
-
"max_rpc_timeout_millis":
|
19
|
-
"total_timeout_millis":
|
18
|
+
"max_rpc_timeout_millis": 3600000,
|
19
|
+
"total_timeout_millis": 3600000
|
20
20
|
}
|
21
21
|
},
|
22
22
|
"methods": {
|
data/lib/google/ads/google_ads/v1/services/ad_group_audience_view_service_client_config.json
CHANGED
@@ -10,13 +10,13 @@
|
|
10
10
|
},
|
11
11
|
"retry_params": {
|
12
12
|
"default": {
|
13
|
-
"initial_retry_delay_millis":
|
13
|
+
"initial_retry_delay_millis": 5000,
|
14
14
|
"retry_delay_multiplier": 1.3,
|
15
15
|
"max_retry_delay_millis": 60000,
|
16
|
-
"initial_rpc_timeout_millis":
|
16
|
+
"initial_rpc_timeout_millis": 3600000,
|
17
17
|
"rpc_timeout_multiplier": 1.0,
|
18
|
-
"max_rpc_timeout_millis":
|
19
|
-
"total_timeout_millis":
|
18
|
+
"max_rpc_timeout_millis": 3600000,
|
19
|
+
"total_timeout_millis": 3600000
|
20
20
|
}
|
21
21
|
},
|
22
22
|
"methods": {
|