google-ads-googleads 2.1.1 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +2 -0
- data/lib/google/ads/google_ads/factories/v1/enums.rb +72 -0
- data/lib/google/ads/google_ads/factories/v1/operations.rb +125 -0
- data/lib/google/ads/google_ads/factories/v1/resources.rb +190 -86
- data/lib/google/ads/google_ads/factories/v1/services.rb +72 -0
- data/lib/google/ads/google_ads/google_ads_client.rb +12 -5
- data/lib/google/ads/google_ads/lookup_util.rb +1 -1
- data/lib/google/ads/google_ads/utils/v1/path_lookup_util.rb +14 -0
- data/lib/google/ads/google_ads/utils/v1/proto_lookup_util.rb +13 -0
- data/lib/google/ads/google_ads/v1/common/ad_type_infos_pb.rb +4 -0
- data/lib/google/ads/google_ads/v1/common/segments_pb.rb +4 -0
- data/lib/google/ads/google_ads/v1/common/simulation_pb.rb +16 -0
- data/lib/google/ads/google_ads/v1/enums/ad_group_type_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/enums/ad_type_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/enums/advertising_channel_sub_type_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/enums/bidding_strategy_type_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/enums/campaign_criterion_status_pb.rb +22 -0
- data/lib/google/ads/google_ads/v1/enums/campaign_draft_status_pb.rb +24 -0
- data/lib/google/ads/google_ads/v1/enums/campaign_experiment_status_pb.rb +28 -0
- data/lib/google/ads/google_ads/v1/enums/campaign_experiment_traffic_split_type_pb.rb +21 -0
- data/lib/google/ads/google_ads/v1/enums/click_type_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/enums/device_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/enums/google_ads_field_data_type_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/enums/hotel_rate_type_pb.rb +23 -0
- data/lib/google/ads/google_ads/v1/errors/bidding_error_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/errors/campaign_draft_error_pb.rb +29 -0
- data/lib/google/ads/google_ads/v1/errors/campaign_error_pb.rb +2 -0
- data/lib/google/ads/google_ads/v1/errors/campaign_experiment_error_pb.rb +29 -0
- data/lib/google/ads/google_ads/v1/errors/errors_pb.rb +8 -0
- data/lib/google/ads/google_ads/v1/errors/feed_error_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/errors/manager_link_error_pb.rb +33 -0
- data/lib/google/ads/google_ads/v1/errors/not_whitelisted_error_pb.rb +20 -0
- data/lib/google/ads/google_ads/v1/errors/url_field_error_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/resources/ad_group_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/resources/ad_group_simulation_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/resources/ad_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/resources/campaign_criterion_pb.rb +2 -0
- data/lib/google/ads/google_ads/v1/resources/campaign_draft_pb.rb +24 -0
- data/lib/google/ads/google_ads/v1/resources/campaign_experiment_pb.rb +29 -0
- data/lib/google/ads/google_ads/v1/resources/campaign_pb.rb +21 -20
- data/lib/google/ads/google_ads/v1/resources/extension_feed_item_pb.rb +5 -0
- data/lib/google/ads/google_ads/v1/resources/recommendation_pb.rb +21 -21
- data/lib/google/ads/google_ads/v1/services/asset_service_client.rb +3 -1
- data/lib/google/ads/google_ads/v1/services/asset_service_services_pb.rb +3 -1
- data/lib/google/ads/google_ads/v1/services/campaign_draft_service_client.rb +439 -0
- data/lib/google/ads/google_ads/v1/services/campaign_draft_service_client_config.json +46 -0
- data/lib/google/ads/google_ads/v1/services/campaign_draft_service_pb.rb +60 -0
- data/lib/google/ads/google_ads/v1/services/campaign_draft_service_services_pb.rb +59 -0
- data/lib/google/ads/google_ads/v1/services/campaign_experiment_service_client.rb +616 -0
- data/lib/google/ads/google_ads/v1/services/campaign_experiment_service_client_config.json +61 -0
- data/lib/google/ads/google_ads/v1/services/campaign_experiment_service_pb.rb +83 -0
- data/lib/google/ads/google_ads/v1/services/campaign_experiment_service_services_pb.rb +82 -0
- data/lib/google/ads/google_ads/v1/services/conversion_adjustment_upload_service_client.rb +6 -1
- data/lib/google/ads/google_ads/v1/services/conversion_adjustment_upload_service_pb.rb +1 -0
- data/lib/google/ads/google_ads/v1/services/conversion_upload_service_client.rb +12 -2
- data/lib/google/ads/google_ads/v1/services/conversion_upload_service_pb.rb +2 -0
- data/lib/google/ads/google_ads/v1/services/google_ads_service_pb.rb +10 -0
- data/lib/google/ads/google_ads/version.rb +1 -1
- metadata +21 -2
@@ -0,0 +1,616 @@
|
|
1
|
+
# Copyright 2019 Google LLC
|
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
|
+
# https://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
|
+
# EDITING INSTRUCTIONS
|
16
|
+
# This file was generated from the file
|
17
|
+
# https://github.com/googleapis/googleapis/blob/master/google/ads/google_ads/v1/services/campaign_experiment_service.proto,
|
18
|
+
# and updates to that file get reflected here through a refresh process.
|
19
|
+
# For the short term, the refresh process will only be runnable by Google
|
20
|
+
# engineers.
|
21
|
+
|
22
|
+
require "json"
|
23
|
+
require "pathname"
|
24
|
+
|
25
|
+
require "google/gax"
|
26
|
+
require "google/gax/operation"
|
27
|
+
require "google/longrunning/operations_client"
|
28
|
+
|
29
|
+
require "google/ads/google_ads/v1/services/campaign_experiment_service_pb"
|
30
|
+
require "google/ads/google_ads/v1/services/credentials"
|
31
|
+
|
32
|
+
module Google
|
33
|
+
module Ads
|
34
|
+
module GoogleAds
|
35
|
+
module V1
|
36
|
+
module Services
|
37
|
+
# CampaignExperimentService manages the life cycle of campaign experiments.
|
38
|
+
# It is used to create new experiments from drafts, modify experiment
|
39
|
+
# properties, promote changes in an experiment back to its base campaign,
|
40
|
+
# graduate experiments into new stand-alone campaigns, and to remove an
|
41
|
+
# experiment.
|
42
|
+
#
|
43
|
+
# An experiment consists of two variants or arms - the base campaign and the
|
44
|
+
# experiment campaign, directing a fixed share of traffic to each arm.
|
45
|
+
# A campaign experiment is created from a draft of changes to the base campaign
|
46
|
+
# and will be a snapshot of changes in the draft at the time of creation.
|
47
|
+
#
|
48
|
+
# @!attribute [r] campaign_experiment_service_stub
|
49
|
+
# @return [Google::Ads::GoogleAds::V1::Services::CampaignExperimentService::Stub]
|
50
|
+
class CampaignExperimentServiceClient
|
51
|
+
attr_reader :campaign_experiment_service_stub
|
52
|
+
|
53
|
+
# The default address of the service.
|
54
|
+
SERVICE_ADDRESS = "googleads.googleapis.com".freeze
|
55
|
+
|
56
|
+
# The default port of the service.
|
57
|
+
DEFAULT_SERVICE_PORT = 443
|
58
|
+
|
59
|
+
# The default set of gRPC interceptors.
|
60
|
+
GRPC_INTERCEPTORS = []
|
61
|
+
|
62
|
+
DEFAULT_TIMEOUT = 30
|
63
|
+
|
64
|
+
PAGE_DESCRIPTORS = {
|
65
|
+
"list_campaign_experiment_async_errors" => Google::Gax::PageDescriptor.new(
|
66
|
+
"page_token",
|
67
|
+
"next_page_token",
|
68
|
+
"errors")
|
69
|
+
}.freeze
|
70
|
+
|
71
|
+
private_constant :PAGE_DESCRIPTORS
|
72
|
+
|
73
|
+
# The scopes needed to make gRPC calls to all of the methods defined in
|
74
|
+
# this service.
|
75
|
+
ALL_SCOPES = [
|
76
|
+
].freeze
|
77
|
+
|
78
|
+
class OperationsClient < Google::Longrunning::OperationsClient
|
79
|
+
self::SERVICE_ADDRESS = CampaignExperimentServiceClient::SERVICE_ADDRESS
|
80
|
+
self::GRPC_INTERCEPTORS = CampaignExperimentServiceClient::GRPC_INTERCEPTORS
|
81
|
+
end
|
82
|
+
|
83
|
+
CAMPAIGN_EXPERIMENT_PATH_TEMPLATE = Google::Gax::PathTemplate.new(
|
84
|
+
"customers/{customer}/campaignExperiments/{campaign_experiment}"
|
85
|
+
)
|
86
|
+
|
87
|
+
private_constant :CAMPAIGN_EXPERIMENT_PATH_TEMPLATE
|
88
|
+
|
89
|
+
# Returns a fully-qualified campaign_experiment resource name string.
|
90
|
+
# @param customer [String]
|
91
|
+
# @param campaign_experiment [String]
|
92
|
+
# @return [String]
|
93
|
+
def self.campaign_experiment_path customer, campaign_experiment
|
94
|
+
CAMPAIGN_EXPERIMENT_PATH_TEMPLATE.render(
|
95
|
+
:"customer" => customer,
|
96
|
+
:"campaign_experiment" => campaign_experiment
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
# @param credentials [Google::Auth::Credentials, String, Hash, GRPC::Core::Channel, GRPC::Core::ChannelCredentials, Proc]
|
101
|
+
# Provides the means for authenticating requests made by the client. This parameter can
|
102
|
+
# be many types.
|
103
|
+
# A `Google::Auth::Credentials` uses a the properties of its represented keyfile for
|
104
|
+
# authenticating requests made by this client.
|
105
|
+
# A `String` will be treated as the path to the keyfile to be used for the construction of
|
106
|
+
# credentials for this client.
|
107
|
+
# A `Hash` will be treated as the contents of a keyfile to be used for the construction of
|
108
|
+
# credentials for this client.
|
109
|
+
# A `GRPC::Core::Channel` will be used to make calls through.
|
110
|
+
# A `GRPC::Core::ChannelCredentials` for the setting up the RPC client. The channel credentials
|
111
|
+
# should already be composed with a `GRPC::Core::CallCredentials` object.
|
112
|
+
# A `Proc` will be used as an updater_proc for the Grpc channel. The proc transforms the
|
113
|
+
# metadata for requests, generally, to give OAuth credentials.
|
114
|
+
# @param scopes [Array<String>]
|
115
|
+
# The OAuth scopes for this service. This parameter is ignored if
|
116
|
+
# an updater_proc is supplied.
|
117
|
+
# @param client_config [Hash]
|
118
|
+
# A Hash for call options for each method. See
|
119
|
+
# Google::Gax#construct_settings for the structure of
|
120
|
+
# this data. Falls back to the default config if not specified
|
121
|
+
# or the specified config is missing data points.
|
122
|
+
# @param timeout [Numeric]
|
123
|
+
# The default timeout, in seconds, for calls made through this client.
|
124
|
+
# @param metadata [Hash]
|
125
|
+
# Default metadata to be sent with each request. This can be overridden on a per call basis.
|
126
|
+
# @param exception_transformer [Proc]
|
127
|
+
# An optional proc that intercepts any exceptions raised during an API call to inject
|
128
|
+
# custom error handling.
|
129
|
+
def initialize \
|
130
|
+
credentials: nil,
|
131
|
+
scopes: ALL_SCOPES,
|
132
|
+
client_config: {},
|
133
|
+
timeout: DEFAULT_TIMEOUT,
|
134
|
+
metadata: nil,
|
135
|
+
exception_transformer: nil,
|
136
|
+
lib_name: nil,
|
137
|
+
lib_version: ""
|
138
|
+
# These require statements are intentionally placed here to initialize
|
139
|
+
# the gRPC module only when it's required.
|
140
|
+
# See https://github.com/googleapis/toolkit/issues/446
|
141
|
+
require "google/gax/grpc"
|
142
|
+
require "google/ads/google_ads/v1/services/campaign_experiment_service_services_pb"
|
143
|
+
|
144
|
+
credentials ||= Google::Ads::GoogleAds::V1::Services::Credentials.default
|
145
|
+
|
146
|
+
@operations_client = OperationsClient.new(
|
147
|
+
credentials: credentials,
|
148
|
+
scopes: scopes,
|
149
|
+
client_config: client_config,
|
150
|
+
timeout: timeout,
|
151
|
+
lib_name: lib_name,
|
152
|
+
lib_version: lib_version,
|
153
|
+
)
|
154
|
+
|
155
|
+
if credentials.is_a?(String) || credentials.is_a?(Hash)
|
156
|
+
updater_proc = Google::Ads::GoogleAds::V1::Services::Credentials.new(credentials).updater_proc
|
157
|
+
end
|
158
|
+
if credentials.is_a?(GRPC::Core::Channel)
|
159
|
+
channel = credentials
|
160
|
+
end
|
161
|
+
if credentials.is_a?(GRPC::Core::ChannelCredentials)
|
162
|
+
chan_creds = credentials
|
163
|
+
end
|
164
|
+
if credentials.is_a?(Proc)
|
165
|
+
updater_proc = credentials
|
166
|
+
end
|
167
|
+
if credentials.is_a?(Google::Auth::Credentials)
|
168
|
+
updater_proc = credentials.updater_proc
|
169
|
+
end
|
170
|
+
|
171
|
+
package_version = Gem.loaded_specs['google-ads-googleads'].version.version
|
172
|
+
|
173
|
+
google_api_client = "gl-ruby/#{RUBY_VERSION}"
|
174
|
+
google_api_client << " #{lib_name}/#{lib_version}" if lib_name
|
175
|
+
google_api_client << " gapic/#{package_version} gax/#{Google::Gax::VERSION}"
|
176
|
+
google_api_client << " grpc/#{GRPC::VERSION}"
|
177
|
+
google_api_client.freeze
|
178
|
+
|
179
|
+
headers = { :"x-goog-api-client" => google_api_client }
|
180
|
+
headers.merge!(metadata) unless metadata.nil?
|
181
|
+
client_config_file = Pathname.new(__dir__).join(
|
182
|
+
"campaign_experiment_service_client_config.json"
|
183
|
+
)
|
184
|
+
defaults = client_config_file.open do |f|
|
185
|
+
Google::Gax.construct_settings(
|
186
|
+
"google.ads.googleads.v1.services.CampaignExperimentService",
|
187
|
+
JSON.parse(f.read),
|
188
|
+
client_config,
|
189
|
+
Google::Gax::Grpc::STATUS_CODE_NAMES,
|
190
|
+
timeout,
|
191
|
+
page_descriptors: PAGE_DESCRIPTORS,
|
192
|
+
errors: Google::Gax::Grpc::API_ERRORS,
|
193
|
+
metadata: headers
|
194
|
+
)
|
195
|
+
end
|
196
|
+
|
197
|
+
# Allow overriding the service path/port in subclasses.
|
198
|
+
service_path = self.class::SERVICE_ADDRESS
|
199
|
+
port = self.class::DEFAULT_SERVICE_PORT
|
200
|
+
interceptors = self.class::GRPC_INTERCEPTORS
|
201
|
+
@campaign_experiment_service_stub = Google::Gax::Grpc.create_stub(
|
202
|
+
service_path,
|
203
|
+
port,
|
204
|
+
chan_creds: chan_creds,
|
205
|
+
channel: channel,
|
206
|
+
updater_proc: updater_proc,
|
207
|
+
scopes: scopes,
|
208
|
+
interceptors: interceptors,
|
209
|
+
&Google::Ads::GoogleAds::V1::Services::CampaignExperimentService::Stub.method(:new)
|
210
|
+
)
|
211
|
+
|
212
|
+
@get_campaign_experiment = Google::Gax.create_api_call(
|
213
|
+
@campaign_experiment_service_stub.method(:get_campaign_experiment),
|
214
|
+
defaults["get_campaign_experiment"],
|
215
|
+
exception_transformer: exception_transformer
|
216
|
+
)
|
217
|
+
@create_campaign_experiment = Google::Gax.create_api_call(
|
218
|
+
@campaign_experiment_service_stub.method(:create_campaign_experiment),
|
219
|
+
defaults["create_campaign_experiment"],
|
220
|
+
exception_transformer: exception_transformer
|
221
|
+
)
|
222
|
+
@mutate_campaign_experiments = Google::Gax.create_api_call(
|
223
|
+
@campaign_experiment_service_stub.method(:mutate_campaign_experiments),
|
224
|
+
defaults["mutate_campaign_experiments"],
|
225
|
+
exception_transformer: exception_transformer
|
226
|
+
)
|
227
|
+
@graduate_campaign_experiment = Google::Gax.create_api_call(
|
228
|
+
@campaign_experiment_service_stub.method(:graduate_campaign_experiment),
|
229
|
+
defaults["graduate_campaign_experiment"],
|
230
|
+
exception_transformer: exception_transformer
|
231
|
+
)
|
232
|
+
@promote_campaign_experiment = Google::Gax.create_api_call(
|
233
|
+
@campaign_experiment_service_stub.method(:promote_campaign_experiment),
|
234
|
+
defaults["promote_campaign_experiment"],
|
235
|
+
exception_transformer: exception_transformer
|
236
|
+
)
|
237
|
+
@end_campaign_experiment = Google::Gax.create_api_call(
|
238
|
+
@campaign_experiment_service_stub.method(:end_campaign_experiment),
|
239
|
+
defaults["end_campaign_experiment"],
|
240
|
+
exception_transformer: exception_transformer
|
241
|
+
)
|
242
|
+
@list_campaign_experiment_async_errors = Google::Gax.create_api_call(
|
243
|
+
@campaign_experiment_service_stub.method(:list_campaign_experiment_async_errors),
|
244
|
+
defaults["list_campaign_experiment_async_errors"],
|
245
|
+
exception_transformer: exception_transformer
|
246
|
+
)
|
247
|
+
end
|
248
|
+
|
249
|
+
# Service calls
|
250
|
+
|
251
|
+
# Returns the requested campaign experiment in full detail.
|
252
|
+
#
|
253
|
+
# @param resource_name [String]
|
254
|
+
# The resource name of the campaign experiment to fetch.
|
255
|
+
# @param options [Google::Gax::CallOptions]
|
256
|
+
# Overrides the default settings for this call, e.g, timeout,
|
257
|
+
# retries, etc.
|
258
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
259
|
+
# @yieldparam result [Google::Ads::GoogleAds::V1::Resources::CampaignExperiment]
|
260
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
261
|
+
# @return [Google::Ads::GoogleAds::V1::Resources::CampaignExperiment]
|
262
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
263
|
+
# @example
|
264
|
+
# require "google/ads/google_ads"
|
265
|
+
#
|
266
|
+
# campaign_experiment_client = Google::Ads::GoogleAds::CampaignExperiment.new(version: :v1)
|
267
|
+
# formatted_resource_name = Google::Ads::GoogleAds::V1::Services::CampaignExperimentServiceClient.campaign_experiment_path("[CUSTOMER]", "[CAMPAIGN_EXPERIMENT]")
|
268
|
+
# response = campaign_experiment_client.get_campaign_experiment(formatted_resource_name)
|
269
|
+
|
270
|
+
def get_campaign_experiment \
|
271
|
+
resource_name,
|
272
|
+
options: nil,
|
273
|
+
&block
|
274
|
+
req = {
|
275
|
+
resource_name: resource_name
|
276
|
+
}.delete_if { |_, v| v.nil? }
|
277
|
+
req = Google::Gax::to_proto(req, Google::Ads::GoogleAds::V1::Services::GetCampaignExperimentRequest)
|
278
|
+
@get_campaign_experiment.call(req, options, &block)
|
279
|
+
end
|
280
|
+
|
281
|
+
# Creates a campaign experiment based on a campaign draft. The draft campaign
|
282
|
+
# will be forked into a real campaign (called the experiment campaign) that
|
283
|
+
# will begin serving ads if successfully created.
|
284
|
+
#
|
285
|
+
# The campaign experiment is created immediately with status INITIALIZING.
|
286
|
+
# This method return a long running operation that tracks the forking of the
|
287
|
+
# draft campaign. If the forking fails, a list of errors can be retrieved
|
288
|
+
# using the ListCampaignExperimentAsyncErrors method. The operation's
|
289
|
+
# metadata will be a StringValue containing the resource name of the created
|
290
|
+
# campaign experiment.
|
291
|
+
#
|
292
|
+
# @param customer_id [String]
|
293
|
+
# The ID of the customer whose campaign experiment is being created.
|
294
|
+
# @param campaign_experiment [Google::Ads::GoogleAds::V1::Resources::CampaignExperiment | Hash]
|
295
|
+
# The campaign experiment to be created.
|
296
|
+
# A hash of the same form as `Google::Ads::GoogleAds::V1::Resources::CampaignExperiment`
|
297
|
+
# can also be provided.
|
298
|
+
# @param validate_only [true, false]
|
299
|
+
# If true, the request is validated but not executed. Only errors are
|
300
|
+
# returned, not results.
|
301
|
+
# @param options [Google::Gax::CallOptions]
|
302
|
+
# Overrides the default settings for this call, e.g, timeout,
|
303
|
+
# retries, etc.
|
304
|
+
# @return [Google::Gax::Operation]
|
305
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
306
|
+
# @example
|
307
|
+
# require "google/ads/google_ads"
|
308
|
+
#
|
309
|
+
# campaign_experiment_client = Google::Ads::GoogleAds::CampaignExperiment.new(version: :v1)
|
310
|
+
#
|
311
|
+
# # TODO: Initialize `customer_id`:
|
312
|
+
# customer_id = ''
|
313
|
+
#
|
314
|
+
# # TODO: Initialize `campaign_experiment`:
|
315
|
+
# campaign_experiment = {}
|
316
|
+
#
|
317
|
+
# # Register a callback during the method call.
|
318
|
+
# operation = campaign_experiment_client.create_campaign_experiment(customer_id, campaign_experiment) do |op|
|
319
|
+
# raise op.results.message if op.error?
|
320
|
+
# op_results = op.results
|
321
|
+
# # Process the results.
|
322
|
+
#
|
323
|
+
# metadata = op.metadata
|
324
|
+
# # Process the metadata.
|
325
|
+
# end
|
326
|
+
#
|
327
|
+
# # Or use the return value to register a callback.
|
328
|
+
# operation.on_done do |op|
|
329
|
+
# raise op.results.message if op.error?
|
330
|
+
# op_results = op.results
|
331
|
+
# # Process the results.
|
332
|
+
#
|
333
|
+
# metadata = op.metadata
|
334
|
+
# # Process the metadata.
|
335
|
+
# end
|
336
|
+
#
|
337
|
+
# # Manually reload the operation.
|
338
|
+
# operation.reload!
|
339
|
+
#
|
340
|
+
# # Or block until the operation completes, triggering callbacks on
|
341
|
+
# # completion.
|
342
|
+
# operation.wait_until_done!
|
343
|
+
|
344
|
+
def create_campaign_experiment \
|
345
|
+
customer_id,
|
346
|
+
campaign_experiment,
|
347
|
+
validate_only: nil,
|
348
|
+
options: nil
|
349
|
+
req = {
|
350
|
+
customer_id: customer_id,
|
351
|
+
campaign_experiment: campaign_experiment,
|
352
|
+
validate_only: validate_only
|
353
|
+
}.delete_if { |_, v| v.nil? }
|
354
|
+
req = Google::Gax::to_proto(req, Google::Ads::GoogleAds::V1::Services::CreateCampaignExperimentRequest)
|
355
|
+
operation = Google::Gax::Operation.new(
|
356
|
+
@create_campaign_experiment.call(req, options),
|
357
|
+
@operations_client,
|
358
|
+
Google::Protobuf::Empty,
|
359
|
+
Google::Ads::GoogleAds::V1::Services::CreateCampaignExperimentMetadata,
|
360
|
+
call_options: options
|
361
|
+
)
|
362
|
+
operation.on_done { |operation| yield(operation) } if block_given?
|
363
|
+
operation
|
364
|
+
end
|
365
|
+
|
366
|
+
# Updates campaign experiments. Operation statuses are returned.
|
367
|
+
#
|
368
|
+
# @param customer_id [String]
|
369
|
+
# The ID of the customer whose campaign experiments are being modified.
|
370
|
+
# @param operations [Array<Google::Ads::GoogleAds::V1::Services::CampaignExperimentOperation | Hash>]
|
371
|
+
# The list of operations to perform on individual campaign experiments.
|
372
|
+
# A hash of the same form as `Google::Ads::GoogleAds::V1::Services::CampaignExperimentOperation`
|
373
|
+
# can also be provided.
|
374
|
+
# @param partial_failure [true, false]
|
375
|
+
# If true, successful operations will be carried out and invalid
|
376
|
+
# operations will return errors. If false, all operations will be carried
|
377
|
+
# out in one transaction if and only if they are all valid.
|
378
|
+
# Default is false.
|
379
|
+
# @param validate_only [true, false]
|
380
|
+
# If true, the request is validated but not executed. Only errors are
|
381
|
+
# returned, not results.
|
382
|
+
# @param options [Google::Gax::CallOptions]
|
383
|
+
# Overrides the default settings for this call, e.g, timeout,
|
384
|
+
# retries, etc.
|
385
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
386
|
+
# @yieldparam result [Google::Ads::GoogleAds::V1::Services::MutateCampaignExperimentsResponse]
|
387
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
388
|
+
# @return [Google::Ads::GoogleAds::V1::Services::MutateCampaignExperimentsResponse]
|
389
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
390
|
+
# @example
|
391
|
+
# require "google/ads/google_ads"
|
392
|
+
#
|
393
|
+
# campaign_experiment_client = Google::Ads::GoogleAds::CampaignExperiment.new(version: :v1)
|
394
|
+
#
|
395
|
+
# # TODO: Initialize `customer_id`:
|
396
|
+
# customer_id = ''
|
397
|
+
#
|
398
|
+
# # TODO: Initialize `operations`:
|
399
|
+
# operations = []
|
400
|
+
# response = campaign_experiment_client.mutate_campaign_experiments(customer_id, operations)
|
401
|
+
|
402
|
+
def mutate_campaign_experiments \
|
403
|
+
customer_id,
|
404
|
+
operations,
|
405
|
+
partial_failure: nil,
|
406
|
+
validate_only: nil,
|
407
|
+
options: nil,
|
408
|
+
&block
|
409
|
+
req = {
|
410
|
+
customer_id: customer_id,
|
411
|
+
operations: operations,
|
412
|
+
partial_failure: partial_failure,
|
413
|
+
validate_only: validate_only
|
414
|
+
}.delete_if { |_, v| v.nil? }
|
415
|
+
req = Google::Gax::to_proto(req, Google::Ads::GoogleAds::V1::Services::MutateCampaignExperimentsRequest)
|
416
|
+
@mutate_campaign_experiments.call(req, options, &block)
|
417
|
+
end
|
418
|
+
|
419
|
+
# Graduates a campaign experiment to a full campaign. The base and experiment
|
420
|
+
# campaigns will start running independently with their own budgets.
|
421
|
+
#
|
422
|
+
# @param campaign_experiment [String]
|
423
|
+
# The resource name of the campaign experiment to graduate.
|
424
|
+
# @param campaign_budget [String]
|
425
|
+
# Resource name of the budget to attach to the campaign graduated from the
|
426
|
+
# experiment.
|
427
|
+
# @param options [Google::Gax::CallOptions]
|
428
|
+
# Overrides the default settings for this call, e.g, timeout,
|
429
|
+
# retries, etc.
|
430
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
431
|
+
# @yieldparam result [Google::Ads::GoogleAds::V1::Services::GraduateCampaignExperimentResponse]
|
432
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
433
|
+
# @return [Google::Ads::GoogleAds::V1::Services::GraduateCampaignExperimentResponse]
|
434
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
435
|
+
# @example
|
436
|
+
# require "google/ads/google_ads"
|
437
|
+
#
|
438
|
+
# campaign_experiment_client = Google::Ads::GoogleAds::CampaignExperiment.new(version: :v1)
|
439
|
+
# formatted_campaign_experiment = Google::Ads::GoogleAds::V1::Services::CampaignExperimentServiceClient.campaign_experiment_path("[CUSTOMER]", "[CAMPAIGN_EXPERIMENT]")
|
440
|
+
#
|
441
|
+
# # TODO: Initialize `campaign_budget`:
|
442
|
+
# campaign_budget = ''
|
443
|
+
# response = campaign_experiment_client.graduate_campaign_experiment(formatted_campaign_experiment, campaign_budget)
|
444
|
+
|
445
|
+
def graduate_campaign_experiment \
|
446
|
+
campaign_experiment,
|
447
|
+
campaign_budget,
|
448
|
+
options: nil,
|
449
|
+
&block
|
450
|
+
req = {
|
451
|
+
campaign_experiment: campaign_experiment,
|
452
|
+
campaign_budget: campaign_budget
|
453
|
+
}.delete_if { |_, v| v.nil? }
|
454
|
+
req = Google::Gax::to_proto(req, Google::Ads::GoogleAds::V1::Services::GraduateCampaignExperimentRequest)
|
455
|
+
@graduate_campaign_experiment.call(req, options, &block)
|
456
|
+
end
|
457
|
+
|
458
|
+
# Promotes the changes in a experiment campaign back to the base campaign.
|
459
|
+
#
|
460
|
+
# The campaign experiment is updated immediately with status PROMOTING.
|
461
|
+
# This method return a long running operation that tracks the promoting of
|
462
|
+
# the experiment campaign. If the promoting fails, a list of errors can be
|
463
|
+
# retrieved using the ListCampaignExperimentAsyncErrors method.
|
464
|
+
#
|
465
|
+
# @param campaign_experiment [String]
|
466
|
+
# The resource name of the campaign experiment to promote.
|
467
|
+
# @param options [Google::Gax::CallOptions]
|
468
|
+
# Overrides the default settings for this call, e.g, timeout,
|
469
|
+
# retries, etc.
|
470
|
+
# @return [Google::Gax::Operation]
|
471
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
472
|
+
# @example
|
473
|
+
# require "google/ads/google_ads"
|
474
|
+
#
|
475
|
+
# campaign_experiment_client = Google::Ads::GoogleAds::CampaignExperiment.new(version: :v1)
|
476
|
+
# formatted_campaign_experiment = Google::Ads::GoogleAds::V1::Services::CampaignExperimentServiceClient.campaign_experiment_path("[CUSTOMER]", "[CAMPAIGN_EXPERIMENT]")
|
477
|
+
#
|
478
|
+
# # Register a callback during the method call.
|
479
|
+
# operation = campaign_experiment_client.promote_campaign_experiment(formatted_campaign_experiment) do |op|
|
480
|
+
# raise op.results.message if op.error?
|
481
|
+
# op_results = op.results
|
482
|
+
# # Process the results.
|
483
|
+
#
|
484
|
+
# metadata = op.metadata
|
485
|
+
# # Process the metadata.
|
486
|
+
# end
|
487
|
+
#
|
488
|
+
# # Or use the return value to register a callback.
|
489
|
+
# operation.on_done do |op|
|
490
|
+
# raise op.results.message if op.error?
|
491
|
+
# op_results = op.results
|
492
|
+
# # Process the results.
|
493
|
+
#
|
494
|
+
# metadata = op.metadata
|
495
|
+
# # Process the metadata.
|
496
|
+
# end
|
497
|
+
#
|
498
|
+
# # Manually reload the operation.
|
499
|
+
# operation.reload!
|
500
|
+
#
|
501
|
+
# # Or block until the operation completes, triggering callbacks on
|
502
|
+
# # completion.
|
503
|
+
# operation.wait_until_done!
|
504
|
+
|
505
|
+
def promote_campaign_experiment \
|
506
|
+
campaign_experiment,
|
507
|
+
options: nil
|
508
|
+
req = {
|
509
|
+
campaign_experiment: campaign_experiment
|
510
|
+
}.delete_if { |_, v| v.nil? }
|
511
|
+
req = Google::Gax::to_proto(req, Google::Ads::GoogleAds::V1::Services::PromoteCampaignExperimentRequest)
|
512
|
+
operation = Google::Gax::Operation.new(
|
513
|
+
@promote_campaign_experiment.call(req, options),
|
514
|
+
@operations_client,
|
515
|
+
Google::Protobuf::Empty,
|
516
|
+
Google::Protobuf::Empty,
|
517
|
+
call_options: options
|
518
|
+
)
|
519
|
+
operation.on_done { |operation| yield(operation) } if block_given?
|
520
|
+
operation
|
521
|
+
end
|
522
|
+
|
523
|
+
# Immediately ends a campaign experiment, changing the experiment's scheduled
|
524
|
+
# end date and without waiting for end of day. End date is updated to be the
|
525
|
+
# time of the request.
|
526
|
+
#
|
527
|
+
# @param campaign_experiment [String]
|
528
|
+
# The resource name of the campaign experiment to end.
|
529
|
+
# @param options [Google::Gax::CallOptions]
|
530
|
+
# Overrides the default settings for this call, e.g, timeout,
|
531
|
+
# retries, etc.
|
532
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
533
|
+
# @yieldparam result []
|
534
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
535
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
536
|
+
# @example
|
537
|
+
# require "google/ads/google_ads"
|
538
|
+
#
|
539
|
+
# campaign_experiment_client = Google::Ads::GoogleAds::CampaignExperiment.new(version: :v1)
|
540
|
+
# formatted_campaign_experiment = Google::Ads::GoogleAds::V1::Services::CampaignExperimentServiceClient.campaign_experiment_path("[CUSTOMER]", "[CAMPAIGN_EXPERIMENT]")
|
541
|
+
# campaign_experiment_client.end_campaign_experiment(formatted_campaign_experiment)
|
542
|
+
|
543
|
+
def end_campaign_experiment \
|
544
|
+
campaign_experiment,
|
545
|
+
options: nil,
|
546
|
+
&block
|
547
|
+
req = {
|
548
|
+
campaign_experiment: campaign_experiment
|
549
|
+
}.delete_if { |_, v| v.nil? }
|
550
|
+
req = Google::Gax::to_proto(req, Google::Ads::GoogleAds::V1::Services::EndCampaignExperimentRequest)
|
551
|
+
@end_campaign_experiment.call(req, options, &block)
|
552
|
+
nil
|
553
|
+
end
|
554
|
+
|
555
|
+
# Returns all errors that occurred during CampaignExperiment create or
|
556
|
+
# promote (whichever occurred last).
|
557
|
+
# Supports standard list paging.
|
558
|
+
#
|
559
|
+
# @param resource_name [String]
|
560
|
+
# The name of the campaign experiment from which to retrieve the async
|
561
|
+
# errors.
|
562
|
+
# @param page_size [Integer]
|
563
|
+
# The maximum number of resources contained in the underlying API
|
564
|
+
# response. If page streaming is performed per-resource, this
|
565
|
+
# parameter does not affect the return value. If page streaming is
|
566
|
+
# performed per-page, this determines the maximum number of
|
567
|
+
# resources in a page.
|
568
|
+
# @param options [Google::Gax::CallOptions]
|
569
|
+
# Overrides the default settings for this call, e.g, timeout,
|
570
|
+
# retries, etc.
|
571
|
+
# @yield [result, operation] Access the result along with the RPC operation
|
572
|
+
# @yieldparam result [Google::Gax::PagedEnumerable<Google::Rpc::Status>]
|
573
|
+
# @yieldparam operation [GRPC::ActiveCall::Operation]
|
574
|
+
# @return [Google::Gax::PagedEnumerable<Google::Rpc::Status>]
|
575
|
+
# An enumerable of Google::Rpc::Status instances.
|
576
|
+
# See Google::Gax::PagedEnumerable documentation for other
|
577
|
+
# operations such as per-page iteration or access to the response
|
578
|
+
# object.
|
579
|
+
# @raise [Google::Gax::GaxError] if the RPC is aborted.
|
580
|
+
# @example
|
581
|
+
# require "google/ads/google_ads"
|
582
|
+
#
|
583
|
+
# campaign_experiment_client = Google::Ads::GoogleAds::CampaignExperiment.new(version: :v1)
|
584
|
+
# formatted_resource_name = Google::Ads::GoogleAds::V1::Services::CampaignExperimentServiceClient.campaign_experiment_path("[CUSTOMER]", "[CAMPAIGN_EXPERIMENT]")
|
585
|
+
#
|
586
|
+
# # Iterate over all results.
|
587
|
+
# campaign_experiment_client.list_campaign_experiment_async_errors(formatted_resource_name).each do |element|
|
588
|
+
# # Process element.
|
589
|
+
# end
|
590
|
+
#
|
591
|
+
# # Or iterate over results one page at a time.
|
592
|
+
# campaign_experiment_client.list_campaign_experiment_async_errors(formatted_resource_name).each_page do |page|
|
593
|
+
# # Process each page at a time.
|
594
|
+
# page.each do |element|
|
595
|
+
# # Process element.
|
596
|
+
# end
|
597
|
+
# end
|
598
|
+
|
599
|
+
def list_campaign_experiment_async_errors \
|
600
|
+
resource_name,
|
601
|
+
page_size: nil,
|
602
|
+
options: nil,
|
603
|
+
&block
|
604
|
+
req = {
|
605
|
+
resource_name: resource_name,
|
606
|
+
page_size: page_size
|
607
|
+
}.delete_if { |_, v| v.nil? }
|
608
|
+
req = Google::Gax::to_proto(req, Google::Ads::GoogleAds::V1::Services::ListCampaignExperimentAsyncErrorsRequest)
|
609
|
+
@list_campaign_experiment_async_errors.call(req, options, &block)
|
610
|
+
end
|
611
|
+
end
|
612
|
+
end
|
613
|
+
end
|
614
|
+
end
|
615
|
+
end
|
616
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
{
|
2
|
+
"interfaces": {
|
3
|
+
"google.ads.googleads.v1.services.CampaignExperimentService": {
|
4
|
+
"retry_codes": {
|
5
|
+
"idempotent": [
|
6
|
+
"DEADLINE_EXCEEDED",
|
7
|
+
"UNAVAILABLE"
|
8
|
+
],
|
9
|
+
"non_idempotent": []
|
10
|
+
},
|
11
|
+
"retry_params": {
|
12
|
+
"default": {
|
13
|
+
"initial_retry_delay_millis": 100,
|
14
|
+
"retry_delay_multiplier": 1.3,
|
15
|
+
"max_retry_delay_millis": 60000,
|
16
|
+
"initial_rpc_timeout_millis": 20000,
|
17
|
+
"rpc_timeout_multiplier": 1.0,
|
18
|
+
"max_rpc_timeout_millis": 20000,
|
19
|
+
"total_timeout_millis": 600000
|
20
|
+
}
|
21
|
+
},
|
22
|
+
"methods": {
|
23
|
+
"GetCampaignExperiment": {
|
24
|
+
"timeout_millis": 60000,
|
25
|
+
"retry_codes_name": "idempotent",
|
26
|
+
"retry_params_name": "default"
|
27
|
+
},
|
28
|
+
"CreateCampaignExperiment": {
|
29
|
+
"timeout_millis": 60000,
|
30
|
+
"retry_codes_name": "non_idempotent",
|
31
|
+
"retry_params_name": "default"
|
32
|
+
},
|
33
|
+
"MutateCampaignExperiments": {
|
34
|
+
"timeout_millis": 60000,
|
35
|
+
"retry_codes_name": "non_idempotent",
|
36
|
+
"retry_params_name": "default"
|
37
|
+
},
|
38
|
+
"GraduateCampaignExperiment": {
|
39
|
+
"timeout_millis": 60000,
|
40
|
+
"retry_codes_name": "non_idempotent",
|
41
|
+
"retry_params_name": "default"
|
42
|
+
},
|
43
|
+
"PromoteCampaignExperiment": {
|
44
|
+
"timeout_millis": 60000,
|
45
|
+
"retry_codes_name": "non_idempotent",
|
46
|
+
"retry_params_name": "default"
|
47
|
+
},
|
48
|
+
"EndCampaignExperiment": {
|
49
|
+
"timeout_millis": 60000,
|
50
|
+
"retry_codes_name": "non_idempotent",
|
51
|
+
"retry_params_name": "default"
|
52
|
+
},
|
53
|
+
"ListCampaignExperimentAsyncErrors": {
|
54
|
+
"timeout_millis": 60000,
|
55
|
+
"retry_codes_name": "idempotent",
|
56
|
+
"retry_params_name": "default"
|
57
|
+
}
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|