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