google-shopping-merchant-products-v1 0.a → 0.1.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.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/shopping/merchant/products/v1/product_inputs_service/client.rb +715 -0
  6. data/lib/google/shopping/merchant/products/v1/product_inputs_service/credentials.rb +49 -0
  7. data/lib/google/shopping/merchant/products/v1/product_inputs_service/paths.rb +66 -0
  8. data/lib/google/shopping/merchant/products/v1/product_inputs_service/rest/client.rb +668 -0
  9. data/lib/google/shopping/merchant/products/v1/product_inputs_service/rest/service_stub.rb +268 -0
  10. data/lib/google/shopping/merchant/products/v1/product_inputs_service/rest.rb +54 -0
  11. data/lib/google/shopping/merchant/products/v1/product_inputs_service.rb +57 -0
  12. data/lib/google/shopping/merchant/products/v1/productinputs_pb.rb +59 -0
  13. data/lib/google/shopping/merchant/products/v1/productinputs_services_pb.rb +69 -0
  14. data/lib/google/shopping/merchant/products/v1/products_common_pb.rb +91 -0
  15. data/lib/google/shopping/merchant/products/v1/products_pb.rb +56 -0
  16. data/lib/google/shopping/merchant/products/v1/products_service/client.rb +591 -0
  17. data/lib/google/shopping/merchant/products/v1/products_service/credentials.rb +49 -0
  18. data/lib/google/shopping/merchant/products/v1/products_service/paths.rb +66 -0
  19. data/lib/google/shopping/merchant/products/v1/products_service/rest/client.rb +551 -0
  20. data/lib/google/shopping/merchant/products/v1/products_service/rest/service_stub.rb +205 -0
  21. data/lib/google/shopping/merchant/products/v1/products_service/rest.rb +54 -0
  22. data/lib/google/shopping/merchant/products/v1/products_service.rb +57 -0
  23. data/lib/google/shopping/merchant/products/v1/products_services_pb.rb +57 -0
  24. data/lib/google/shopping/merchant/products/v1/rest.rb +40 -0
  25. data/lib/google/shopping/merchant/products/v1/version.rb +7 -2
  26. data/lib/google/shopping/merchant/products/v1.rb +48 -0
  27. data/lib/google-shopping-merchant-products-v1.rb +21 -0
  28. data/proto_docs/README.md +4 -0
  29. data/proto_docs/google/api/client.rb +473 -0
  30. data/proto_docs/google/api/field_behavior.rb +85 -0
  31. data/proto_docs/google/api/launch_stage.rb +71 -0
  32. data/proto_docs/google/api/resource.rb +227 -0
  33. data/proto_docs/google/protobuf/duration.rb +98 -0
  34. data/proto_docs/google/protobuf/empty.rb +34 -0
  35. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  36. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  37. data/proto_docs/google/shopping/merchant/products/v1/productinputs.rb +221 -0
  38. data/proto_docs/google/shopping/merchant/products/v1/products.rb +175 -0
  39. data/proto_docs/google/shopping/merchant/products/v1/products_common.rb +1303 -0
  40. data/proto_docs/google/shopping/type/types.rb +210 -0
  41. data/proto_docs/google/type/interval.rb +45 -0
  42. metadata +100 -9
