google-shopping-merchant-accounts-v1beta 0.6.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google/shopping/merchant/accounts/v1beta/automatic_improvements_service/client.rb +570 -0
- data/lib/google/shopping/merchant/accounts/v1beta/automatic_improvements_service/credentials.rb +49 -0
- data/lib/google/shopping/merchant/accounts/v1beta/automatic_improvements_service/paths.rb +49 -0
- data/lib/google/shopping/merchant/accounts/v1beta/automatic_improvements_service/rest/client.rb +530 -0
- data/lib/google/shopping/merchant/accounts/v1beta/automatic_improvements_service/rest/service_stub.rb +206 -0
- data/lib/google/shopping/merchant/accounts/v1beta/automatic_improvements_service/rest.rb +56 -0
- data/lib/google/shopping/merchant/accounts/v1beta/automatic_improvements_service.rb +59 -0
- data/lib/google/shopping/merchant/accounts/v1beta/automaticimprovements_pb.rb +58 -0
- data/lib/google/shopping/merchant/accounts/v1beta/automaticimprovements_services_pb.rb +51 -0
- data/lib/google/shopping/merchant/accounts/v1beta/rest.rb +1 -0
- data/lib/google/shopping/merchant/accounts/v1beta/version.rb +1 -1
- data/lib/google/shopping/merchant/accounts/v1beta.rb +1 -0
- data/proto_docs/google/shopping/merchant/accounts/v1beta/automaticimprovements.rb +235 -0
- metadata +12 -2
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
|
20
|
+
module Google
|
21
|
+
module Shopping
|
22
|
+
module Merchant
|
23
|
+
module Accounts
|
24
|
+
module V1beta
|
25
|
+
module AutomaticImprovementsService
|
26
|
+
# Path helper methods for the AutomaticImprovementsService API.
|
27
|
+
module Paths
|
28
|
+
##
|
29
|
+
# Create a fully-qualified AutomaticImprovements resource string.
|
30
|
+
#
|
31
|
+
# The resource will be in the following format:
|
32
|
+
#
|
33
|
+
# `accounts/{account}/automaticImprovements`
|
34
|
+
#
|
35
|
+
# @param account [String]
|
36
|
+
#
|
37
|
+
# @return [::String]
|
38
|
+
def automatic_improvements_path account:
|
39
|
+
"accounts/#{account}/automaticImprovements"
|
40
|
+
end
|
41
|
+
|
42
|
+
extend self
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/google/shopping/merchant/accounts/v1beta/automatic_improvements_service/rest/client.rb
ADDED
@@ -0,0 +1,530 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2025 Google LLC
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
+
# you may not use this file except in compliance with the License.
|
7
|
+
# You may obtain a copy of the License at
|
8
|
+
#
|
9
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
# See the License for the specific language governing permissions and
|
15
|
+
# limitations under the License.
|
16
|
+
|
17
|
+
# Auto-generated by gapic-generator-ruby. DO NOT EDIT!
|
18
|
+
|
19
|
+
require "google/cloud/errors"
|
20
|
+
require "google/shopping/merchant/accounts/v1beta/automaticimprovements_pb"
|
21
|
+
require "google/shopping/merchant/accounts/v1beta/automatic_improvements_service/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Shopping
|
25
|
+
module Merchant
|
26
|
+
module Accounts
|
27
|
+
module V1beta
|
28
|
+
module AutomaticImprovementsService
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the AutomaticImprovementsService service.
|
32
|
+
#
|
33
|
+
# Service to manage the automatic improvements of an account. The automatic
|
34
|
+
# improvements of the account can be used to automatically update products,
|
35
|
+
# improve images and shipping.
|
36
|
+
#
|
37
|
+
class Client
|
38
|
+
# @private
|
39
|
+
API_VERSION = ""
|
40
|
+
|
41
|
+
# @private
|
42
|
+
DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
|
43
|
+
|
44
|
+
include Paths
|
45
|
+
|
46
|
+
# @private
|
47
|
+
attr_reader :automatic_improvements_service_stub
|
48
|
+
|
49
|
+
##
|
50
|
+
# Configure the AutomaticImprovementsService Client class.
|
51
|
+
#
|
52
|
+
# See {::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::Client::Configuration}
|
53
|
+
# for a description of the configuration fields.
|
54
|
+
#
|
55
|
+
# @example
|
56
|
+
#
|
57
|
+
# # Modify the configuration for all AutomaticImprovementsService clients
|
58
|
+
# ::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::Client.configure do |config|
|
59
|
+
# config.timeout = 10.0
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# @yield [config] Configure the Client client.
|
63
|
+
# @yieldparam config [Client::Configuration]
|
64
|
+
#
|
65
|
+
# @return [Client::Configuration]
|
66
|
+
#
|
67
|
+
def self.configure
|
68
|
+
@configure ||= begin
|
69
|
+
namespace = ["Google", "Shopping", "Merchant", "Accounts", "V1beta"]
|
70
|
+
parent_config = while namespace.any?
|
71
|
+
parent_name = namespace.join "::"
|
72
|
+
parent_const = const_get parent_name
|
73
|
+
break parent_const.configure if parent_const.respond_to? :configure
|
74
|
+
namespace.pop
|
75
|
+
end
|
76
|
+
default_config = Client::Configuration.new parent_config
|
77
|
+
|
78
|
+
default_config.timeout = 60.0
|
79
|
+
default_config.retry_policy = {
|
80
|
+
initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
|
81
|
+
}
|
82
|
+
|
83
|
+
default_config
|
84
|
+
end
|
85
|
+
yield @configure if block_given?
|
86
|
+
@configure
|
87
|
+
end
|
88
|
+
|
89
|
+
##
|
90
|
+
# Configure the AutomaticImprovementsService Client instance.
|
91
|
+
#
|
92
|
+
# The configuration is set to the derived mode, meaning that values can be changed,
|
93
|
+
# but structural changes (adding new fields, etc.) are not allowed. Structural changes
|
94
|
+
# should be made on {Client.configure}.
|
95
|
+
#
|
96
|
+
# See {::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::Client::Configuration}
|
97
|
+
# for a description of the configuration fields.
|
98
|
+
#
|
99
|
+
# @yield [config] Configure the Client client.
|
100
|
+
# @yieldparam config [Client::Configuration]
|
101
|
+
#
|
102
|
+
# @return [Client::Configuration]
|
103
|
+
#
|
104
|
+
def configure
|
105
|
+
yield @config if block_given?
|
106
|
+
@config
|
107
|
+
end
|
108
|
+
|
109
|
+
##
|
110
|
+
# The effective universe domain
|
111
|
+
#
|
112
|
+
# @return [String]
|
113
|
+
#
|
114
|
+
def universe_domain
|
115
|
+
@automatic_improvements_service_stub.universe_domain
|
116
|
+
end
|
117
|
+
|
118
|
+
##
|
119
|
+
# Create a new AutomaticImprovementsService REST client object.
|
120
|
+
#
|
121
|
+
# @example
|
122
|
+
#
|
123
|
+
# # Create a client using the default configuration
|
124
|
+
# client = ::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::Client.new
|
125
|
+
#
|
126
|
+
# # Create a client using a custom configuration
|
127
|
+
# client = ::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::Client.new do |config|
|
128
|
+
# config.timeout = 10.0
|
129
|
+
# end
|
130
|
+
#
|
131
|
+
# @yield [config] Configure the AutomaticImprovementsService client.
|
132
|
+
# @yieldparam config [Client::Configuration]
|
133
|
+
#
|
134
|
+
def initialize
|
135
|
+
# Create the configuration object
|
136
|
+
@config = Configuration.new Client.configure
|
137
|
+
|
138
|
+
# Yield the configuration if needed
|
139
|
+
yield @config if block_given?
|
140
|
+
|
141
|
+
# Create credentials
|
142
|
+
credentials = @config.credentials
|
143
|
+
# Use self-signed JWT if the endpoint is unchanged from default,
|
144
|
+
# but only if the default endpoint does not have a region prefix.
|
145
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
146
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
147
|
+
!@config.endpoint.split(".").first.include?("-"))
|
148
|
+
credentials ||= Credentials.default scope: @config.scope,
|
149
|
+
enable_self_signed_jwt: enable_self_signed_jwt
|
150
|
+
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
151
|
+
credentials = Credentials.new credentials, scope: @config.scope
|
152
|
+
end
|
153
|
+
|
154
|
+
@quota_project_id = @config.quota_project
|
155
|
+
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
156
|
+
|
157
|
+
@automatic_improvements_service_stub = ::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::ServiceStub.new(
|
158
|
+
endpoint: @config.endpoint,
|
159
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
160
|
+
universe_domain: @config.universe_domain,
|
161
|
+
credentials: credentials,
|
162
|
+
logger: @config.logger
|
163
|
+
)
|
164
|
+
|
165
|
+
@automatic_improvements_service_stub.logger(stub: true)&.info do |entry|
|
166
|
+
entry.set_system_name
|
167
|
+
entry.set_service
|
168
|
+
entry.message = "Created client for #{entry.service}"
|
169
|
+
entry.set_credentials_fields credentials
|
170
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
171
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
172
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
173
|
+
end
|
174
|
+
end
|
175
|
+
|
176
|
+
##
|
177
|
+
# The logger used for request/response debug logging.
|
178
|
+
#
|
179
|
+
# @return [Logger]
|
180
|
+
#
|
181
|
+
def logger
|
182
|
+
@automatic_improvements_service_stub.logger
|
183
|
+
end
|
184
|
+
|
185
|
+
# Service calls
|
186
|
+
|
187
|
+
##
|
188
|
+
# Retrieves the automatic improvements of an account.
|
189
|
+
#
|
190
|
+
# @overload get_automatic_improvements(request, options = nil)
|
191
|
+
# Pass arguments to `get_automatic_improvements` via a request object, either of type
|
192
|
+
# {::Google::Shopping::Merchant::Accounts::V1beta::GetAutomaticImprovementsRequest} or an equivalent Hash.
|
193
|
+
#
|
194
|
+
# @param request [::Google::Shopping::Merchant::Accounts::V1beta::GetAutomaticImprovementsRequest, ::Hash]
|
195
|
+
# A request object representing the call parameters. Required. To specify no
|
196
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
197
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
198
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
199
|
+
#
|
200
|
+
# @overload get_automatic_improvements(name: nil)
|
201
|
+
# Pass arguments to `get_automatic_improvements` via keyword arguments. Note that at
|
202
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
203
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
204
|
+
#
|
205
|
+
# @param name [::String]
|
206
|
+
# Required. The resource name of the automatic improvements.
|
207
|
+
# Format: `accounts/{account}/automaticImprovements`
|
208
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
209
|
+
# @yieldparam result [::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovements]
|
210
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
211
|
+
#
|
212
|
+
# @return [::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovements]
|
213
|
+
#
|
214
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
215
|
+
#
|
216
|
+
# @example Basic example
|
217
|
+
# require "google/shopping/merchant/accounts/v1beta"
|
218
|
+
#
|
219
|
+
# # Create a client object. The client can be reused for multiple calls.
|
220
|
+
# client = Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::Client.new
|
221
|
+
#
|
222
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
223
|
+
# request = Google::Shopping::Merchant::Accounts::V1beta::GetAutomaticImprovementsRequest.new
|
224
|
+
#
|
225
|
+
# # Call the get_automatic_improvements method.
|
226
|
+
# result = client.get_automatic_improvements request
|
227
|
+
#
|
228
|
+
# # The returned object is of type Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovements.
|
229
|
+
# p result
|
230
|
+
#
|
231
|
+
def get_automatic_improvements request, options = nil
|
232
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
233
|
+
|
234
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Accounts::V1beta::GetAutomaticImprovementsRequest
|
235
|
+
|
236
|
+
# Converts hash and nil to an options object
|
237
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
238
|
+
|
239
|
+
# Customize the options with defaults
|
240
|
+
call_metadata = @config.rpcs.get_automatic_improvements.metadata.to_h
|
241
|
+
|
242
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
243
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
244
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
245
|
+
gapic_version: ::Google::Shopping::Merchant::Accounts::V1beta::VERSION,
|
246
|
+
transports_version_send: [:rest]
|
247
|
+
|
248
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
249
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
250
|
+
|
251
|
+
options.apply_defaults timeout: @config.rpcs.get_automatic_improvements.timeout,
|
252
|
+
metadata: call_metadata,
|
253
|
+
retry_policy: @config.rpcs.get_automatic_improvements.retry_policy
|
254
|
+
|
255
|
+
options.apply_defaults timeout: @config.timeout,
|
256
|
+
metadata: @config.metadata,
|
257
|
+
retry_policy: @config.retry_policy
|
258
|
+
|
259
|
+
@automatic_improvements_service_stub.get_automatic_improvements request, options do |result, operation|
|
260
|
+
yield result, operation if block_given?
|
261
|
+
end
|
262
|
+
rescue ::Gapic::Rest::Error => e
|
263
|
+
raise ::Google::Cloud::Error.from_error(e)
|
264
|
+
end
|
265
|
+
|
266
|
+
##
|
267
|
+
# Updates the automatic improvements of an account.
|
268
|
+
#
|
269
|
+
# @overload update_automatic_improvements(request, options = nil)
|
270
|
+
# Pass arguments to `update_automatic_improvements` via a request object, either of type
|
271
|
+
# {::Google::Shopping::Merchant::Accounts::V1beta::UpdateAutomaticImprovementsRequest} or an equivalent Hash.
|
272
|
+
#
|
273
|
+
# @param request [::Google::Shopping::Merchant::Accounts::V1beta::UpdateAutomaticImprovementsRequest, ::Hash]
|
274
|
+
# A request object representing the call parameters. Required. To specify no
|
275
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
276
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
277
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
278
|
+
#
|
279
|
+
# @overload update_automatic_improvements(automatic_improvements: nil, update_mask: nil)
|
280
|
+
# Pass arguments to `update_automatic_improvements` via keyword arguments. Note that at
|
281
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
282
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
283
|
+
#
|
284
|
+
# @param automatic_improvements [::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovements, ::Hash]
|
285
|
+
# Required. The new version of the automatic imrovements.
|
286
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
287
|
+
# Required. List of fields being updated.
|
288
|
+
# The following fields are supported (in both `snake_case` and
|
289
|
+
# `lowerCamelCase`):
|
290
|
+
#
|
291
|
+
# - `item_updates`
|
292
|
+
# - `item_updates.account_level_settings`
|
293
|
+
# - `image_improvements`
|
294
|
+
# - `image_improvements.account_level_settings`
|
295
|
+
# - `shipping_improvements`
|
296
|
+
# - `shipping_improvements.allow_shipping_improvements`
|
297
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
298
|
+
# @yieldparam result [::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovements]
|
299
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
300
|
+
#
|
301
|
+
# @return [::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovements]
|
302
|
+
#
|
303
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
304
|
+
#
|
305
|
+
# @example Basic example
|
306
|
+
# require "google/shopping/merchant/accounts/v1beta"
|
307
|
+
#
|
308
|
+
# # Create a client object. The client can be reused for multiple calls.
|
309
|
+
# client = Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::Client.new
|
310
|
+
#
|
311
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
312
|
+
# request = Google::Shopping::Merchant::Accounts::V1beta::UpdateAutomaticImprovementsRequest.new
|
313
|
+
#
|
314
|
+
# # Call the update_automatic_improvements method.
|
315
|
+
# result = client.update_automatic_improvements request
|
316
|
+
#
|
317
|
+
# # The returned object is of type Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovements.
|
318
|
+
# p result
|
319
|
+
#
|
320
|
+
def update_automatic_improvements request, options = nil
|
321
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
322
|
+
|
323
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Accounts::V1beta::UpdateAutomaticImprovementsRequest
|
324
|
+
|
325
|
+
# Converts hash and nil to an options object
|
326
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
327
|
+
|
328
|
+
# Customize the options with defaults
|
329
|
+
call_metadata = @config.rpcs.update_automatic_improvements.metadata.to_h
|
330
|
+
|
331
|
+
# Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
|
332
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
333
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
334
|
+
gapic_version: ::Google::Shopping::Merchant::Accounts::V1beta::VERSION,
|
335
|
+
transports_version_send: [:rest]
|
336
|
+
|
337
|
+
call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
|
338
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
339
|
+
|
340
|
+
options.apply_defaults timeout: @config.rpcs.update_automatic_improvements.timeout,
|
341
|
+
metadata: call_metadata,
|
342
|
+
retry_policy: @config.rpcs.update_automatic_improvements.retry_policy
|
343
|
+
|
344
|
+
options.apply_defaults timeout: @config.timeout,
|
345
|
+
metadata: @config.metadata,
|
346
|
+
retry_policy: @config.retry_policy
|
347
|
+
|
348
|
+
@automatic_improvements_service_stub.update_automatic_improvements request, options do |result, operation|
|
349
|
+
yield result, operation if block_given?
|
350
|
+
end
|
351
|
+
rescue ::Gapic::Rest::Error => e
|
352
|
+
raise ::Google::Cloud::Error.from_error(e)
|
353
|
+
end
|
354
|
+
|
355
|
+
##
|
356
|
+
# Configuration class for the AutomaticImprovementsService REST API.
|
357
|
+
#
|
358
|
+
# This class represents the configuration for AutomaticImprovementsService REST,
|
359
|
+
# providing control over timeouts, retry behavior, logging, transport
|
360
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
361
|
+
# applied individually to specific RPCs. See
|
362
|
+
# {::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::Client::Configuration::Rpcs}
|
363
|
+
# for a list of RPCs that can be configured independently.
|
364
|
+
#
|
365
|
+
# Configuration can be applied globally to all clients, or to a single client
|
366
|
+
# on construction.
|
367
|
+
#
|
368
|
+
# @example
|
369
|
+
#
|
370
|
+
# # Modify the global config, setting the timeout for
|
371
|
+
# # get_automatic_improvements to 20 seconds,
|
372
|
+
# # and all remaining timeouts to 10 seconds.
|
373
|
+
# ::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::Client.configure do |config|
|
374
|
+
# config.timeout = 10.0
|
375
|
+
# config.rpcs.get_automatic_improvements.timeout = 20.0
|
376
|
+
# end
|
377
|
+
#
|
378
|
+
# # Apply the above configuration only to a new client.
|
379
|
+
# client = ::Google::Shopping::Merchant::Accounts::V1beta::AutomaticImprovementsService::Rest::Client.new do |config|
|
380
|
+
# config.timeout = 10.0
|
381
|
+
# config.rpcs.get_automatic_improvements.timeout = 20.0
|
382
|
+
# end
|
383
|
+
#
|
384
|
+
# @!attribute [rw] endpoint
|
385
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
386
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
387
|
+
# @return [::String,nil]
|
388
|
+
# @!attribute [rw] credentials
|
389
|
+
# Credentials to send with calls. You may provide any of the following types:
|
390
|
+
# * (`String`) The path to a service account key file in JSON format
|
391
|
+
# * (`Hash`) A service account key as a Hash
|
392
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
393
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
394
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
395
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
396
|
+
# * (`nil`) indicating no credentials
|
397
|
+
#
|
398
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
399
|
+
# external source for authentication to Google Cloud, you must validate it before
|
400
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
401
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
402
|
+
# For more information, refer to [Validate credential configurations from external
|
403
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
404
|
+
# @return [::Object]
|
405
|
+
# @!attribute [rw] scope
|
406
|
+
# The OAuth scopes
|
407
|
+
# @return [::Array<::String>]
|
408
|
+
# @!attribute [rw] lib_name
|
409
|
+
# The library name as recorded in instrumentation and logging
|
410
|
+
# @return [::String]
|
411
|
+
# @!attribute [rw] lib_version
|
412
|
+
# The library version as recorded in instrumentation and logging
|
413
|
+
# @return [::String]
|
414
|
+
# @!attribute [rw] timeout
|
415
|
+
# The call timeout in seconds.
|
416
|
+
# @return [::Numeric]
|
417
|
+
# @!attribute [rw] metadata
|
418
|
+
# Additional headers to be sent with the call.
|
419
|
+
# @return [::Hash{::Symbol=>::String}]
|
420
|
+
# @!attribute [rw] retry_policy
|
421
|
+
# The retry policy. The value is a hash with the following keys:
|
422
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
423
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
424
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
425
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
426
|
+
# trigger a retry.
|
427
|
+
# @return [::Hash]
|
428
|
+
# @!attribute [rw] quota_project
|
429
|
+
# A separate project against which to charge quota.
|
430
|
+
# @return [::String]
|
431
|
+
# @!attribute [rw] universe_domain
|
432
|
+
# The universe domain within which to make requests. This determines the
|
433
|
+
# default endpoint URL. The default value of nil uses the environment
|
434
|
+
# universe (usually the default "googleapis.com" universe).
|
435
|
+
# @return [::String,nil]
|
436
|
+
# @!attribute [rw] logger
|
437
|
+
# A custom logger to use for request/response debug logging, or the value
|
438
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
439
|
+
# explicitly disable logging.
|
440
|
+
# @return [::Logger,:default,nil]
|
441
|
+
#
|
442
|
+
class Configuration
|
443
|
+
extend ::Gapic::Config
|
444
|
+
|
445
|
+
# @private
|
446
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
447
|
+
DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
|
448
|
+
|
449
|
+
config_attr :endpoint, nil, ::String, nil
|
450
|
+
config_attr :credentials, nil do |value|
|
451
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
452
|
+
allowed.any? { |klass| klass === value }
|
453
|
+
end
|
454
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
455
|
+
config_attr :lib_name, nil, ::String, nil
|
456
|
+
config_attr :lib_version, nil, ::String, nil
|
457
|
+
config_attr :timeout, nil, ::Numeric, nil
|
458
|
+
config_attr :metadata, nil, ::Hash, nil
|
459
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
460
|
+
config_attr :quota_project, nil, ::String, nil
|
461
|
+
config_attr :universe_domain, nil, ::String, nil
|
462
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
463
|
+
|
464
|
+
# @private
|
465
|
+
def initialize parent_config = nil
|
466
|
+
@parent_config = parent_config unless parent_config.nil?
|
467
|
+
|
468
|
+
yield self if block_given?
|
469
|
+
end
|
470
|
+
|
471
|
+
##
|
472
|
+
# Configurations for individual RPCs
|
473
|
+
# @return [Rpcs]
|
474
|
+
#
|
475
|
+
def rpcs
|
476
|
+
@rpcs ||= begin
|
477
|
+
parent_rpcs = nil
|
478
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
479
|
+
Rpcs.new parent_rpcs
|
480
|
+
end
|
481
|
+
end
|
482
|
+
|
483
|
+
##
|
484
|
+
# Configuration RPC class for the AutomaticImprovementsService API.
|
485
|
+
#
|
486
|
+
# Includes fields providing the configuration for each RPC in this service.
|
487
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
488
|
+
# the following configuration fields:
|
489
|
+
#
|
490
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
491
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
492
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
493
|
+
# include the following keys:
|
494
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
495
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
496
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
497
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
498
|
+
# trigger a retry.
|
499
|
+
#
|
500
|
+
class Rpcs
|
501
|
+
##
|
502
|
+
# RPC-specific configuration for `get_automatic_improvements`
|
503
|
+
# @return [::Gapic::Config::Method]
|
504
|
+
#
|
505
|
+
attr_reader :get_automatic_improvements
|
506
|
+
##
|
507
|
+
# RPC-specific configuration for `update_automatic_improvements`
|
508
|
+
# @return [::Gapic::Config::Method]
|
509
|
+
#
|
510
|
+
attr_reader :update_automatic_improvements
|
511
|
+
|
512
|
+
# @private
|
513
|
+
def initialize parent_rpcs = nil
|
514
|
+
get_automatic_improvements_config = parent_rpcs.get_automatic_improvements if parent_rpcs.respond_to? :get_automatic_improvements
|
515
|
+
@get_automatic_improvements = ::Gapic::Config::Method.new get_automatic_improvements_config
|
516
|
+
update_automatic_improvements_config = parent_rpcs.update_automatic_improvements if parent_rpcs.respond_to? :update_automatic_improvements
|
517
|
+
@update_automatic_improvements = ::Gapic::Config::Method.new update_automatic_improvements_config
|
518
|
+
|
519
|
+
yield self if block_given?
|
520
|
+
end
|
521
|
+
end
|
522
|
+
end
|
523
|
+
end
|
524
|
+
end
|
525
|
+
end
|
526
|
+
end
|
527
|
+
end
|
528
|
+
end
|
529
|
+
end
|
530
|
+
end
|