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/regionalinventory_pb"
21
+
22
+ module Google
23
+ module Shopping
24
+ module Merchant
25
+ module Inventories
26
+ module V1
27
+ module RegionalInventoryService
28
+ ##
29
+ # Client for the RegionalInventoryService service.
30
+ #
31
+ # Service to manage regional inventory for products. There is also separate
32
+ # `regions` resource and API to manage regions definitions.
33
+ #
34
+ class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
38
+ # @private
39
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
40
+
41
+ include Paths
42
+
43
+ # @private
44
+ attr_reader :regional_inventory_service_stub
45
+
46
+ ##
47
+ # Configure the RegionalInventoryService Client class.
48
+ #
49
+ # See {::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Client::Configuration}
50
+ # for a description of the configuration fields.
51
+ #
52
+ # @example
53
+ #
54
+ # # Modify the configuration for all RegionalInventoryService clients
55
+ # ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Client.configure do |config|
56
+ # config.timeout = 10.0
57
+ # end
58
+ #
59
+ # @yield [config] Configure the Client client.
60
+ # @yieldparam config [Client::Configuration]
61
+ #
62
+ # @return [Client::Configuration]
63
+ #
64
+ def self.configure
65
+ @configure ||= begin
66
+ namespace = ["Google", "Shopping", "Merchant", "Inventories", "V1"]
67
+ parent_config = while namespace.any?
68
+ parent_name = namespace.join "::"
69
+ parent_const = const_get parent_name
70
+ break parent_const.configure if parent_const.respond_to? :configure
71
+ namespace.pop
72
+ end
73
+ default_config = Client::Configuration.new parent_config
74
+
75
+ default_config.timeout = 60.0
76
+ default_config.retry_policy = {
77
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
78
+ }
79
+
80
+ default_config
81
+ end
82
+ yield @configure if block_given?
83
+ @configure
84
+ end
85
+
86
+ ##
87
+ # Configure the RegionalInventoryService Client instance.
88
+ #
89
+ # The configuration is set to the derived mode, meaning that values can be changed,
90
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
91
+ # should be made on {Client.configure}.
92
+ #
93
+ # See {::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Client::Configuration}
94
+ # for a description of the configuration fields.
95
+ #
96
+ # @yield [config] Configure the Client client.
97
+ # @yieldparam config [Client::Configuration]
98
+ #
99
+ # @return [Client::Configuration]
100
+ #
101
+ def configure
102
+ yield @config if block_given?
103
+ @config
104
+ end
105
+
106
+ ##
107
+ # The effective universe domain
108
+ #
109
+ # @return [String]
110
+ #
111
+ def universe_domain
112
+ @regional_inventory_service_stub.universe_domain
113
+ end
114
+
115
+ ##
116
+ # Create a new RegionalInventoryService client object.
117
+ #
118
+ # @example
119
+ #
120
+ # # Create a client using the default configuration
121
+ # client = ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Client.new
122
+ #
123
+ # # Create a client using a custom configuration
124
+ # client = ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Client.new do |config|
125
+ # config.timeout = 10.0
126
+ # end
127
+ #
128
+ # @yield [config] Configure the RegionalInventoryService client.
129
+ # @yieldparam config [Client::Configuration]
130
+ #
131
+ def initialize
132
+ # These require statements are intentionally placed here to initialize
133
+ # the gRPC module only when it's required.
134
+ # See https://github.com/googleapis/toolkit/issues/446
135
+ require "gapic/grpc"
136
+ require "google/shopping/merchant/inventories/v1/regionalinventory_services_pb"
137
+
138
+ # Create the configuration object
139
+ @config = Configuration.new Client.configure
140
+
141
+ # Yield the configuration if needed
142
+ yield @config if block_given?
143
+
144
+ # Create credentials
145
+ credentials = @config.credentials
146
+ # Use self-signed JWT if the endpoint is unchanged from default,
147
+ # but only if the default endpoint does not have a region prefix.
148
+ enable_self_signed_jwt = @config.endpoint.nil? ||
149
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
150
+ !@config.endpoint.split(".").first.include?("-"))
151
+ credentials ||= Credentials.default scope: @config.scope,
152
+ enable_self_signed_jwt: enable_self_signed_jwt
153
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
154
+ credentials = Credentials.new credentials, scope: @config.scope
155
+ end
156
+ @quota_project_id = @config.quota_project
157
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
158
+
159
+ @regional_inventory_service_stub = ::Gapic::ServiceStub.new(
160
+ ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Stub,
161
+ credentials: credentials,
162
+ endpoint: @config.endpoint,
163
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
164
+ universe_domain: @config.universe_domain,
165
+ channel_args: @config.channel_args,
166
+ interceptors: @config.interceptors,
167
+ channel_pool_config: @config.channel_pool,
168
+ logger: @config.logger
169
+ )
170
+
171
+ @regional_inventory_service_stub.stub_logger&.info do |entry|
172
+ entry.set_system_name
173
+ entry.set_service
174
+ entry.message = "Created client for #{entry.service}"
175
+ entry.set_credentials_fields credentials
176
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
177
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
178
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
179
+ end
180
+ end
181
+
182
+ ##
183
+ # The logger used for request/response debug logging.
184
+ #
185
+ # @return [Logger]
186
+ #
187
+ def logger
188
+ @regional_inventory_service_stub.logger
189
+ end
190
+
191
+ # Service calls
192
+
193
+ ##
194
+ # Lists the `RegionalInventory` resources for the given product in your
195
+ # merchant account. The response might contain fewer items than specified by
196
+ # `pageSize`. If `pageToken` was returned in previous request, it can be
197
+ # used to obtain additional results.
198
+ #
199
+ # `RegionalInventory` resources are listed per product for a given account.
200
+ #
201
+ # @overload list_regional_inventories(request, options = nil)
202
+ # Pass arguments to `list_regional_inventories` via a request object, either of type
203
+ # {::Google::Shopping::Merchant::Inventories::V1::ListRegionalInventoriesRequest} or an equivalent Hash.
204
+ #
205
+ # @param request [::Google::Shopping::Merchant::Inventories::V1::ListRegionalInventoriesRequest, ::Hash]
206
+ # A request object representing the call parameters. Required. To specify no
207
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
208
+ # @param options [::Gapic::CallOptions, ::Hash]
209
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
210
+ #
211
+ # @overload list_regional_inventories(parent: nil, page_size: nil, page_token: nil)
212
+ # Pass arguments to `list_regional_inventories` via keyword arguments. Note that at
213
+ # least one keyword argument is required. To specify no parameters, or to keep all
214
+ # the default parameter values, pass an empty Hash as a request object (see above).
215
+ #
216
+ # @param parent [::String]
217
+ # Required. The `name` of the parent product to list `RegionalInventory`
218
+ # resources for. Format: `accounts/{account}/products/{product}`
219
+ # @param page_size [::Integer]
220
+ # The maximum number of `RegionalInventory` resources for the given product
221
+ # to return. The service returns fewer than this value if the number of
222
+ # inventories for the given product is less that than the `pageSize`. The
223
+ # default value is 25000. The maximum value is 100000; 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 `ListRegionalInventories` call.
227
+ # Provide the page token to retrieve the subsequent page.
228
+ #
229
+ # When paginating, all other parameters provided to `ListRegionalInventories`
230
+ # must match the call that provided the page token. The token returned as
231
+ # {::Google::Shopping::Merchant::Inventories::V1::ListRegionalInventoriesResponse#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::RegionalInventory>]
236
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
237
+ #
238
+ # @return [::Gapic::PagedEnumerable<::Google::Shopping::Merchant::Inventories::V1::RegionalInventory>]
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::RegionalInventoryService::Client.new
247
+ #
248
+ # # Create a request. To set request fields, pass in keyword arguments.
249
+ # request = Google::Shopping::Merchant::Inventories::V1::ListRegionalInventoriesRequest.new
250
+ #
251
+ # # Call the list_regional_inventories method.
252
+ # result = client.list_regional_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::RegionalInventory.
258
+ # p item
259
+ # end
260
+ #
261
+ def list_regional_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::ListRegionalInventoriesRequest
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_regional_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_regional_inventories.timeout,
288
+ metadata: metadata,
289
+ retry_policy: @config.rpcs.list_regional_inventories.retry_policy
290
+
291
+ options.apply_defaults timeout: @config.timeout,
292
+ metadata: @config.metadata,
293
+ retry_policy: @config.retry_policy
294
+
295
+ @regional_inventory_service_stub.call_rpc :list_regional_inventories, request, options: options do |response, operation|
296
+ response = ::Gapic::PagedEnumerable.new @regional_inventory_service_stub, :list_regional_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 `RegionalInventory` to a given product in your
306
+ # merchant account.
307
+ #
308
+ # Replaces the full `RegionalInventory` resource if an entry with the same
309
+ # {::Google::Shopping::Merchant::Inventories::V1::RegionalInventory#region `region`}
310
+ # already exists for the product.
311
+ #
312
+ # It might take up to 30 minutes for the new or updated `RegionalInventory`
313
+ # resource to appear in products.
314
+ #
315
+ # @overload insert_regional_inventory(request, options = nil)
316
+ # Pass arguments to `insert_regional_inventory` via a request object, either of type
317
+ # {::Google::Shopping::Merchant::Inventories::V1::InsertRegionalInventoryRequest} or an equivalent Hash.
318
+ #
319
+ # @param request [::Google::Shopping::Merchant::Inventories::V1::InsertRegionalInventoryRequest, ::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_regional_inventory(parent: nil, regional_inventory: nil)
326
+ # Pass arguments to `insert_regional_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 regional_inventory [::Google::Shopping::Merchant::Inventories::V1::RegionalInventory, ::Hash]
334
+ # Required. Regional inventory information to add to the product. If the
335
+ # product already has a `RegionalInventory` resource for the same `region`,
336
+ # full replacement of the `RegionalInventory` resource is performed.
337
+ #
338
+ # @yield [response, operation] Access the result along with the RPC operation
339
+ # @yieldparam response [::Google::Shopping::Merchant::Inventories::V1::RegionalInventory]
340
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
341
+ #
342
+ # @return [::Google::Shopping::Merchant::Inventories::V1::RegionalInventory]
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::RegionalInventoryService::Client.new
351
+ #
352
+ # # Create a request. To set request fields, pass in keyword arguments.
353
+ # request = Google::Shopping::Merchant::Inventories::V1::InsertRegionalInventoryRequest.new
354
+ #
355
+ # # Call the insert_regional_inventory method.
356
+ # result = client.insert_regional_inventory request
357
+ #
358
+ # # The returned object is of type Google::Shopping::Merchant::Inventories::V1::RegionalInventory.
359
+ # p result
360
+ #
361
+ def insert_regional_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::InsertRegionalInventoryRequest
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_regional_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_regional_inventory.timeout,
388
+ metadata: metadata,
389
+ retry_policy: @config.rpcs.insert_regional_inventory.retry_policy
390
+
391
+ options.apply_defaults timeout: @config.timeout,
392
+ metadata: @config.metadata,
393
+ retry_policy: @config.retry_policy
394
+
395
+ @regional_inventory_service_stub.call_rpc :insert_regional_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 `RegionalInventory` resource from the given product
404
+ # in your merchant account. It might take up to an hour for the
405
+ # `RegionalInventory` 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_regional_inventory(request, options = nil)
410
+ # Pass arguments to `delete_regional_inventory` via a request object, either of type
411
+ # {::Google::Shopping::Merchant::Inventories::V1::DeleteRegionalInventoryRequest} or an equivalent Hash.
412
+ #
413
+ # @param request [::Google::Shopping::Merchant::Inventories::V1::DeleteRegionalInventoryRequest, ::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_regional_inventory(name: nil)
420
+ # Pass arguments to `delete_regional_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 `RegionalInventory` resource to delete.
426
+ # Format:
427
+ # `accounts/{account}/products/{product}/regionalInventories/{region}`
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::RegionalInventoryService::Client.new
442
+ #
443
+ # # Create a request. To set request fields, pass in keyword arguments.
444
+ # request = Google::Shopping::Merchant::Inventories::V1::DeleteRegionalInventoryRequest.new
445
+ #
446
+ # # Call the delete_regional_inventory method.
447
+ # result = client.delete_regional_inventory request
448
+ #
449
+ # # The returned object is of type Google::Protobuf::Empty.
450
+ # p result
451
+ #
452
+ def delete_regional_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::DeleteRegionalInventoryRequest
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_regional_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_regional_inventory.timeout,
479
+ metadata: metadata,
480
+ retry_policy: @config.rpcs.delete_regional_inventory.retry_policy
481
+
482
+ options.apply_defaults timeout: @config.timeout,
483
+ metadata: @config.metadata,
484
+ retry_policy: @config.retry_policy
485
+
486
+ @regional_inventory_service_stub.call_rpc :delete_regional_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 RegionalInventoryService API.
495
+ #
496
+ # This class represents the configuration for RegionalInventoryService,
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::RegionalInventoryService::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_regional_inventories to 20 seconds,
510
+ # # and all remaining timeouts to 10 seconds.
511
+ # ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Client.configure do |config|
512
+ # config.timeout = 10.0
513
+ # config.rpcs.list_regional_inventories.timeout = 20.0
514
+ # end
515
+ #
516
+ # # Apply the above configuration only to a new client.
517
+ # client = ::Google::Shopping::Merchant::Inventories::V1::RegionalInventoryService::Client.new do |config|
518
+ # config.timeout = 10.0
519
+ # config.rpcs.list_regional_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 RegionalInventoryService 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_regional_inventories`
661
+ # @return [::Gapic::Config::Method]
662
+ #
663
+ attr_reader :list_regional_inventories
664
+ ##
665
+ # RPC-specific configuration for `insert_regional_inventory`
666
+ # @return [::Gapic::Config::Method]
667
+ #
668
+ attr_reader :insert_regional_inventory
669
+ ##
670
+ # RPC-specific configuration for `delete_regional_inventory`
671
+ # @return [::Gapic::Config::Method]
672
+ #
673
+ attr_reader :delete_regional_inventory
674
+
675
+ # @private
676
+ def initialize parent_rpcs = nil
677
+ list_regional_inventories_config = parent_rpcs.list_regional_inventories if parent_rpcs.respond_to? :list_regional_inventories
678
+ @list_regional_inventories = ::Gapic::Config::Method.new list_regional_inventories_config
679
+ insert_regional_inventory_config = parent_rpcs.insert_regional_inventory if parent_rpcs.respond_to? :insert_regional_inventory
680
+ @insert_regional_inventory = ::Gapic::Config::Method.new insert_regional_inventory_config
681
+ delete_regional_inventory_config = parent_rpcs.delete_regional_inventory if parent_rpcs.respond_to? :delete_regional_inventory
682
+ @delete_regional_inventory = ::Gapic::Config::Method.new delete_regional_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