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/localinventory_pb"
21
+ require "google/shopping/merchant/inventories/v1/local_inventory_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Inventories
27
+ module V1
28
+ module LocalInventoryService
29
+ module Rest
30
+ ##
31
+ # REST client for the LocalInventoryService service.
32
+ #
33
+ # Service to manage local inventory for products
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 :local_inventory_service_stub
46
+
47
+ ##
48
+ # Configure the LocalInventoryService Client class.
49
+ #
50
+ # See {::Google::Shopping::Merchant::Inventories::V1::LocalInventoryService::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all LocalInventoryService clients
56
+ # ::Google::Shopping::Merchant::Inventories::V1::LocalInventoryService::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", "Inventories", "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 LocalInventoryService 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::Inventories::V1::LocalInventoryService::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
+ @local_inventory_service_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new LocalInventoryService REST client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Shopping::Merchant::Inventories::V1::LocalInventoryService::Rest::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Shopping::Merchant::Inventories::V1::LocalInventoryService::Rest::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the LocalInventoryService 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
+ @local_inventory_service_stub = ::Google::Shopping::Merchant::Inventories::V1::LocalInventoryService::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
+ @local_inventory_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
+ @local_inventory_service_stub.logger
181
+ end
182
+
183
+ # Service calls
184
+
185
+ ##
186
+ # Lists the `LocalInventory` resources for the given product in your merchant
187
+ # account. The response might contain fewer items than specified by
188
+ # `pageSize`. If `pageToken` was returned in previous request, it can be used
189
+ # to obtain additional results.
190
+ #
191
+ # `LocalInventory` resources are listed per product for a given account.
192
+ #
193
+ # @overload list_local_inventories(request, options = nil)
194
+ # Pass arguments to `list_local_inventories` via a request object, either of type
195
+ # {::Google::Shopping::Merchant::Inventories::V1::ListLocalInventoriesRequest} or an equivalent Hash.
196
+ #
197
+ # @param request [::Google::Shopping::Merchant::Inventories::V1::ListLocalInventoriesRequest, ::Hash]
198
+ # A request object representing the call parameters. Required. To specify no
199
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
200
+ # @param options [::Gapic::CallOptions, ::Hash]
201
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
202
+ #
203
+ # @overload list_local_inventories(parent: nil, page_size: nil, page_token: nil)
204
+ # Pass arguments to `list_local_inventories` via keyword arguments. Note that at
205
+ # least one keyword argument is required. To specify no parameters, or to keep all
206
+ # the default parameter values, pass an empty Hash as a request object (see above).
207
+ #
208
+ # @param parent [::String]
209
+ # Required. The `name` of the parent product to list local inventories for.
210
+ # Format:
211
+ # `accounts/{account}/products/{product}`
212
+ # @param page_size [::Integer]
213
+ # The maximum number of `LocalInventory` resources for the given
214
+ # product to return. The service returns fewer than this value if the number
215
+ # of inventories for the given product is less that than the `pageSize`. The
216
+ # default value is 25000. The maximum value is 25000; 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 `ListLocalInventories` call.
220
+ # Provide the page token to retrieve the subsequent page.
221
+ #
222
+ # When paginating, all other parameters provided to `ListLocalInventories`
223
+ # must match the call that provided the page token. The token returned as
224
+ # {::Google::Shopping::Merchant::Inventories::V1::ListLocalInventoriesResponse#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::LocalInventory>]
228
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
229
+ #
230
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Inventories::V1::LocalInventory>]
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::LocalInventoryService::Rest::Client.new
239
+ #
240
+ # # Create a request. To set request fields, pass in keyword arguments.
241
+ # request = Google::Shopping::Merchant::Inventories::V1::ListLocalInventoriesRequest.new
242
+ #
243
+ # # Call the list_local_inventories method.
244
+ # result = client.list_local_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::LocalInventory.
250
+ # p item
251
+ # end
252
+ #
253
+ def list_local_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::ListLocalInventoriesRequest
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_local_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_local_inventories.timeout,
274
+ metadata: call_metadata,
275
+ retry_policy: @config.rpcs.list_local_inventories.retry_policy
276
+
277
+ options.apply_defaults timeout: @config.timeout,
278
+ metadata: @config.metadata,
279
+ retry_policy: @config.retry_policy
280
+
281
+ @local_inventory_service_stub.list_local_inventories request, options do |result, operation|
282
+ result = ::Gapic::Rest::PagedEnumerable.new @local_inventory_service_stub, :list_local_inventories, "local_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 `LocalInventory` resource to a product in your merchant
292
+ # account.
293
+ #
294
+ # Replaces the full `LocalInventory` resource if an entry with the same
295
+ # {::Google::Shopping::Merchant::Inventories::V1::LocalInventory#store_code `storeCode`}
296
+ # already exists for the product.
297
+ #
298
+ # It might take up to 30 minutes for the new or updated `LocalInventory`
299
+ # resource to appear in products.
300
+ #
301
+ # @overload insert_local_inventory(request, options = nil)
302
+ # Pass arguments to `insert_local_inventory` via a request object, either of type
303
+ # {::Google::Shopping::Merchant::Inventories::V1::InsertLocalInventoryRequest} or an equivalent Hash.
304
+ #
305
+ # @param request [::Google::Shopping::Merchant::Inventories::V1::InsertLocalInventoryRequest, ::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_local_inventory(parent: nil, local_inventory: nil)
312
+ # Pass arguments to `insert_local_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 local_inventory [::Google::Shopping::Merchant::Inventories::V1::LocalInventory, ::Hash]
320
+ # Required. Local inventory information of the product. If the product
321
+ # already has a `LocalInventory` resource for the same `storeCode`, full
322
+ # replacement of the `LocalInventory` resource is performed.
323
+ # @yield [result, operation] Access the result along with the TransportOperation object
324
+ # @yieldparam result [::Google::Shopping::Merchant::Inventories::V1::LocalInventory]
325
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
326
+ #
327
+ # @return [::Google::Shopping::Merchant::Inventories::V1::LocalInventory]
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::LocalInventoryService::Rest::Client.new
336
+ #
337
+ # # Create a request. To set request fields, pass in keyword arguments.
338
+ # request = Google::Shopping::Merchant::Inventories::V1::InsertLocalInventoryRequest.new
339
+ #
340
+ # # Call the insert_local_inventory method.
341
+ # result = client.insert_local_inventory request
342
+ #
343
+ # # The returned object is of type Google::Shopping::Merchant::Inventories::V1::LocalInventory.
344
+ # p result
345
+ #
346
+ def insert_local_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::InsertLocalInventoryRequest
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_local_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_local_inventory.timeout,
367
+ metadata: call_metadata,
368
+ retry_policy: @config.rpcs.insert_local_inventory.retry_policy
369
+
370
+ options.apply_defaults timeout: @config.timeout,
371
+ metadata: @config.metadata,
372
+ retry_policy: @config.retry_policy
373
+
374
+ @local_inventory_service_stub.insert_local_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 `LocalInventory` from the given product in your
383
+ # merchant account. It might take a up to an hour for the
384
+ # `LocalInventory` 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_local_inventory(request, options = nil)
389
+ # Pass arguments to `delete_local_inventory` via a request object, either of type
390
+ # {::Google::Shopping::Merchant::Inventories::V1::DeleteLocalInventoryRequest} or an equivalent Hash.
391
+ #
392
+ # @param request [::Google::Shopping::Merchant::Inventories::V1::DeleteLocalInventoryRequest, ::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_local_inventory(name: nil)
399
+ # Pass arguments to `delete_local_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 local inventory for the given product to delete.
405
+ # Format:
406
+ # `accounts/{account}/products/{product}/localInventories/{store_code}`
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::LocalInventoryService::Rest::Client.new
420
+ #
421
+ # # Create a request. To set request fields, pass in keyword arguments.
422
+ # request = Google::Shopping::Merchant::Inventories::V1::DeleteLocalInventoryRequest.new
423
+ #
424
+ # # Call the delete_local_inventory method.
425
+ # result = client.delete_local_inventory request
426
+ #
427
+ # # The returned object is of type Google::Protobuf::Empty.
428
+ # p result
429
+ #
430
+ def delete_local_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::DeleteLocalInventoryRequest
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_local_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_local_inventory.timeout,
451
+ metadata: call_metadata,
452
+ retry_policy: @config.rpcs.delete_local_inventory.retry_policy
453
+
454
+ options.apply_defaults timeout: @config.timeout,
455
+ metadata: @config.metadata,
456
+ retry_policy: @config.retry_policy
457
+
458
+ @local_inventory_service_stub.delete_local_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 LocalInventoryService REST API.
467
+ #
468
+ # This class represents the configuration for LocalInventoryService 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::LocalInventoryService::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_local_inventories to 20 seconds,
482
+ # # and all remaining timeouts to 10 seconds.
483
+ # ::Google::Shopping::Merchant::Inventories::V1::LocalInventoryService::Rest::Client.configure do |config|
484
+ # config.timeout = 10.0
485
+ # config.rpcs.list_local_inventories.timeout = 20.0
486
+ # end
487
+ #
488
+ # # Apply the above configuration only to a new client.
489
+ # client = ::Google::Shopping::Merchant::Inventories::V1::LocalInventoryService::Rest::Client.new do |config|
490
+ # config.timeout = 10.0
491
+ # config.rpcs.list_local_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 LocalInventoryService 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_local_inventories`
613
+ # @return [::Gapic::Config::Method]
614
+ #
615
+ attr_reader :list_local_inventories
616
+ ##
617
+ # RPC-specific configuration for `insert_local_inventory`
618
+ # @return [::Gapic::Config::Method]
619
+ #
620
+ attr_reader :insert_local_inventory
621
+ ##
622
+ # RPC-specific configuration for `delete_local_inventory`
623
+ # @return [::Gapic::Config::Method]
624
+ #
625
+ attr_reader :delete_local_inventory
626
+
627
+ # @private
628
+ def initialize parent_rpcs = nil
629
+ list_local_inventories_config = parent_rpcs.list_local_inventories if parent_rpcs.respond_to? :list_local_inventories
630
+ @list_local_inventories = ::Gapic::Config::Method.new list_local_inventories_config
631
+ insert_local_inventory_config = parent_rpcs.insert_local_inventory if parent_rpcs.respond_to? :insert_local_inventory
632
+ @insert_local_inventory = ::Gapic::Config::Method.new insert_local_inventory_config
633
+ delete_local_inventory_config = parent_rpcs.delete_local_inventory if parent_rpcs.respond_to? :delete_local_inventory
634
+ @delete_local_inventory = ::Gapic::Config::Method.new delete_local_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