google-shopping-merchant-inventories-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 (41) 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/inventories/v1/inventories_common_pb.rb +55 -0
  6. data/lib/google/shopping/merchant/inventories/v1/local_inventory_service/client.rb +694 -0
  7. data/lib/google/shopping/merchant/inventories/v1/local_inventory_service/credentials.rb +49 -0
  8. data/lib/google/shopping/merchant/inventories/v1/local_inventory_service/paths.rb +71 -0
  9. data/lib/google/shopping/merchant/inventories/v1/local_inventory_service/rest/client.rb +647 -0
  10. data/lib/google/shopping/merchant/inventories/v1/local_inventory_service/rest/service_stub.rb +267 -0
  11. data/lib/google/shopping/merchant/inventories/v1/local_inventory_service/rest.rb +54 -0
  12. data/lib/google/shopping/merchant/inventories/v1/local_inventory_service.rb +57 -0
  13. data/lib/google/shopping/merchant/inventories/v1/localinventory_pb.rb +56 -0
  14. data/lib/google/shopping/merchant/inventories/v1/localinventory_services_pb.rb +68 -0
  15. data/lib/google/shopping/merchant/inventories/v1/regional_inventory_service/client.rb +694 -0
  16. data/lib/google/shopping/merchant/inventories/v1/regional_inventory_service/credentials.rb +49 -0
  17. data/lib/google/shopping/merchant/inventories/v1/regional_inventory_service/paths.rb +71 -0
  18. data/lib/google/shopping/merchant/inventories/v1/regional_inventory_service/rest/client.rb +647 -0
  19. data/lib/google/shopping/merchant/inventories/v1/regional_inventory_service/rest/service_stub.rb +267 -0
  20. data/lib/google/shopping/merchant/inventories/v1/regional_inventory_service/rest.rb +55 -0
  21. data/lib/google/shopping/merchant/inventories/v1/regional_inventory_service.rb +58 -0
  22. data/lib/google/shopping/merchant/inventories/v1/regionalinventory_pb.rb +56 -0
  23. data/lib/google/shopping/merchant/inventories/v1/regionalinventory_services_pb.rb +69 -0
  24. data/lib/google/shopping/merchant/inventories/v1/rest.rb +40 -0
  25. data/lib/google/shopping/merchant/inventories/v1/version.rb +7 -2
  26. data/lib/google/shopping/merchant/inventories/v1.rb +48 -0
  27. data/lib/google-shopping-merchant-inventories-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/timestamp.rb +127 -0
  36. data/proto_docs/google/shopping/merchant/inventories/v1/inventories_common.rb +182 -0
  37. data/proto_docs/google/shopping/merchant/inventories/v1/localinventory.rb +124 -0
  38. data/proto_docs/google/shopping/merchant/inventories/v1/regionalinventory.rb +123 -0
  39. data/proto_docs/google/shopping/type/types.rb +210 -0
  40. data/proto_docs/google/type/interval.rb +45 -0
  41. metadata +99 -9