@@ -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
+ require "googleauth"
20
+
21
+ module Google
22
+ module Shopping
23
+ module Merchant
24
+ module Products
25
+ module V1
26
+ module ProductsService
27
+ # Credentials for the ProductsService API.
28
+ class Credentials < ::Google::Auth::Credentials
29
+ self.scope = [
30
+ "https://www.googleapis.com/auth/content"
31
+ ]
32
+ self.env_vars = [
33
+ "GOOGLE_CLOUD_CREDENTIALS",
34
+ "GOOGLE_CLOUD_KEYFILE",
35
+ "GCLOUD_KEYFILE",
36
+ "GOOGLE_CLOUD_CREDENTIALS_JSON",
37
+ "GOOGLE_CLOUD_KEYFILE_JSON",
38
+ "GCLOUD_KEYFILE_JSON"
39
+ ]
40
+ self.paths = [
41
+ "~/.config/google_cloud/application_default_credentials.json"
42
+ ]
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,66 @@
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 Products
24
+ module V1
25
+ module ProductsService
26
+ # Path helper methods for the ProductsService API.
27
+ module Paths
28
+ ##
29
+ # Create a fully-qualified Account resource string.
30
+ #
31
+ # The resource will be in the following format:
32
+ #
33
+ # `accounts/{account}`
34
+ #
35
+ # @param account [String]
36
+ #
37
+ # @return [::String]
38
+ def account_path account:
39
+ "accounts/#{account}"
40
+ end
41
+
42
+ ##
43
+ # Create a fully-qualified Product resource string.
44
+ #
45
+ # The resource will be in the following format:
46
+ #
47
+ # `accounts/{account}/products/{product}`
48
+ #
49
+ # @param account [String]
50
+ # @param product [String]
51
+ #
52
+ # @return [::String]
53
+ def product_path account:, product:
54
+ raise ::ArgumentError, "account cannot contain /" if account.to_s.include? "/"
55
+
56
+ "accounts/#{account}/products/#{product}"
57
+ end
58
+
59
+ extend self
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
@@ -0,0 +1,551 @@
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/products/v1/products_pb"
21
+ require "google/shopping/merchant/products/v1/products_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Products
27
+ module V1
28
+ module ProductsService
29
+ module Rest
30
+ ##
31
+ # REST client for the ProductsService service.
32
+ #
33
+ # Service to use Product resource.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :products_service_stub
46
+
47
+ ##
48
+ # Configure the ProductsService Client class.
49
+ #
50
+ # See {::Google::Shopping::Merchant::Products::V1::ProductsService::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all ProductsService clients
56
+ # ::Google::Shopping::Merchant::Products::V1::ProductsService::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Shopping", "Merchant", "Products", "V1"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.timeout = 60.0
77
+ default_config.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the ProductsService Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Shopping::Merchant::Products::V1::ProductsService::Rest::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # The effective universe domain
109
+ #
110
+ # @return [String]
111
+ #
112
+ def universe_domain
113
+ @products_service_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new ProductsService REST client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Shopping::Merchant::Products::V1::ProductsService::Rest::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Shopping::Merchant::Products::V1::ProductsService::Rest::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the ProductsService client.
130
+ # @yieldparam config [Client::Configuration]
131
+ #
132
+ def initialize
133
+ # Create the configuration object
134
+ @config = Configuration.new Client.configure
135
+
136
+ # Yield the configuration if needed
137
+ yield @config if block_given?
138
+
139
+ # Create credentials
140
+ credentials = @config.credentials
141
+ # Use self-signed JWT if the endpoint is unchanged from default,
142
+ # but only if the default endpoint does not have a region prefix.
143
+ enable_self_signed_jwt = @config.endpoint.nil? ||
144
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
145
+ !@config.endpoint.split(".").first.include?("-"))
146
+ credentials ||= Credentials.default scope: @config.scope,
147
+ enable_self_signed_jwt: enable_self_signed_jwt
148
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
149
+ credentials = Credentials.new credentials, scope: @config.scope
150
+ end
151
+
152
+ @quota_project_id = @config.quota_project
153
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
154
+
155
+ @products_service_stub = ::Google::Shopping::Merchant::Products::V1::ProductsService::Rest::ServiceStub.new(
156
+ endpoint: @config.endpoint,
157
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
158
+ universe_domain: @config.universe_domain,
159
+ credentials: credentials,
160
+ logger: @config.logger
161
+ )
162
+
163
+ @products_service_stub.logger(stub: true)&.info do |entry|
164
+ entry.set_system_name
165
+ entry.set_service
166
+ entry.message = "Created client for #{entry.service}"
167
+ entry.set_credentials_fields credentials
168
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
169
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
170
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
171
+ end
172
+ end
173
+
174
+ ##
175
+ # The logger used for request/response debug logging.
176
+ #
177
+ # @return [Logger]
178
+ #
179
+ def logger
180
+ @products_service_stub.logger
181
+ end
182
+
183
+ # Service calls
184
+
185
+ ##
186
+ # Retrieves the processed product from your Merchant Center account.
187
+ #
188
+ # After inserting, updating, or deleting a product input, it may take several
189
+ # minutes before the updated final product can be retrieved.
190
+ #
191
+ # @overload get_product(request, options = nil)
192
+ # Pass arguments to `get_product` via a request object, either of type
193
+ # {::Google::Shopping::Merchant::Products::V1::GetProductRequest} or an equivalent Hash.
194
+ #
195
+ # @param request [::Google::Shopping::Merchant::Products::V1::GetProductRequest, ::Hash]
196
+ # A request object representing the call parameters. Required. To specify no
197
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
198
+ # @param options [::Gapic::CallOptions, ::Hash]
199
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
200
+ #
201
+ # @overload get_product(name: nil)
202
+ # Pass arguments to `get_product` via keyword arguments. Note that at
203
+ # least one keyword argument is required. To specify no parameters, or to keep all
204
+ # the default parameter values, pass an empty Hash as a request object (see above).
205
+ #
206
+ # @param name [::String]
207
+ # Required. The name of the product to retrieve.
208
+ # Format:
209
+ # `accounts/{account}/products/{product}` where the last
210
+ # section `product` consists of:
211
+ # `content_language~feed_label~offer_id`
212
+ # example for product name is `accounts/123/products/en~US~sku123`. A legacy
213
+ # local product name would be `accounts/123/products/local~en~US~sku123`.
214
+ # Note: For calls to the v1beta version, the `product` section consists
215
+ # of: `channel~content_language~feed_label~offer_id`, for example:
216
+ # `accounts/123/products/online~en~US~sku123`.
217
+ # @yield [result, operation] Access the result along with the TransportOperation object
218
+ # @yieldparam result [::Google::Shopping::Merchant::Products::V1::Product]
219
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
220
+ #
221
+ # @return [::Google::Shopping::Merchant::Products::V1::Product]
222
+ #
223
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
224
+ #
225
+ # @example Basic example
226
+ # require "google/shopping/merchant/products/v1"
227
+ #
228
+ # # Create a client object. The client can be reused for multiple calls.
229
+ # client = Google::Shopping::Merchant::Products::V1::ProductsService::Rest::Client.new
230
+ #
231
+ # # Create a request. To set request fields, pass in keyword arguments.
232
+ # request = Google::Shopping::Merchant::Products::V1::GetProductRequest.new
233
+ #
234
+ # # Call the get_product method.
235
+ # result = client.get_product request
236
+ #
237
+ # # The returned object is of type Google::Shopping::Merchant::Products::V1::Product.
238
+ # p result
239
+ #
240
+ def get_product request, options = nil
241
+ raise ::ArgumentError, "request must be provided" if request.nil?
242
+
243
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Products::V1::GetProductRequest
244
+
245
+ # Converts hash and nil to an options object
246
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
247
+
248
+ # Customize the options with defaults
249
+ call_metadata = @config.rpcs.get_product.metadata.to_h
250
+
251
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
252
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
253
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
254
+ gapic_version: ::Google::Shopping::Merchant::Products::V1::VERSION,
255
+ transports_version_send: [:rest]
256
+
257
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
258
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
259
+
260
+ options.apply_defaults timeout: @config.rpcs.get_product.timeout,
261
+ metadata: call_metadata,
262
+ retry_policy: @config.rpcs.get_product.retry_policy
263
+
264
+ options.apply_defaults timeout: @config.timeout,
265
+ metadata: @config.metadata,
266
+ retry_policy: @config.retry_policy
267
+
268
+ @products_service_stub.get_product request, options do |result, operation|
269
+ yield result, operation if block_given?
270
+ end
271
+ rescue ::Gapic::Rest::Error => e
272
+ raise ::Google::Cloud::Error.from_error(e)
273
+ end
274
+
275
+ ##
276
+ # Lists the processed products in your Merchant Center account. The response
277
+ # might contain fewer items than specified by `pageSize`. Rely on `pageToken`
278
+ # to determine if there are more items to be requested.
279
+ #
280
+ # After inserting, updating, or deleting a product input, it may take several
281
+ # minutes before the updated processed product can be retrieved.
282
+ #
283
+ # @overload list_products(request, options = nil)
284
+ # Pass arguments to `list_products` via a request object, either of type
285
+ # {::Google::Shopping::Merchant::Products::V1::ListProductsRequest} or an equivalent Hash.
286
+ #
287
+ # @param request [::Google::Shopping::Merchant::Products::V1::ListProductsRequest, ::Hash]
288
+ # A request object representing the call parameters. Required. To specify no
289
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
290
+ # @param options [::Gapic::CallOptions, ::Hash]
291
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
292
+ #
293
+ # @overload list_products(parent: nil, page_size: nil, page_token: nil)
294
+ # Pass arguments to `list_products` via keyword arguments. Note that at
295
+ # least one keyword argument is required. To specify no parameters, or to keep all
296
+ # the default parameter values, pass an empty Hash as a request object (see above).
297
+ #
298
+ # @param parent [::String]
299
+ # Required. The account to list processed products for.
300
+ # Format: `accounts/{account}`
301
+ # @param page_size [::Integer]
302
+ # The maximum number of products to return. The service may return fewer than
303
+ # this value.
304
+ # The maximum value is 1000; values above 1000 will be coerced to 1000.
305
+ # If unspecified, the default page size of 25 products will be returned.
306
+ # @param page_token [::String]
307
+ # A page token, received from a previous `ListProducts` call.
308
+ # Provide this to retrieve the subsequent page.
309
+ #
310
+ # When paginating, all other parameters provided to `ListProducts` must
311
+ # match the call that provided the page token.
312
+ # @yield [result, operation] Access the result along with the TransportOperation object
313
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Products::V1::Product>]
314
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
315
+ #
316
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Products::V1::Product>]
317
+ #
318
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
319
+ #
320
+ # @example Basic example
321
+ # require "google/shopping/merchant/products/v1"
322
+ #
323
+ # # Create a client object. The client can be reused for multiple calls.
324
+ # client = Google::Shopping::Merchant::Products::V1::ProductsService::Rest::Client.new
325
+ #
326
+ # # Create a request. To set request fields, pass in keyword arguments.
327
+ # request = Google::Shopping::Merchant::Products::V1::ListProductsRequest.new
328
+ #
329
+ # # Call the list_products method.
330
+ # result = client.list_products request
331
+ #
332
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
333
+ # # over elements, and API calls will be issued to fetch pages as needed.
334
+ # result.each do |item|
335
+ # # Each element is of type ::Google::Shopping::Merchant::Products::V1::Product.
336
+ # p item
337
+ # end
338
+ #
339
+ def list_products request, options = nil
340
+ raise ::ArgumentError, "request must be provided" if request.nil?
341
+
342
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Products::V1::ListProductsRequest
343
+
344
+ # Converts hash and nil to an options object
345
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
346
+
347
+ # Customize the options with defaults
348
+ call_metadata = @config.rpcs.list_products.metadata.to_h
349
+
350
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
351
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
352
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
353
+ gapic_version: ::Google::Shopping::Merchant::Products::V1::VERSION,
354
+ transports_version_send: [:rest]
355
+
356
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
357
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
358
+
359
+ options.apply_defaults timeout: @config.rpcs.list_products.timeout,
360
+ metadata: call_metadata,
361
+ retry_policy: @config.rpcs.list_products.retry_policy
362
+
363
+ options.apply_defaults timeout: @config.timeout,
364
+ metadata: @config.metadata,
365
+ retry_policy: @config.retry_policy
366
+
367
+ @products_service_stub.list_products request, options do |result, operation|
368
+ result = ::Gapic::Rest::PagedEnumerable.new @products_service_stub, :list_products, "products", request, result, options
369
+ yield result, operation if block_given?
370
+ throw :response, result
371
+ end
372
+ rescue ::Gapic::Rest::Error => e
373
+ raise ::Google::Cloud::Error.from_error(e)
374
+ end
375
+
376
+ ##
377
+ # Configuration class for the ProductsService REST API.
378
+ #
379
+ # This class represents the configuration for ProductsService REST,
380
+ # providing control over timeouts, retry behavior, logging, transport
381
+ # parameters, and other low-level controls. Certain parameters can also be
382
+ # applied individually to specific RPCs. See
383
+ # {::Google::Shopping::Merchant::Products::V1::ProductsService::Rest::Client::Configuration::Rpcs}
384
+ # for a list of RPCs that can be configured independently.
385
+ #
386
+ # Configuration can be applied globally to all clients, or to a single client
387
+ # on construction.
388
+ #
389
+ # @example
390
+ #
391
+ # # Modify the global config, setting the timeout for
392
+ # # get_product to 20 seconds,
393
+ # # and all remaining timeouts to 10 seconds.
394
+ # ::Google::Shopping::Merchant::Products::V1::ProductsService::Rest::Client.configure do |config|
395
+ # config.timeout = 10.0
396
+ # config.rpcs.get_product.timeout = 20.0
397
+ # end
398
+ #
399
+ # # Apply the above configuration only to a new client.
400
+ # client = ::Google::Shopping::Merchant::Products::V1::ProductsService::Rest::Client.new do |config|
401
+ # config.timeout = 10.0
402
+ # config.rpcs.get_product.timeout = 20.0
403
+ # end
404
+ #
405
+ # @!attribute [rw] endpoint
406
+ # A custom service endpoint, as a hostname or hostname:port. The default is
407
+ # nil, indicating to use the default endpoint in the current universe domain.
408
+ # @return [::String,nil]
409
+ # @!attribute [rw] credentials
410
+ # Credentials to send with calls. You may provide any of the following types:
411
+ # * (`String`) The path to a service account key file in JSON format
412
+ # * (`Hash`) A service account key as a Hash
413
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
414
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
415
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
416
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
417
+ # * (`nil`) indicating no credentials
418
+ #
419
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
420
+ # external source for authentication to Google Cloud, you must validate it before
421
+ # providing it to a Google API client library. Providing an unvalidated credential
422
+ # configuration to Google APIs can compromise the security of your systems and data.
423
+ # For more information, refer to [Validate credential configurations from external
424
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
425
+ # @return [::Object]
426
+ # @!attribute [rw] scope
427
+ # The OAuth scopes
428
+ # @return [::Array<::String>]
429
+ # @!attribute [rw] lib_name
430
+ # The library name as recorded in instrumentation and logging
431
+ # @return [::String]
432
+ # @!attribute [rw] lib_version
433
+ # The library version as recorded in instrumentation and logging
434
+ # @return [::String]
435
+ # @!attribute [rw] timeout
436
+ # The call timeout in seconds.
437
+ # @return [::Numeric]
438
+ # @!attribute [rw] metadata
439
+ # Additional headers to be sent with the call.
440
+ # @return [::Hash{::Symbol=>::String}]
441
+ # @!attribute [rw] retry_policy
442
+ # The retry policy. The value is a hash with the following keys:
443
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
444
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
445
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
446
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
447
+ # trigger a retry.
448
+ # @return [::Hash]
449
+ # @!attribute [rw] quota_project
450
+ # A separate project against which to charge quota.
451
+ # @return [::String]
452
+ # @!attribute [rw] universe_domain
453
+ # The universe domain within which to make requests. This determines the
454
+ # default endpoint URL. The default value of nil uses the environment
455
+ # universe (usually the default "googleapis.com" universe).
456
+ # @return [::String,nil]
457
+ # @!attribute [rw] logger
458
+ # A custom logger to use for request/response debug logging, or the value
459
+ # `:default` (the default) to construct a default logger, or `nil` to
460
+ # explicitly disable logging.
461
+ # @return [::Logger,:default,nil]
462
+ #
463
+ class Configuration
464
+ extend ::Gapic::Config
465
+
466
+ # @private
467
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
468
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
469
+
470
+ config_attr :endpoint, nil, ::String, nil
471
+ config_attr :credentials, nil do |value|
472
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
473
+ allowed.any? { |klass| klass === value }
474
+ end
475
+ config_attr :scope, nil, ::String, ::Array, nil
476
+ config_attr :lib_name, nil, ::String, nil
477
+ config_attr :lib_version, nil, ::String, nil
478
+ config_attr :timeout, nil, ::Numeric, nil
479
+ config_attr :metadata, nil, ::Hash, nil
480
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
481
+ config_attr :quota_project, nil, ::String, nil
482
+ config_attr :universe_domain, nil, ::String, nil
483
+ config_attr :logger, :default, ::Logger, nil, :default
484
+
485
+ # @private
486
+ def initialize parent_config = nil
487
+ @parent_config = parent_config unless parent_config.nil?
488
+
489
+ yield self if block_given?
490
+ end
491
+
492
+ ##
493
+ # Configurations for individual RPCs
494
+ # @return [Rpcs]
495
+ #
496
+ def rpcs
497
+ @rpcs ||= begin
498
+ parent_rpcs = nil
499
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
500
+ Rpcs.new parent_rpcs
501
+ end
502
+ end
503
+
504
+ ##
505
+ # Configuration RPC class for the ProductsService API.
506
+ #
507
+ # Includes fields providing the configuration for each RPC in this service.
508
+ # Each configuration object is of type `Gapic::Config::Method` and includes
509
+ # the following configuration fields:
510
+ #
511
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
512
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
513
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
514
+ # include the following keys:
515
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
516
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
517
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
518
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
519
+ # trigger a retry.
520
+ #
521
+ class Rpcs
522
+ ##
523
+ # RPC-specific configuration for `get_product`
524
+ # @return [::Gapic::Config::Method]
525
+ #
526
+ attr_reader :get_product
527
+ ##
528
+ # RPC-specific configuration for `list_products`
529
+ # @return [::Gapic::Config::Method]
530
+ #
531
+ attr_reader :list_products
532
+
533
+ # @private
534
+ def initialize parent_rpcs = nil
535
+ get_product_config = parent_rpcs.get_product if parent_rpcs.respond_to? :get_product
536
+ @get_product = ::Gapic::Config::Method.new get_product_config
537
+ list_products_config = parent_rpcs.list_products if parent_rpcs.respond_to? :list_products
538
+ @list_products = ::Gapic::Config::Method.new list_products_config
539
+
540
+ yield self if block_given?
541
+ end
542
+ end
543
+ end
544
+ end
545
+ end
546
+ end
547
+ end
548
+ end
549
+ end
550
+ end
551
+ end