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/localinventory_pb"
21
+ require "google/shopping/merchant/inventories/v1beta/local_inventory_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Inventories
27
+ module V1beta
28
+ module LocalInventoryService
29
+ module Rest
30
+ ##
31
+ # REST client for the LocalInventoryService service.
32
+ #
33
+ # Service to manage local inventory for products
34
+ #
35
+ class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
38
+
39
+ include Paths
40
+
41
+ # @private
42
+ attr_reader :local_inventory_service_stub
43
+
44
+ ##
45
+ # Configure the LocalInventoryService Client class.
46
+ #
47
+ # See {::Google::Shopping::Merchant::Inventories::V1beta::LocalInventoryService::Rest::Client::Configuration}
48
+ # for a description of the configuration fields.
49
+ #
50
+ # @example
51
+ #
52
+ # # Modify the configuration for all LocalInventoryService clients
53
+ # ::Google::Shopping::Merchant::Inventories::V1beta::LocalInventoryService::Rest::Client.configure do |config|
54
+ # config.timeout = 10.0
55
+ # end
56
+ #
57
+ # @yield [config] Configure the Client client.
58
+ # @yieldparam config [Client::Configuration]
59
+ #
60
+ # @return [Client::Configuration]
61
+ #
62
+ def self.configure
63
+ @configure ||= begin
64
+ namespace = ["Google", "Shopping", "Merchant", "Inventories", "V1beta"]
65
+ parent_config = while namespace.any?
66
+ parent_name = namespace.join "::"
67
+ parent_const = const_get parent_name
68
+ break parent_const.configure if parent_const.respond_to? :configure
69
+ namespace.pop
70
+ end
71
+ default_config = Client::Configuration.new parent_config
72
+
73
+ default_config.timeout = 60.0
74
+ default_config.retry_policy = {
75
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
76
+ }
77
+
78
+ default_config
79
+ end
80
+ yield @configure if block_given?
81
+ @configure
82
+ end
83
+
84
+ ##
85
+ # Configure the LocalInventoryService Client instance.
86
+ #
87
+ # The configuration is set to the derived mode, meaning that values can be changed,
88
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
89
+ # should be made on {Client.configure}.
90
+ #
91
+ # See {::Google::Shopping::Merchant::Inventories::V1beta::LocalInventoryService::Rest::Client::Configuration}
92
+ # for a description of the configuration fields.
93
+ #
94
+ # @yield [config] Configure the Client client.
95
+ # @yieldparam config [Client::Configuration]
96
+ #
97
+ # @return [Client::Configuration]
98
+ #
99
+ def configure
100
+ yield @config if block_given?
101
+ @config
102
+ end
103
+
104
+ ##
105
+ # The effective universe domain
106
+ #
107
+ # @return [String]
108
+ #
109
+ def universe_domain
110
+ @local_inventory_service_stub.universe_domain
111
+ end
112
+
113
+ ##
114
+ # Create a new LocalInventoryService REST client object.
115
+ #
116
+ # @example
117
+ #
118
+ # # Create a client using the default configuration
119
+ # client = ::Google::Shopping::Merchant::Inventories::V1beta::LocalInventoryService::Rest::Client.new
120
+ #
121
+ # # Create a client using a custom configuration
122
+ # client = ::Google::Shopping::Merchant::Inventories::V1beta::LocalInventoryService::Rest::Client.new do |config|
123
+ # config.timeout = 10.0
124
+ # end
125
+ #
126
+ # @yield [config] Configure the LocalInventoryService client.
127
+ # @yieldparam config [Client::Configuration]
128
+ #
129
+ def initialize
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the endpoint is unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.endpoint.nil? ||
141
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
142
+ !@config.endpoint.split(".").first.include?("-"))
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+
149
+ @quota_project_id = @config.quota_project
150
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
151
+
152
+ @local_inventory_service_stub = ::Google::Shopping::Merchant::Inventories::V1beta::LocalInventoryService::Rest::ServiceStub.new(
153
+ endpoint: @config.endpoint,
154
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
155
+ universe_domain: @config.universe_domain,
156
+ credentials: credentials
157
+ )
158
+ end
159
+
160
+ # Service calls
161
+
162
+ ##
163
+ # Lists the `LocalInventory` resources for the given product in your merchant
164
+ # account. The response might contain fewer items than specified by
165
+ # `pageSize`. If `pageToken` was returned in previous request, it can be used
166
+ # to obtain additional results.
167
+ #
168
+ # `LocalInventory` resources are listed per product for a given account.
169
+ #
170
+ # @overload list_local_inventories(request, options = nil)
171
+ # Pass arguments to `list_local_inventories` via a request object, either of type
172
+ # {::Google::Shopping::Merchant::Inventories::V1beta::ListLocalInventoriesRequest} or an equivalent Hash.
173
+ #
174
+ # @param request [::Google::Shopping::Merchant::Inventories::V1beta::ListLocalInventoriesRequest, ::Hash]
175
+ # A request object representing the call parameters. Required. To specify no
176
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
177
+ # @param options [::Gapic::CallOptions, ::Hash]
178
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
179
+ #
180
+ # @overload list_local_inventories(parent: nil, page_size: nil, page_token: nil)
181
+ # Pass arguments to `list_local_inventories` via keyword arguments. Note that at
182
+ # least one keyword argument is required. To specify no parameters, or to keep all
183
+ # the default parameter values, pass an empty Hash as a request object (see above).
184
+ #
185
+ # @param parent [::String]
186
+ # Required. The `name` of the parent product to list local inventories for.
187
+ # Format:
188
+ # `accounts/{account}/products/{product}`
189
+ # @param page_size [::Integer]
190
+ # The maximum number of `LocalInventory` resources for the given
191
+ # product to return. The service returns fewer than this value if the number
192
+ # of inventories for the given product is less that than the `pageSize`. The
193
+ # default value is 25000. The maximum value is 25000; 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 `ListLocalInventories` call.
197
+ # Provide the page token to retrieve the subsequent page.
198
+ #
199
+ # When paginating, all other parameters provided to `ListLocalInventories`
200
+ # must match the call that provided the page token. The token returned as
201
+ # {::Google::Shopping::Merchant::Inventories::V1beta::ListLocalInventoriesResponse#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::LocalInventory>]
205
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
206
+ #
207
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Inventories::V1beta::LocalInventory>]
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::LocalInventoryService::Rest::Client.new
216
+ #
217
+ # # Create a request. To set request fields, pass in keyword arguments.
218
+ # request = Google::Shopping::Merchant::Inventories::V1beta::ListLocalInventoriesRequest.new
219
+ #
220
+ # # Call the list_local_inventories method.
221
+ # result = client.list_local_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::LocalInventory.
227
+ # p item
228
+ # end
229
+ #
230
+ def list_local_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::ListLocalInventoriesRequest
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_local_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_local_inventories.timeout,
250
+ metadata: call_metadata,
251
+ retry_policy: @config.rpcs.list_local_inventories.retry_policy
252
+
253
+ options.apply_defaults timeout: @config.timeout,
254
+ metadata: @config.metadata,
255
+ retry_policy: @config.retry_policy
256
+
257
+ @local_inventory_service_stub.list_local_inventories request, options do |result, operation|
258
+ result = ::Gapic::Rest::PagedEnumerable.new @local_inventory_service_stub, :list_local_inventories, "local_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 `LocalInventory` resource to a product in your merchant
268
+ # account.
269
+ #
270
+ # Replaces the full `LocalInventory` resource if an entry with the same
271
+ # {::Google::Shopping::Merchant::Inventories::V1beta::LocalInventory#store_code `storeCode`}
272
+ # already exists for the product.
273
+ #
274
+ # It might take up to 30 minutes for the new or updated `LocalInventory`
275
+ # resource to appear in products.
276
+ #
277
+ # @overload insert_local_inventory(request, options = nil)
278
+ # Pass arguments to `insert_local_inventory` via a request object, either of type
279
+ # {::Google::Shopping::Merchant::Inventories::V1beta::InsertLocalInventoryRequest} or an equivalent Hash.
280
+ #
281
+ # @param request [::Google::Shopping::Merchant::Inventories::V1beta::InsertLocalInventoryRequest, ::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_local_inventory(parent: nil, local_inventory: nil)
288
+ # Pass arguments to `insert_local_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 local_inventory [::Google::Shopping::Merchant::Inventories::V1beta::LocalInventory, ::Hash]
296
+ # Required. Local inventory information of the product. If the product
297
+ # already has a `LocalInventory` resource for the same `storeCode`, full
298
+ # replacement of the `LocalInventory` resource is performed.
299
+ # @yield [result, operation] Access the result along with the TransportOperation object
300
+ # @yieldparam result [::Google::Shopping::Merchant::Inventories::V1beta::LocalInventory]
301
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
302
+ #
303
+ # @return [::Google::Shopping::Merchant::Inventories::V1beta::LocalInventory]
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::LocalInventoryService::Rest::Client.new
312
+ #
313
+ # # Create a request. To set request fields, pass in keyword arguments.
314
+ # request = Google::Shopping::Merchant::Inventories::V1beta::InsertLocalInventoryRequest.new
315
+ #
316
+ # # Call the insert_local_inventory method.
317
+ # result = client.insert_local_inventory request
318
+ #
319
+ # # The returned object is of type Google::Shopping::Merchant::Inventories::V1beta::LocalInventory.
320
+ # p result
321
+ #
322
+ def insert_local_inventory request, options = nil
323
+ raise ::ArgumentError, "request must be provided" if request.nil?
324
+
325
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Inventories::V1beta::InsertLocalInventoryRequest
326
+
327
+ # Converts hash and nil to an options object
328
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
329
+
330
+ # Customize the options with defaults
331
+ call_metadata = @config.rpcs.insert_local_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_local_inventory.timeout,
342
+ metadata: call_metadata,
343
+ retry_policy: @config.rpcs.insert_local_inventory.retry_policy
344
+
345
+ options.apply_defaults timeout: @config.timeout,
346
+ metadata: @config.metadata,
347
+ retry_policy: @config.retry_policy
348
+
349
+ @local_inventory_service_stub.insert_local_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 `LocalInventory` from the given product in your
359
+ # merchant account. It might take a up to an hour for the
360
+ # `LocalInventory` 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_local_inventory(request, options = nil)
365
+ # Pass arguments to `delete_local_inventory` via a request object, either of type
366
+ # {::Google::Shopping::Merchant::Inventories::V1beta::DeleteLocalInventoryRequest} or an equivalent Hash.
367
+ #
368
+ # @param request [::Google::Shopping::Merchant::Inventories::V1beta::DeleteLocalInventoryRequest, ::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_local_inventory(name: nil)
375
+ # Pass arguments to `delete_local_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 local inventory for the given product to delete.
381
+ # Format:
382
+ # `accounts/{account}/products/{product}/localInventories/{store_code}`
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::LocalInventoryService::Rest::Client.new
396
+ #
397
+ # # Create a request. To set request fields, pass in keyword arguments.
398
+ # request = Google::Shopping::Merchant::Inventories::V1beta::DeleteLocalInventoryRequest.new
399
+ #
400
+ # # Call the delete_local_inventory method.
401
+ # result = client.delete_local_inventory request
402
+ #
403
+ # # The returned object is of type Google::Protobuf::Empty.
404
+ # p result
405
+ #
406
+ def delete_local_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::DeleteLocalInventoryRequest
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_local_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_local_inventory.timeout,
426
+ metadata: call_metadata,
427
+ retry_policy: @config.rpcs.delete_local_inventory.retry_policy
428
+
429
+ options.apply_defaults timeout: @config.timeout,
430
+ metadata: @config.metadata,
431
+ retry_policy: @config.retry_policy
432
+
433
+ @local_inventory_service_stub.delete_local_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 LocalInventoryService REST API.
443
+ #
444
+ # This class represents the configuration for LocalInventoryService 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::LocalInventoryService::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_local_inventories to 20 seconds,
458
+ # # and all remaining timeouts to 10 seconds.
459
+ # ::Google::Shopping::Merchant::Inventories::V1beta::LocalInventoryService::Rest::Client.configure do |config|
460
+ # config.timeout = 10.0
461
+ # config.rpcs.list_local_inventories.timeout = 20.0
462
+ # end
463
+ #
464
+ # # Apply the above configuration only to a new client.
465
+ # client = ::Google::Shopping::Merchant::Inventories::V1beta::LocalInventoryService::Rest::Client.new do |config|
466
+ # config.timeout = 10.0
467
+ # config.rpcs.list_local_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 LocalInventoryService 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_local_inventories`
576
+ # @return [::Gapic::Config::Method]
577
+ #
578
+ attr_reader :list_local_inventories
579
+ ##
580
+ # RPC-specific configuration for `insert_local_inventory`
581
+ # @return [::Gapic::Config::Method]
582
+ #
583
+ attr_reader :insert_local_inventory
584
+ ##
585
+ # RPC-specific configuration for `delete_local_inventory`
586
+ # @return [::Gapic::Config::Method]
587
+ #
588
+ attr_reader :delete_local_inventory
589
+
590
+ # @private
591
+ def initialize parent_rpcs = nil
592
+ list_local_inventories_config = parent_rpcs.list_local_inventories if parent_rpcs.respond_to? :list_local_inventories
593
+ @list_local_inventories = ::Gapic::Config::Method.new list_local_inventories_config
594
+ insert_local_inventory_config = parent_rpcs.insert_local_inventory if parent_rpcs.respond_to? :insert_local_inventory
595
+ @insert_local_inventory = ::Gapic::Config::Method.new insert_local_inventory_config
596
+ delete_local_inventory_config = parent_rpcs.delete_local_inventory if parent_rpcs.respond_to? :delete_local_inventory
597
+ @delete_local_inventory = ::Gapic::Config::Method.new delete_local_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