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