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