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