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