google-shopping-merchant-inventories-v1beta 0.a → 0.2.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 +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/regionalinventory_pb"
21
+
22
+ module Google
23
+ module Shopping
24
+ module Merchant
25
+ module Inventories
26
+ module V1beta
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
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
37
+
38
+ include Paths
39
+
40
+ # @private
41
+ attr_reader :regional_inventory_service_stub
42
+
43
+ ##
44
+ # Configure the RegionalInventoryService Client class.
45
+ #
46
+ # See {::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventoryService::Client::Configuration}
47
+ # for a description of the configuration fields.
48
+ #
49
+ # @example
50
+ #
51
+ # # Modify the configuration for all RegionalInventoryService clients
52
+ # ::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventoryService::Client.configure do |config|
53
+ # config.timeout = 10.0
54
+ # end
55
+ #
56
+ # @yield [config] Configure the Client client.
57
+ # @yieldparam config [Client::Configuration]
58
+ #
59
+ # @return [Client::Configuration]
60
+ #
61
+ def self.configure
62
+ @configure ||= begin
63
+ namespace = ["Google", "Shopping", "Merchant", "Inventories", "V1beta"]
64
+ parent_config = while namespace.any?
65
+ parent_name = namespace.join "::"
66
+ parent_const = const_get parent_name
67
+ break parent_const.configure if parent_const.respond_to? :configure
68
+ namespace.pop
69
+ end
70
+ default_config = Client::Configuration.new parent_config
71
+
72
+ default_config.timeout = 60.0
73
+ default_config.retry_policy = {
74
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
75
+ }
76
+
77
+ default_config
78
+ end
79
+ yield @configure if block_given?
80
+ @configure
81
+ end
82
+
83
+ ##
84
+ # Configure the RegionalInventoryService Client instance.
85
+ #
86
+ # The configuration is set to the derived mode, meaning that values can be changed,
87
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
88
+ # should be made on {Client.configure}.
89
+ #
90
+ # See {::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventoryService::Client::Configuration}
91
+ # for a description of the configuration fields.
92
+ #
93
+ # @yield [config] Configure the Client client.
94
+ # @yieldparam config [Client::Configuration]
95
+ #
96
+ # @return [Client::Configuration]
97
+ #
98
+ def configure
99
+ yield @config if block_given?
100
+ @config
101
+ end
102
+
103
+ ##
104
+ # The effective universe domain
105
+ #
106
+ # @return [String]
107
+ #
108
+ def universe_domain
109
+ @regional_inventory_service_stub.universe_domain
110
+ end
111
+
112
+ ##
113
+ # Create a new RegionalInventoryService client object.
114
+ #
115
+ # @example
116
+ #
117
+ # # Create a client using the default configuration
118
+ # client = ::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventoryService::Client.new
119
+ #
120
+ # # Create a client using a custom configuration
121
+ # client = ::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventoryService::Client.new do |config|
122
+ # config.timeout = 10.0
123
+ # end
124
+ #
125
+ # @yield [config] Configure the RegionalInventoryService client.
126
+ # @yieldparam config [Client::Configuration]
127
+ #
128
+ def initialize
129
+ # These require statements are intentionally placed here to initialize
130
+ # the gRPC module only when it's required.
131
+ # See https://github.com/googleapis/toolkit/issues/446
132
+ require "gapic/grpc"
133
+ require "google/shopping/merchant/inventories/v1beta/regionalinventory_services_pb"
134
+
135
+ # Create the configuration object
136
+ @config = Configuration.new Client.configure
137
+
138
+ # Yield the configuration if needed
139
+ yield @config if block_given?
140
+
141
+ # Create credentials
142
+ credentials = @config.credentials
143
+ # Use self-signed JWT if the endpoint is unchanged from default,
144
+ # but only if the default endpoint does not have a region prefix.
145
+ enable_self_signed_jwt = @config.endpoint.nil? ||
146
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
147
+ !@config.endpoint.split(".").first.include?("-"))
148
+ credentials ||= Credentials.default scope: @config.scope,
149
+ enable_self_signed_jwt: enable_self_signed_jwt
150
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
151
+ credentials = Credentials.new credentials, scope: @config.scope
152
+ end
153
+ @quota_project_id = @config.quota_project
154
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
155
+
156
+ @regional_inventory_service_stub = ::Gapic::ServiceStub.new(
157
+ ::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventoryService::Stub,
158
+ credentials: credentials,
159
+ endpoint: @config.endpoint,
160
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
161
+ universe_domain: @config.universe_domain,
162
+ channel_args: @config.channel_args,
163
+ interceptors: @config.interceptors,
164
+ channel_pool_config: @config.channel_pool
165
+ )
166
+ end
167
+
168
+ # Service calls
169
+
170
+ ##
171
+ # Lists the `RegionalInventory` resources for the given product in your
172
+ # merchant account. The response might contain fewer items than specified by
173
+ # `pageSize`. If `pageToken` was returned in previous request, it can be
174
+ # used to obtain additional results.
175
+ #
176
+ # `RegionalInventory` resources are listed per product for a given account.
177
+ #
178
+ # @overload list_regional_inventories(request, options = nil)
179
+ # Pass arguments to `list_regional_inventories` via a request object, either of type
180
+ # {::Google::Shopping::Merchant::Inventories::V1beta::ListRegionalInventoriesRequest} or an equivalent Hash.
181
+ #
182
+ # @param request [::Google::Shopping::Merchant::Inventories::V1beta::ListRegionalInventoriesRequest, ::Hash]
183
+ # A request object representing the call parameters. Required. To specify no
184
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
185
+ # @param options [::Gapic::CallOptions, ::Hash]
186
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
187
+ #
188
+ # @overload list_regional_inventories(parent: nil, page_size: nil, page_token: nil)
189
+ # Pass arguments to `list_regional_inventories` via keyword arguments. Note that at
190
+ # least one keyword argument is required. To specify no parameters, or to keep all
191
+ # the default parameter values, pass an empty Hash as a request object (see above).
192
+ #
193
+ # @param parent [::String]
194
+ # Required. The `name` of the parent product to list `RegionalInventory`
195
+ # resources for. Format: `accounts/{account}/products/{product}`
196
+ # @param page_size [::Integer]
197
+ # The maximum number of `RegionalInventory` resources for the given product
198
+ # to return. The service returns fewer than this value if the number of
199
+ # inventories for the given product is less that than the `pageSize`. The
200
+ # default value is 25000. The maximum value is 100000; 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 `ListRegionalInventories` call.
204
+ # Provide the page token to retrieve the subsequent page.
205
+ #
206
+ # When paginating, all other parameters provided to `ListRegionalInventories`
207
+ # must match the call that provided the page token. The token returned as
208
+ # {::Google::Shopping::Merchant::Inventories::V1beta::ListRegionalInventoriesResponse#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::RegionalInventory>]
213
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
214
+ #
215
+ # @return [::Gapic::PagedEnumerable<::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventory>]
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::RegionalInventoryService::Client.new
224
+ #
225
+ # # Create a request. To set request fields, pass in keyword arguments.
226
+ # request = Google::Shopping::Merchant::Inventories::V1beta::ListRegionalInventoriesRequest.new
227
+ #
228
+ # # Call the list_regional_inventories method.
229
+ # result = client.list_regional_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::RegionalInventory.
235
+ # p item
236
+ # end
237
+ #
238
+ def list_regional_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::ListRegionalInventoriesRequest
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_regional_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_regional_inventories.timeout,
264
+ metadata: metadata,
265
+ retry_policy: @config.rpcs.list_regional_inventories.retry_policy
266
+
267
+ options.apply_defaults timeout: @config.timeout,
268
+ metadata: @config.metadata,
269
+ retry_policy: @config.retry_policy
270
+
271
+ @regional_inventory_service_stub.call_rpc :list_regional_inventories, request, options: options do |response, operation|
272
+ response = ::Gapic::PagedEnumerable.new @regional_inventory_service_stub, :list_regional_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 `RegionalInventory` to a given product in your
282
+ # merchant account.
283
+ #
284
+ # Replaces the full `RegionalInventory` resource if an entry with the same
285
+ # {::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventory#region `region`}
286
+ # already exists for the product.
287
+ #
288
+ # It might take up to 30 minutes for the new or updated `RegionalInventory`
289
+ # resource to appear in products.
290
+ #
291
+ # @overload insert_regional_inventory(request, options = nil)
292
+ # Pass arguments to `insert_regional_inventory` via a request object, either of type
293
+ # {::Google::Shopping::Merchant::Inventories::V1beta::InsertRegionalInventoryRequest} or an equivalent Hash.
294
+ #
295
+ # @param request [::Google::Shopping::Merchant::Inventories::V1beta::InsertRegionalInventoryRequest, ::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_regional_inventory(parent: nil, regional_inventory: nil)
302
+ # Pass arguments to `insert_regional_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 regional_inventory [::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventory, ::Hash]
310
+ # Required. Regional inventory information to add to the product. If the
311
+ # product already has a `RegionalInventory` resource for the same `region`,
312
+ # full replacement of the `RegionalInventory` resource is performed.
313
+ #
314
+ # @yield [response, operation] Access the result along with the RPC operation
315
+ # @yieldparam response [::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventory]
316
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
317
+ #
318
+ # @return [::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventory]
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::RegionalInventoryService::Client.new
327
+ #
328
+ # # Create a request. To set request fields, pass in keyword arguments.
329
+ # request = Google::Shopping::Merchant::Inventories::V1beta::InsertRegionalInventoryRequest.new
330
+ #
331
+ # # Call the insert_regional_inventory method.
332
+ # result = client.insert_regional_inventory request
333
+ #
334
+ # # The returned object is of type Google::Shopping::Merchant::Inventories::V1beta::RegionalInventory.
335
+ # p result
336
+ #
337
+ def insert_regional_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::InsertRegionalInventoryRequest
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_regional_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_regional_inventory.timeout,
363
+ metadata: metadata,
364
+ retry_policy: @config.rpcs.insert_regional_inventory.retry_policy
365
+
366
+ options.apply_defaults timeout: @config.timeout,
367
+ metadata: @config.metadata,
368
+ retry_policy: @config.retry_policy
369
+
370
+ @regional_inventory_service_stub.call_rpc :insert_regional_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 `RegionalInventory` resource from the given product
380
+ # in your merchant account. It might take up to an hour for the
381
+ # `RegionalInventory` 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_regional_inventory(request, options = nil)
386
+ # Pass arguments to `delete_regional_inventory` via a request object, either of type
387
+ # {::Google::Shopping::Merchant::Inventories::V1beta::DeleteRegionalInventoryRequest} or an equivalent Hash.
388
+ #
389
+ # @param request [::Google::Shopping::Merchant::Inventories::V1beta::DeleteRegionalInventoryRequest, ::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_regional_inventory(name: nil)
396
+ # Pass arguments to `delete_regional_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 `RegionalInventory` resource to delete.
402
+ # Format:
403
+ # `accounts/{account}/products/{product}/regionalInventories/{region}`
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::RegionalInventoryService::Client.new
418
+ #
419
+ # # Create a request. To set request fields, pass in keyword arguments.
420
+ # request = Google::Shopping::Merchant::Inventories::V1beta::DeleteRegionalInventoryRequest.new
421
+ #
422
+ # # Call the delete_regional_inventory method.
423
+ # result = client.delete_regional_inventory request
424
+ #
425
+ # # The returned object is of type Google::Protobuf::Empty.
426
+ # p result
427
+ #
428
+ def delete_regional_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::DeleteRegionalInventoryRequest
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_regional_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_regional_inventory.timeout,
454
+ metadata: metadata,
455
+ retry_policy: @config.rpcs.delete_regional_inventory.retry_policy
456
+
457
+ options.apply_defaults timeout: @config.timeout,
458
+ metadata: @config.metadata,
459
+ retry_policy: @config.retry_policy
460
+
461
+ @regional_inventory_service_stub.call_rpc :delete_regional_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 RegionalInventoryService API.
471
+ #
472
+ # This class represents the configuration for RegionalInventoryService,
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::RegionalInventoryService::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_regional_inventories to 20 seconds,
486
+ # # and all remaining timeouts to 10 seconds.
487
+ # ::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventoryService::Client.configure do |config|
488
+ # config.timeout = 10.0
489
+ # config.rpcs.list_regional_inventories.timeout = 20.0
490
+ # end
491
+ #
492
+ # # Apply the above configuration only to a new client.
493
+ # client = ::Google::Shopping::Merchant::Inventories::V1beta::RegionalInventoryService::Client.new do |config|
494
+ # config.timeout = 10.0
495
+ # config.rpcs.list_regional_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 RegionalInventoryService 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_regional_inventories`
624
+ # @return [::Gapic::Config::Method]
625
+ #
626
+ attr_reader :list_regional_inventories
627
+ ##
628
+ # RPC-specific configuration for `insert_regional_inventory`
629
+ # @return [::Gapic::Config::Method]
630
+ #
631
+ attr_reader :insert_regional_inventory
632
+ ##
633
+ # RPC-specific configuration for `delete_regional_inventory`
634
+ # @return [::Gapic::Config::Method]
635
+ #
636
+ attr_reader :delete_regional_inventory
637
+
638
+ # @private
639
+ def initialize parent_rpcs = nil
640
+ list_regional_inventories_config = parent_rpcs.list_regional_inventories if parent_rpcs.respond_to? :list_regional_inventories
641
+ @list_regional_inventories = ::Gapic::Config::Method.new list_regional_inventories_config
642
+ insert_regional_inventory_config = parent_rpcs.insert_regional_inventory if parent_rpcs.respond_to? :insert_regional_inventory
643
+ @insert_regional_inventory = ::Gapic::Config::Method.new insert_regional_inventory_config
644
+ delete_regional_inventory_config = parent_rpcs.delete_regional_inventory if parent_rpcs.respond_to? :delete_regional_inventory
645
+ @delete_regional_inventory = ::Gapic::Config::Method.new delete_regional_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