google-shopping-merchant-inventories-v1beta 0.a → 0.1.0

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