@@ -0,0 +1,647 @@
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/inventories/v1/regionalinventory_pb"
21
+ require "google/shopping/merchant/inventories/v1/regional_inventory_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Inventories
27
+ module V1
28
+ module RegionalInventoryService
29
+ module Rest
30
+ ##
31
+ # REST client for the RegionalInventoryService service.
32
+ #
33
+ # Service to manage regional inventory for products. There is also separate
34
+ # `regions` resource and API to manage regions definitions.
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :regional_inventory_service_stub
47
+
48
+ ##
49
+ # Configure the RegionalInventoryService Client class.
50
+ #
51
+ # See {::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all RegionalInventoryService clients
57
+ # ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Shopping", "Merchant", "Inventories", "V1"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config.timeout = 60.0
78
+ default_config.retry_policy = {
79
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
80
+ }
81
+
82
+ default_config
83
+ end
84
+ yield @configure if block_given?
85
+ @configure
86
+ end
87
+
88
+ ##
89
+ # Configure the RegionalInventoryService Client instance.
90
+ #
91
+ # The configuration is set to the derived mode, meaning that values can be changed,
92
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
93
+ # should be made on {Client.configure}.
94
+ #
95
+ # See {::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client::Configuration}
96
+ # for a description of the configuration fields.
97
+ #
98
+ # @yield [config] Configure the Client client.
99
+ # @yieldparam config [Client::Configuration]
100
+ #
101
+ # @return [Client::Configuration]
102
+ #
103
+ def configure
104
+ yield @config if block_given?
105
+ @config
106
+ end
107
+
108
+ ##
109
+ # The effective universe domain
110
+ #
111
+ # @return [String]
112
+ #
113
+ def universe_domain
114
+ @regional_inventory_service_stub.universe_domain
115
+ end
116
+
117
+ ##
118
+ # Create a new RegionalInventoryService REST client object.
119
+ #
120
+ # @example
121
+ #
122
+ # # Create a client using the default configuration
123
+ # client = ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client.new
124
+ #
125
+ # # Create a client using a custom configuration
126
+ # client = ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client.new do |config|
127
+ # config.timeout = 10.0
128
+ # end
129
+ #
130
+ # @yield [config] Configure the RegionalInventoryService client.
131
+ # @yieldparam config [Client::Configuration]
132
+ #
133
+ def initialize
134
+ # Create the configuration object
135
+ @config = Configuration.new Client.configure
136
+
137
+ # Yield the configuration if needed
138
+ yield @config if block_given?
139
+
140
+ # Create credentials
141
+ credentials = @config.credentials
142
+ # Use self-signed JWT if the endpoint is unchanged from default,
143
+ # but only if the default endpoint does not have a region prefix.
144
+ enable_self_signed_jwt = @config.endpoint.nil? ||
145
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
146
+ !@config.endpoint.split(".").first.include?("-"))
147
+ credentials ||= Credentials.default scope: @config.scope,
148
+ enable_self_signed_jwt: enable_self_signed_jwt
149
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
150
+ credentials = Credentials.new credentials, scope: @config.scope
151
+ end
152
+
153
+ @quota_project_id = @config.quota_project
154
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
155
+
156
+ @regional_inventory_service_stub = ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::ServiceStub.new(
157
+ endpoint: @config.endpoint,
158
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
159
+ universe_domain: @config.universe_domain,
160
+ credentials: credentials,
161
+ logger: @config.logger
162
+ )
163
+
164
+ @regional_inventory_service_stub.logger(stub: true)&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+ end
174
+
175
+ ##
176
+ # The logger used for request/response debug logging.
177
+ #
178
+ # @return [Logger]
179
+ #
180
+ def logger
181
+ @regional_inventory_service_stub.logger
182
+ end
183
+
184
+ # Service calls
185
+
186
+ ##
187
+ # Lists the `RegionalInventory` resources for the given product in your
188
+ # merchant account. The response might contain fewer items than specified by
189
+ # `pageSize`. If `pageToken` was returned in previous request, it can be
190
+ # used to obtain additional results.
191
+ #
192
+ # `RegionalInventory` resources are listed per product for a given account.
193
+ #
194
+ # @overload list_regional_inventories(request, options = nil)
195
+ # Pass arguments to `list_regional_inventories` via a request object, either of type
196
+ # {::Google::Shopping::Merchant::Inventories::V1::ListRegionalInventoriesRequest} or an equivalent Hash.
197
+ #
198
+ # @param request [::Google::Shopping::Merchant::Inventories::V1::ListRegionalInventoriesRequest, ::Hash]
199
+ # A request object representing the call parameters. Required. To specify no
200
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
201
+ # @param options [::Gapic::CallOptions, ::Hash]
202
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
203
+ #
204
+ # @overload list_regional_inventories(parent: nil, page_size: nil, page_token: nil)
205
+ # Pass arguments to `list_regional_inventories` via keyword arguments. Note that at
206
+ # least one keyword argument is required. To specify no parameters, or to keep all
207
+ # the default parameter values, pass an empty Hash as a request object (see above).
208
+ #
209
+ # @param parent [::String]
210
+ # Required. The `name` of the parent product to list `RegionalInventory`
211
+ # resources for. Format: `accounts/{account}/products/{product}`
212
+ # @param page_size [::Integer]
213
+ # The maximum number of `RegionalInventory` resources for the given product
214
+ # to return. The service returns fewer than this value if the number of
215
+ # inventories for the given product is less that than the `pageSize`. The
216
+ # default value is 25000. The maximum value is 100000; If a value higher than
217
+ # the maximum is specified, then the `pageSize` will default to the maximum.
218
+ # @param page_token [::String]
219
+ # A page token, received from a previous `ListRegionalInventories` call.
220
+ # Provide the page token to retrieve the subsequent page.
221
+ #
222
+ # When paginating, all other parameters provided to `ListRegionalInventories`
223
+ # must match the call that provided the page token. The token returned as
224
+ # {::Google::Shopping::Merchant::Inventories::V1::ListRegionalInventoriesResponse#next_page_token nextPageToken}
225
+ # in the response to the previous request.
226
+ # @yield [result, operation] Access the result along with the TransportOperation object
227
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Inventories::V1::RegionalInventory>]
228
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
229
+ #
230
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Inventories::V1::RegionalInventory>]
231
+ #
232
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
233
+ #
234
+ # @example Basic example
235
+ # require "google/shopping/merchant/inventories/v1"
236
+ #
237
+ # # Create a client object. The client can be reused for multiple calls.
238
+ # client = Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client.new
239
+ #
240
+ # # Create a request. To set request fields, pass in keyword arguments.
241
+ # request = Google::Shopping::Merchant::Inventories::V1::ListRegionalInventoriesRequest.new
242
+ #
243
+ # # Call the list_regional_inventories method.
244
+ # result = client.list_regional_inventories request
245
+ #
246
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
247
+ # # over elements, and API calls will be issued to fetch pages as needed.
248
+ # result.each do |item|
249
+ # # Each element is of type ::Google::Shopping::Merchant::Inventories::V1::RegionalInventory.
250
+ # p item
251
+ # end
252
+ #
253
+ def list_regional_inventories request, options = nil
254
+ raise ::ArgumentError, "request must be provided" if request.nil?
255
+
256
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Inventories::V1::ListRegionalInventoriesRequest
257
+
258
+ # Converts hash and nil to an options object
259
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
260
+
261
+ # Customize the options with defaults
262
+ call_metadata = @config.rpcs.list_regional_inventories.metadata.to_h
263
+
264
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
265
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
266
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
267
+ gapic_version: ::Google::Shopping::Merchant::Inventories::V1::VERSION,
268
+ transports_version_send: [:rest]
269
+
270
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
271
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
272
+
273
+ options.apply_defaults timeout: @config.rpcs.list_regional_inventories.timeout,
274
+ metadata: call_metadata,
275
+ retry_policy: @config.rpcs.list_regional_inventories.retry_policy
276
+
277
+ options.apply_defaults timeout: @config.timeout,
278
+ metadata: @config.metadata,
279
+ retry_policy: @config.retry_policy
280
+
281
+ @regional_inventory_service_stub.list_regional_inventories request, options do |result, operation|
282
+ result = ::Gapic::Rest::PagedEnumerable.new @regional_inventory_service_stub, :list_regional_inventories, "regional_inventories", request, result, options
283
+ yield result, operation if block_given?
284
+ throw :response, result
285
+ end
286
+ rescue ::Gapic::Rest::Error => e
287
+ raise ::Google::Cloud::Error.from_error(e)
288
+ end
289
+
290
+ ##
291
+ # Inserts a `RegionalInventory` to a given product in your
292
+ # merchant account.
293
+ #
294
+ # Replaces the full `RegionalInventory` resource if an entry with the same
295
+ # {::Google::Shopping::Merchant::Inventories::V1::RegionalInventory#region `region`}
296
+ # already exists for the product.
297
+ #
298
+ # It might take up to 30 minutes for the new or updated `RegionalInventory`
299
+ # resource to appear in products.
300
+ #
301
+ # @overload insert_regional_inventory(request, options = nil)
302
+ # Pass arguments to `insert_regional_inventory` via a request object, either of type
303
+ # {::Google::Shopping::Merchant::Inventories::V1::InsertRegionalInventoryRequest} or an equivalent Hash.
304
+ #
305
+ # @param request [::Google::Shopping::Merchant::Inventories::V1::InsertRegionalInventoryRequest, ::Hash]
306
+ # A request object representing the call parameters. Required. To specify no
307
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
308
+ # @param options [::Gapic::CallOptions, ::Hash]
309
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
310
+ #
311
+ # @overload insert_regional_inventory(parent: nil, regional_inventory: nil)
312
+ # Pass arguments to `insert_regional_inventory` via keyword arguments. Note that at
313
+ # least one keyword argument is required. To specify no parameters, or to keep all
314
+ # the default parameter values, pass an empty Hash as a request object (see above).
315
+ #
316
+ # @param parent [::String]
317
+ # Required. The account and product where this inventory will be inserted.
318
+ # Format: `accounts/{account}/products/{product}`
319
+ # @param regional_inventory [::Google::Shopping::Merchant::Inventories::V1::RegionalInventory, ::Hash]
320
+ # Required. Regional inventory information to add to the product. If the
321
+ # product already has a `RegionalInventory` resource for the same `region`,
322
+ # full replacement of the `RegionalInventory` resource is performed.
323
+ # @yield [result, operation] Access the result along with the TransportOperation object
324
+ # @yieldparam result [::Google::Shopping::Merchant::Inventories::V1::RegionalInventory]
325
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
326
+ #
327
+ # @return [::Google::Shopping::Merchant::Inventories::V1::RegionalInventory]
328
+ #
329
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
330
+ #
331
+ # @example Basic example
332
+ # require "google/shopping/merchant/inventories/v1"
333
+ #
334
+ # # Create a client object. The client can be reused for multiple calls.
335
+ # client = Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client.new
336
+ #
337
+ # # Create a request. To set request fields, pass in keyword arguments.
338
+ # request = Google::Shopping::Merchant::Inventories::V1::InsertRegionalInventoryRequest.new
339
+ #
340
+ # # Call the insert_regional_inventory method.
341
+ # result = client.insert_regional_inventory request
342
+ #
343
+ # # The returned object is of type Google::Shopping::Merchant::Inventories::V1::RegionalInventory.
344
+ # p result
345
+ #
346
+ def insert_regional_inventory request, options = nil
347
+ raise ::ArgumentError, "request must be provided" if request.nil?
348
+
349
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Inventories::V1::InsertRegionalInventoryRequest
350
+
351
+ # Converts hash and nil to an options object
352
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
353
+
354
+ # Customize the options with defaults
355
+ call_metadata = @config.rpcs.insert_regional_inventory.metadata.to_h
356
+
357
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
358
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
359
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
360
+ gapic_version: ::Google::Shopping::Merchant::Inventories::V1::VERSION,
361
+ transports_version_send: [:rest]
362
+
363
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
364
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
365
+
366
+ options.apply_defaults timeout: @config.rpcs.insert_regional_inventory.timeout,
367
+ metadata: call_metadata,
368
+ retry_policy: @config.rpcs.insert_regional_inventory.retry_policy
369
+
370
+ options.apply_defaults timeout: @config.timeout,
371
+ metadata: @config.metadata,
372
+ retry_policy: @config.retry_policy
373
+
374
+ @regional_inventory_service_stub.insert_regional_inventory request, options do |result, operation|
375
+ yield result, operation if block_given?
376
+ end
377
+ rescue ::Gapic::Rest::Error => e
378
+ raise ::Google::Cloud::Error.from_error(e)
379
+ end
380
+
381
+ ##
382
+ # Deletes the specified `RegionalInventory` resource from the given product
383
+ # in your merchant account. It might take up to an hour for the
384
+ # `RegionalInventory` to be deleted from the specific product.
385
+ # Once you have received a successful delete response, wait for that
386
+ # period before attempting a delete again.
387
+ #
388
+ # @overload delete_regional_inventory(request, options = nil)
389
+ # Pass arguments to `delete_regional_inventory` via a request object, either of type
390
+ # {::Google::Shopping::Merchant::Inventories::V1::DeleteRegionalInventoryRequest} or an equivalent Hash.
391
+ #
392
+ # @param request [::Google::Shopping::Merchant::Inventories::V1::DeleteRegionalInventoryRequest, ::Hash]
393
+ # A request object representing the call parameters. Required. To specify no
394
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
395
+ # @param options [::Gapic::CallOptions, ::Hash]
396
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
397
+ #
398
+ # @overload delete_regional_inventory(name: nil)
399
+ # Pass arguments to `delete_regional_inventory` via keyword arguments. Note that at
400
+ # least one keyword argument is required. To specify no parameters, or to keep all
401
+ # the default parameter values, pass an empty Hash as a request object (see above).
402
+ #
403
+ # @param name [::String]
404
+ # Required. The name of the `RegionalInventory` resource to delete.
405
+ # Format:
406
+ # `accounts/{account}/products/{product}/regionalInventories/{region}`
407
+ # @yield [result, operation] Access the result along with the TransportOperation object
408
+ # @yieldparam result [::Google::Protobuf::Empty]
409
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
410
+ #
411
+ # @return [::Google::Protobuf::Empty]
412
+ #
413
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
414
+ #
415
+ # @example Basic example
416
+ # require "google/shopping/merchant/inventories/v1"
417
+ #
418
+ # # Create a client object. The client can be reused for multiple calls.
419
+ # client = Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client.new
420
+ #
421
+ # # Create a request. To set request fields, pass in keyword arguments.
422
+ # request = Google::Shopping::Merchant::Inventories::V1::DeleteRegionalInventoryRequest.new
423
+ #
424
+ # # Call the delete_regional_inventory method.
425
+ # result = client.delete_regional_inventory request
426
+ #
427
+ # # The returned object is of type Google::Protobuf::Empty.
428
+ # p result
429
+ #
430
+ def delete_regional_inventory request, options = nil
431
+ raise ::ArgumentError, "request must be provided" if request.nil?
432
+
433
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Inventories::V1::DeleteRegionalInventoryRequest
434
+
435
+ # Converts hash and nil to an options object
436
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
437
+
438
+ # Customize the options with defaults
439
+ call_metadata = @config.rpcs.delete_regional_inventory.metadata.to_h
440
+
441
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
442
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
443
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
444
+ gapic_version: ::Google::Shopping::Merchant::Inventories::V1::VERSION,
445
+ transports_version_send: [:rest]
446
+
447
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
448
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
449
+
450
+ options.apply_defaults timeout: @config.rpcs.delete_regional_inventory.timeout,
451
+ metadata: call_metadata,
452
+ retry_policy: @config.rpcs.delete_regional_inventory.retry_policy
453
+
454
+ options.apply_defaults timeout: @config.timeout,
455
+ metadata: @config.metadata,
456
+ retry_policy: @config.retry_policy
457
+
458
+ @regional_inventory_service_stub.delete_regional_inventory request, options do |result, operation|
459
+ yield result, operation if block_given?
460
+ end
461
+ rescue ::Gapic::Rest::Error => e
462
+ raise ::Google::Cloud::Error.from_error(e)
463
+ end
464
+
465
+ ##
466
+ # Configuration class for the RegionalInventoryService REST API.
467
+ #
468
+ # This class represents the configuration for RegionalInventoryService REST,
469
+ # providing control over timeouts, retry behavior, logging, transport
470
+ # parameters, and other low-level controls. Certain parameters can also be
471
+ # applied individually to specific RPCs. See
472
+ # {::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client::Configuration::Rpcs}
473
+ # for a list of RPCs that can be configured independently.
474
+ #
475
+ # Configuration can be applied globally to all clients, or to a single client
476
+ # on construction.
477
+ #
478
+ # @example
479
+ #
480
+ # # Modify the global config, setting the timeout for
481
+ # # list_regional_inventories to 20 seconds,
482
+ # # and all remaining timeouts to 10 seconds.
483
+ # ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client.configure do |config|
484
+ # config.timeout = 10.0
485
+ # config.rpcs.list_regional_inventories.timeout = 20.0
486
+ # end
487
+ #
488
+ # # Apply the above configuration only to a new client.
489
+ # client = ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Rest::Client.new do |config|
490
+ # config.timeout = 10.0
491
+ # config.rpcs.list_regional_inventories.timeout = 20.0
492
+ # end
493
+ #
494
+ # @!attribute [rw] endpoint
495
+ # A custom service endpoint, as a hostname or hostname:port. The default is
496
+ # nil, indicating to use the default endpoint in the current universe domain.
497
+ # @return [::String,nil]
498
+ # @!attribute [rw] credentials
499
+ # Credentials to send with calls. You may provide any of the following types:
500
+ # * (`String`) The path to a service account key file in JSON format
501
+ # * (`Hash`) A service account key as a Hash
502
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
503
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
504
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
505
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
506
+ # * (`nil`) indicating no credentials
507
+ #
508
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
509
+ # external source for authentication to Google Cloud, you must validate it before
510
+ # providing it to a Google API client library. Providing an unvalidated credential
511
+ # configuration to Google APIs can compromise the security of your systems and data.
512
+ # For more information, refer to [Validate credential configurations from external
513
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
514
+ # @return [::Object]
515
+ # @!attribute [rw] scope
516
+ # The OAuth scopes
517
+ # @return [::Array<::String>]
518
+ # @!attribute [rw] lib_name
519
+ # The library name as recorded in instrumentation and logging
520
+ # @return [::String]
521
+ # @!attribute [rw] lib_version
522
+ # The library version as recorded in instrumentation and logging
523
+ # @return [::String]
524
+ # @!attribute [rw] timeout
525
+ # The call timeout in seconds.
526
+ # @return [::Numeric]
527
+ # @!attribute [rw] metadata
528
+ # Additional headers to be sent with the call.
529
+ # @return [::Hash{::Symbol=>::String}]
530
+ # @!attribute [rw] retry_policy
531
+ # The retry policy. The value is a hash with the following keys:
532
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
533
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
534
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
535
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
536
+ # trigger a retry.
537
+ # @return [::Hash]
538
+ # @!attribute [rw] quota_project
539
+ # A separate project against which to charge quota.
540
+ # @return [::String]
541
+ # @!attribute [rw] universe_domain
542
+ # The universe domain within which to make requests. This determines the
543
+ # default endpoint URL. The default value of nil uses the environment
544
+ # universe (usually the default "googleapis.com" universe).
545
+ # @return [::String,nil]
546
+ # @!attribute [rw] logger
547
+ # A custom logger to use for request/response debug logging, or the value
548
+ # `:default` (the default) to construct a default logger, or `nil` to
549
+ # explicitly disable logging.
550
+ # @return [::Logger,:default,nil]
551
+ #
552
+ class Configuration
553
+ extend ::Gapic::Config
554
+
555
+ # @private
556
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
557
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
558
+
559
+ config_attr :endpoint, nil, ::String, nil
560
+ config_attr :credentials, nil do |value|
561
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
562
+ allowed.any? { |klass| klass === value }
563
+ end
564
+ config_attr :scope, nil, ::String, ::Array, nil
565
+ config_attr :lib_name, nil, ::String, nil
566
+ config_attr :lib_version, nil, ::String, nil
567
+ config_attr :timeout, nil, ::Numeric, nil
568
+ config_attr :metadata, nil, ::Hash, nil
569
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
570
+ config_attr :quota_project, nil, ::String, nil
571
+ config_attr :universe_domain, nil, ::String, nil
572
+ config_attr :logger, :default, ::Logger, nil, :default
573
+
574
+ # @private
575
+ def initialize parent_config = nil
576
+ @parent_config = parent_config unless parent_config.nil?
577
+
578
+ yield self if block_given?
579
+ end
580
+
581
+ ##
582
+ # Configurations for individual RPCs
583
+ # @return [Rpcs]
584
+ #
585
+ def rpcs
586
+ @rpcs ||= begin
587
+ parent_rpcs = nil
588
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
589
+ Rpcs.new parent_rpcs
590
+ end
591
+ end
592
+
593
+ ##
594
+ # Configuration RPC class for the RegionalInventoryService API.
595
+ #
596
+ # Includes fields providing the configuration for each RPC in this service.
597
+ # Each configuration object is of type `Gapic::Config::Method` and includes
598
+ # the following configuration fields:
599
+ #
600
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
601
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
602
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
603
+ # include the following keys:
604
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
605
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
606
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
607
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
608
+ # trigger a retry.
609
+ #
610
+ class Rpcs
611
+ ##
612
+ # RPC-specific configuration for `list_regional_inventories`
613
+ # @return [::Gapic::Config::Method]
614
+ #
615
+ attr_reader :list_regional_inventories
616
+ ##
617
+ # RPC-specific configuration for `insert_regional_inventory`
618
+ # @return [::Gapic::Config::Method]
619
+ #
620
+ attr_reader :insert_regional_inventory
621
+ ##
622
+ # RPC-specific configuration for `delete_regional_inventory`
623
+ # @return [::Gapic::Config::Method]
624
+ #
625
+ attr_reader :delete_regional_inventory
626
+
627
+ # @private
628
+ def initialize parent_rpcs = nil
629
+ list_regional_inventories_config = parent_rpcs.list_regional_inventories if parent_rpcs.respond_to? :list_regional_inventories
630
+ @list_regional_inventories = ::Gapic::Config::Method.new list_regional_inventories_config
631
+ insert_regional_inventory_config = parent_rpcs.insert_regional_inventory if parent_rpcs.respond_to? :insert_regional_inventory
632
+ @insert_regional_inventory = ::Gapic::Config::Method.new insert_regional_inventory_config
633
+ delete_regional_inventory_config = parent_rpcs.delete_regional_inventory if parent_rpcs.respond_to? :delete_regional_inventory
634
+ @delete_regional_inventory = ::Gapic::Config::Method.new delete_regional_inventory_config
635
+
636
+ yield self if block_given?
637
+ end
638
+ end
639
+ end
640
+ end
641
+ end
642
+ end
643
+ end
644
+ end
645
+ end
646
+ end
647
+ end