google-shopping-merchant-notifications-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 +122 -0
- data/README.md +144 -8
- data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/client.rb +826 -0
- data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/credentials.rb +49 -0
- data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/paths.rb +66 -0
- data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/rest/client.rb +765 -0
- data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/rest/service_stub.rb +368 -0
- data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/rest.rb +54 -0
- data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service.rb +57 -0
- data/lib/google/shopping/merchant/notifications/v1beta/notificationsapi_pb.rb +64 -0
- data/lib/google/shopping/merchant/notifications/v1beta/notificationsapi_services_pb.rb +66 -0
- data/lib/google/shopping/merchant/notifications/v1beta/rest.rb +39 -0
- data/lib/google/shopping/merchant/notifications/v1beta/version.rb +7 -2
- data/lib/google/shopping/merchant/notifications/v1beta.rb +47 -0
- data/lib/google-shopping-merchant-notifications-v1beta.rb +21 -0
- data/proto_docs/README.md +4 -0
- data/proto_docs/google/api/client.rb +399 -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/field_mask.rb +229 -0
- data/proto_docs/google/shopping/merchant/notifications/v1beta/notificationsapi.rb +215 -0
- data/proto_docs/google/shopping/type/types.rb +183 -0
- metadata +87 -10
data/lib/google/shopping/merchant/notifications/v1beta/notifications_api_service/rest/client.rb
ADDED
@@ -0,0 +1,765 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright 2024 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/notifications/v1beta/notificationsapi_pb"
|
21
|
+
require "google/shopping/merchant/notifications/v1beta/notifications_api_service/rest/service_stub"
|
22
|
+
|
23
|
+
module Google
|
24
|
+
module Shopping
|
25
|
+
module Merchant
|
26
|
+
module Notifications
|
27
|
+
module V1beta
|
28
|
+
module NotificationsApiService
|
29
|
+
module Rest
|
30
|
+
##
|
31
|
+
# REST client for the NotificationsApiService service.
|
32
|
+
#
|
33
|
+
# Service to manage notification subscriptions for merchants
|
34
|
+
#
|
35
|
+
class Client
|
36
|
+
# @private
|
37
|
+
DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
|
38
|
+
|
39
|
+
include Paths
|
40
|
+
|
41
|
+
# @private
|
42
|
+
attr_reader :notifications_api_service_stub
|
43
|
+
|
44
|
+
##
|
45
|
+
# Configure the NotificationsApiService Client class.
|
46
|
+
#
|
47
|
+
# See {::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client::Configuration}
|
48
|
+
# for a description of the configuration fields.
|
49
|
+
#
|
50
|
+
# @example
|
51
|
+
#
|
52
|
+
# # Modify the configuration for all NotificationsApiService clients
|
53
|
+
# ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::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", "Notifications", "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 NotificationsApiService 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::Notifications::V1beta::NotificationsApiService::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
|
+
@notifications_api_service_stub.universe_domain
|
111
|
+
end
|
112
|
+
|
113
|
+
##
|
114
|
+
# Create a new NotificationsApiService REST client object.
|
115
|
+
#
|
116
|
+
# @example
|
117
|
+
#
|
118
|
+
# # Create a client using the default configuration
|
119
|
+
# client = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
|
120
|
+
#
|
121
|
+
# # Create a client using a custom configuration
|
122
|
+
# client = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new do |config|
|
123
|
+
# config.timeout = 10.0
|
124
|
+
# end
|
125
|
+
#
|
126
|
+
# @yield [config] Configure the NotificationsApiService 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
|
+
@notifications_api_service_stub = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::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
|
+
# Gets notification subscriptions for an account.
|
164
|
+
#
|
165
|
+
# @overload get_notification_subscription(request, options = nil)
|
166
|
+
# Pass arguments to `get_notification_subscription` via a request object, either of type
|
167
|
+
# {::Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest} or an equivalent Hash.
|
168
|
+
#
|
169
|
+
# @param request [::Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest, ::Hash]
|
170
|
+
# A request object representing the call parameters. Required. To specify no
|
171
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
172
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
173
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
174
|
+
#
|
175
|
+
# @overload get_notification_subscription(name: nil)
|
176
|
+
# Pass arguments to `get_notification_subscription` via keyword arguments. Note that at
|
177
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
178
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
179
|
+
#
|
180
|
+
# @param name [::String]
|
181
|
+
# Required. The `name` of the notification subscription.
|
182
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
183
|
+
# @yieldparam result [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
|
184
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
185
|
+
#
|
186
|
+
# @return [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
|
187
|
+
#
|
188
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
189
|
+
#
|
190
|
+
# @example Basic example
|
191
|
+
# require "google/shopping/merchant/notifications/v1beta"
|
192
|
+
#
|
193
|
+
# # Create a client object. The client can be reused for multiple calls.
|
194
|
+
# client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
|
195
|
+
#
|
196
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
197
|
+
# request = Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest.new
|
198
|
+
#
|
199
|
+
# # Call the get_notification_subscription method.
|
200
|
+
# result = client.get_notification_subscription request
|
201
|
+
#
|
202
|
+
# # The returned object is of type Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
|
203
|
+
# p result
|
204
|
+
#
|
205
|
+
def get_notification_subscription request, options = nil
|
206
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
207
|
+
|
208
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::GetNotificationSubscriptionRequest
|
209
|
+
|
210
|
+
# Converts hash and nil to an options object
|
211
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
212
|
+
|
213
|
+
# Customize the options with defaults
|
214
|
+
call_metadata = @config.rpcs.get_notification_subscription.metadata.to_h
|
215
|
+
|
216
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
217
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
218
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
219
|
+
gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION,
|
220
|
+
transports_version_send: [:rest]
|
221
|
+
|
222
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
223
|
+
|
224
|
+
options.apply_defaults timeout: @config.rpcs.get_notification_subscription.timeout,
|
225
|
+
metadata: call_metadata,
|
226
|
+
retry_policy: @config.rpcs.get_notification_subscription.retry_policy
|
227
|
+
|
228
|
+
options.apply_defaults timeout: @config.timeout,
|
229
|
+
metadata: @config.metadata,
|
230
|
+
retry_policy: @config.retry_policy
|
231
|
+
|
232
|
+
@notifications_api_service_stub.get_notification_subscription request, options do |result, operation|
|
233
|
+
yield result, operation if block_given?
|
234
|
+
return result
|
235
|
+
end
|
236
|
+
rescue ::Gapic::Rest::Error => e
|
237
|
+
raise ::Google::Cloud::Error.from_error(e)
|
238
|
+
end
|
239
|
+
|
240
|
+
##
|
241
|
+
# Creates a notification subscription for a merchant. We will allow the
|
242
|
+
# following types of notification subscriptions to exist together (per
|
243
|
+
# merchant as a subscriber per event type):
|
244
|
+
# 1. Subscription for all managed accounts + subscription for self
|
245
|
+
# 2. Multiple "partial" subscriptions for managed accounts + subscription
|
246
|
+
# for self
|
247
|
+
#
|
248
|
+
# we will not allow (per merchant as a subscriber per event type):
|
249
|
+
# 1. multiple self subscriptions.
|
250
|
+
# 2. multiple "all managed accounts" subscriptions.
|
251
|
+
# 3. all and partial subscriptions at the same time.
|
252
|
+
# 4. multiple partial subscriptions for the same target account
|
253
|
+
#
|
254
|
+
# @overload create_notification_subscription(request, options = nil)
|
255
|
+
# Pass arguments to `create_notification_subscription` via a request object, either of type
|
256
|
+
# {::Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest} or an equivalent Hash.
|
257
|
+
#
|
258
|
+
# @param request [::Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest, ::Hash]
|
259
|
+
# A request object representing the call parameters. Required. To specify no
|
260
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
261
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
262
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
263
|
+
#
|
264
|
+
# @overload create_notification_subscription(parent: nil, notification_subscription: nil)
|
265
|
+
# Pass arguments to `create_notification_subscription` via keyword arguments. Note that at
|
266
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
267
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
268
|
+
#
|
269
|
+
# @param parent [::String]
|
270
|
+
# Required. The merchant account that owns the new notification subscription.
|
271
|
+
# Format: `accounts/{account}`
|
272
|
+
# @param notification_subscription [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription, ::Hash]
|
273
|
+
# Required. The notification subscription to create.
|
274
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
275
|
+
# @yieldparam result [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
|
276
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
277
|
+
#
|
278
|
+
# @return [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
|
279
|
+
#
|
280
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
281
|
+
#
|
282
|
+
# @example Basic example
|
283
|
+
# require "google/shopping/merchant/notifications/v1beta"
|
284
|
+
#
|
285
|
+
# # Create a client object. The client can be reused for multiple calls.
|
286
|
+
# client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
|
287
|
+
#
|
288
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
289
|
+
# request = Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest.new
|
290
|
+
#
|
291
|
+
# # Call the create_notification_subscription method.
|
292
|
+
# result = client.create_notification_subscription request
|
293
|
+
#
|
294
|
+
# # The returned object is of type Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
|
295
|
+
# p result
|
296
|
+
#
|
297
|
+
def create_notification_subscription request, options = nil
|
298
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
299
|
+
|
300
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::CreateNotificationSubscriptionRequest
|
301
|
+
|
302
|
+
# Converts hash and nil to an options object
|
303
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
304
|
+
|
305
|
+
# Customize the options with defaults
|
306
|
+
call_metadata = @config.rpcs.create_notification_subscription.metadata.to_h
|
307
|
+
|
308
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
309
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
310
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
311
|
+
gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION,
|
312
|
+
transports_version_send: [:rest]
|
313
|
+
|
314
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
315
|
+
|
316
|
+
options.apply_defaults timeout: @config.rpcs.create_notification_subscription.timeout,
|
317
|
+
metadata: call_metadata,
|
318
|
+
retry_policy: @config.rpcs.create_notification_subscription.retry_policy
|
319
|
+
|
320
|
+
options.apply_defaults timeout: @config.timeout,
|
321
|
+
metadata: @config.metadata,
|
322
|
+
retry_policy: @config.retry_policy
|
323
|
+
|
324
|
+
@notifications_api_service_stub.create_notification_subscription request, options do |result, operation|
|
325
|
+
yield result, operation if block_given?
|
326
|
+
return result
|
327
|
+
end
|
328
|
+
rescue ::Gapic::Rest::Error => e
|
329
|
+
raise ::Google::Cloud::Error.from_error(e)
|
330
|
+
end
|
331
|
+
|
332
|
+
##
|
333
|
+
# Updates an existing notification subscription for a merchant.
|
334
|
+
#
|
335
|
+
# @overload update_notification_subscription(request, options = nil)
|
336
|
+
# Pass arguments to `update_notification_subscription` via a request object, either of type
|
337
|
+
# {::Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest} or an equivalent Hash.
|
338
|
+
#
|
339
|
+
# @param request [::Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest, ::Hash]
|
340
|
+
# A request object representing the call parameters. Required. To specify no
|
341
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
342
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
343
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
344
|
+
#
|
345
|
+
# @overload update_notification_subscription(notification_subscription: nil, update_mask: nil)
|
346
|
+
# Pass arguments to `update_notification_subscription` via keyword arguments. Note that at
|
347
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
348
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
349
|
+
#
|
350
|
+
# @param notification_subscription [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription, ::Hash]
|
351
|
+
# Required. The new version of the notification subscription that should be
|
352
|
+
# updated.
|
353
|
+
# @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
|
354
|
+
# List of fields being updated.
|
355
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
356
|
+
# @yieldparam result [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
|
357
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
358
|
+
#
|
359
|
+
# @return [::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription]
|
360
|
+
#
|
361
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
362
|
+
#
|
363
|
+
# @example Basic example
|
364
|
+
# require "google/shopping/merchant/notifications/v1beta"
|
365
|
+
#
|
366
|
+
# # Create a client object. The client can be reused for multiple calls.
|
367
|
+
# client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
|
368
|
+
#
|
369
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
370
|
+
# request = Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest.new
|
371
|
+
#
|
372
|
+
# # Call the update_notification_subscription method.
|
373
|
+
# result = client.update_notification_subscription request
|
374
|
+
#
|
375
|
+
# # The returned object is of type Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
|
376
|
+
# p result
|
377
|
+
#
|
378
|
+
def update_notification_subscription request, options = nil
|
379
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
380
|
+
|
381
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::UpdateNotificationSubscriptionRequest
|
382
|
+
|
383
|
+
# Converts hash and nil to an options object
|
384
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
385
|
+
|
386
|
+
# Customize the options with defaults
|
387
|
+
call_metadata = @config.rpcs.update_notification_subscription.metadata.to_h
|
388
|
+
|
389
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
390
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
391
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
392
|
+
gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION,
|
393
|
+
transports_version_send: [:rest]
|
394
|
+
|
395
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
396
|
+
|
397
|
+
options.apply_defaults timeout: @config.rpcs.update_notification_subscription.timeout,
|
398
|
+
metadata: call_metadata,
|
399
|
+
retry_policy: @config.rpcs.update_notification_subscription.retry_policy
|
400
|
+
|
401
|
+
options.apply_defaults timeout: @config.timeout,
|
402
|
+
metadata: @config.metadata,
|
403
|
+
retry_policy: @config.retry_policy
|
404
|
+
|
405
|
+
@notifications_api_service_stub.update_notification_subscription request, options do |result, operation|
|
406
|
+
yield result, operation if block_given?
|
407
|
+
return result
|
408
|
+
end
|
409
|
+
rescue ::Gapic::Rest::Error => e
|
410
|
+
raise ::Google::Cloud::Error.from_error(e)
|
411
|
+
end
|
412
|
+
|
413
|
+
##
|
414
|
+
# Deletes a notification subscription for a merchant.
|
415
|
+
#
|
416
|
+
# @overload delete_notification_subscription(request, options = nil)
|
417
|
+
# Pass arguments to `delete_notification_subscription` via a request object, either of type
|
418
|
+
# {::Google::Shopping::Merchant::Notifications::V1beta::DeleteNotificationSubscriptionRequest} or an equivalent Hash.
|
419
|
+
#
|
420
|
+
# @param request [::Google::Shopping::Merchant::Notifications::V1beta::DeleteNotificationSubscriptionRequest, ::Hash]
|
421
|
+
# A request object representing the call parameters. Required. To specify no
|
422
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
423
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
424
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
425
|
+
#
|
426
|
+
# @overload delete_notification_subscription(name: nil)
|
427
|
+
# Pass arguments to `delete_notification_subscription` via keyword arguments. Note that at
|
428
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
429
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
430
|
+
#
|
431
|
+
# @param name [::String]
|
432
|
+
# Required. The name of the notification subscription to be deleted.
|
433
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
434
|
+
# @yieldparam result [::Google::Protobuf::Empty]
|
435
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
436
|
+
#
|
437
|
+
# @return [::Google::Protobuf::Empty]
|
438
|
+
#
|
439
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
440
|
+
#
|
441
|
+
# @example Basic example
|
442
|
+
# require "google/shopping/merchant/notifications/v1beta"
|
443
|
+
#
|
444
|
+
# # Create a client object. The client can be reused for multiple calls.
|
445
|
+
# client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
|
446
|
+
#
|
447
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
448
|
+
# request = Google::Shopping::Merchant::Notifications::V1beta::DeleteNotificationSubscriptionRequest.new
|
449
|
+
#
|
450
|
+
# # Call the delete_notification_subscription method.
|
451
|
+
# result = client.delete_notification_subscription request
|
452
|
+
#
|
453
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
454
|
+
# p result
|
455
|
+
#
|
456
|
+
def delete_notification_subscription request, options = nil
|
457
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
458
|
+
|
459
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::DeleteNotificationSubscriptionRequest
|
460
|
+
|
461
|
+
# Converts hash and nil to an options object
|
462
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
463
|
+
|
464
|
+
# Customize the options with defaults
|
465
|
+
call_metadata = @config.rpcs.delete_notification_subscription.metadata.to_h
|
466
|
+
|
467
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
468
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
469
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
470
|
+
gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION,
|
471
|
+
transports_version_send: [:rest]
|
472
|
+
|
473
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
474
|
+
|
475
|
+
options.apply_defaults timeout: @config.rpcs.delete_notification_subscription.timeout,
|
476
|
+
metadata: call_metadata,
|
477
|
+
retry_policy: @config.rpcs.delete_notification_subscription.retry_policy
|
478
|
+
|
479
|
+
options.apply_defaults timeout: @config.timeout,
|
480
|
+
metadata: @config.metadata,
|
481
|
+
retry_policy: @config.retry_policy
|
482
|
+
|
483
|
+
@notifications_api_service_stub.delete_notification_subscription request, options do |result, operation|
|
484
|
+
yield result, operation if block_given?
|
485
|
+
return result
|
486
|
+
end
|
487
|
+
rescue ::Gapic::Rest::Error => e
|
488
|
+
raise ::Google::Cloud::Error.from_error(e)
|
489
|
+
end
|
490
|
+
|
491
|
+
##
|
492
|
+
# Gets all the notification subscriptions for a merchant.
|
493
|
+
#
|
494
|
+
# @overload list_notification_subscriptions(request, options = nil)
|
495
|
+
# Pass arguments to `list_notification_subscriptions` via a request object, either of type
|
496
|
+
# {::Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest} or an equivalent Hash.
|
497
|
+
#
|
498
|
+
# @param request [::Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest, ::Hash]
|
499
|
+
# A request object representing the call parameters. Required. To specify no
|
500
|
+
# parameters, or to keep all the default parameter values, pass an empty Hash.
|
501
|
+
# @param options [::Gapic::CallOptions, ::Hash]
|
502
|
+
# Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
|
503
|
+
#
|
504
|
+
# @overload list_notification_subscriptions(parent: nil, page_size: nil, page_token: nil)
|
505
|
+
# Pass arguments to `list_notification_subscriptions` via keyword arguments. Note that at
|
506
|
+
# least one keyword argument is required. To specify no parameters, or to keep all
|
507
|
+
# the default parameter values, pass an empty Hash as a request object (see above).
|
508
|
+
#
|
509
|
+
# @param parent [::String]
|
510
|
+
# Required. The merchant account who owns the notification subscriptions.
|
511
|
+
# Format: `accounts/{account}`
|
512
|
+
# @param page_size [::Integer]
|
513
|
+
# The maximum number of notification subscriptions to return in a page.
|
514
|
+
# The default value for `page_size` is 100. The
|
515
|
+
# maximum value is `200`. Values above `200` will be coerced to `200`.
|
516
|
+
# @param page_token [::String]
|
517
|
+
# Token (if provided) to retrieve the subsequent page. All other parameters
|
518
|
+
# must match the original call that provided the page token.
|
519
|
+
# @yield [result, operation] Access the result along with the TransportOperation object
|
520
|
+
# @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription>]
|
521
|
+
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
522
|
+
#
|
523
|
+
# @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription>]
|
524
|
+
#
|
525
|
+
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
526
|
+
#
|
527
|
+
# @example Basic example
|
528
|
+
# require "google/shopping/merchant/notifications/v1beta"
|
529
|
+
#
|
530
|
+
# # Create a client object. The client can be reused for multiple calls.
|
531
|
+
# client = Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new
|
532
|
+
#
|
533
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
534
|
+
# request = Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest.new
|
535
|
+
#
|
536
|
+
# # Call the list_notification_subscriptions method.
|
537
|
+
# result = client.list_notification_subscriptions request
|
538
|
+
#
|
539
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
540
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
541
|
+
# result.each do |item|
|
542
|
+
# # Each element is of type ::Google::Shopping::Merchant::Notifications::V1beta::NotificationSubscription.
|
543
|
+
# p item
|
544
|
+
# end
|
545
|
+
#
|
546
|
+
def list_notification_subscriptions request, options = nil
|
547
|
+
raise ::ArgumentError, "request must be provided" if request.nil?
|
548
|
+
|
549
|
+
request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Notifications::V1beta::ListNotificationSubscriptionsRequest
|
550
|
+
|
551
|
+
# Converts hash and nil to an options object
|
552
|
+
options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
|
553
|
+
|
554
|
+
# Customize the options with defaults
|
555
|
+
call_metadata = @config.rpcs.list_notification_subscriptions.metadata.to_h
|
556
|
+
|
557
|
+
# Set x-goog-api-client and x-goog-user-project headers
|
558
|
+
call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
|
559
|
+
lib_name: @config.lib_name, lib_version: @config.lib_version,
|
560
|
+
gapic_version: ::Google::Shopping::Merchant::Notifications::V1beta::VERSION,
|
561
|
+
transports_version_send: [:rest]
|
562
|
+
|
563
|
+
call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
|
564
|
+
|
565
|
+
options.apply_defaults timeout: @config.rpcs.list_notification_subscriptions.timeout,
|
566
|
+
metadata: call_metadata,
|
567
|
+
retry_policy: @config.rpcs.list_notification_subscriptions.retry_policy
|
568
|
+
|
569
|
+
options.apply_defaults timeout: @config.timeout,
|
570
|
+
metadata: @config.metadata,
|
571
|
+
retry_policy: @config.retry_policy
|
572
|
+
|
573
|
+
@notifications_api_service_stub.list_notification_subscriptions request, options do |result, operation|
|
574
|
+
result = ::Gapic::Rest::PagedEnumerable.new @notifications_api_service_stub, :list_notification_subscriptions, "notification_subscriptions", request, result, options
|
575
|
+
yield result, operation if block_given?
|
576
|
+
return result
|
577
|
+
end
|
578
|
+
rescue ::Gapic::Rest::Error => e
|
579
|
+
raise ::Google::Cloud::Error.from_error(e)
|
580
|
+
end
|
581
|
+
|
582
|
+
##
|
583
|
+
# Configuration class for the NotificationsApiService REST API.
|
584
|
+
#
|
585
|
+
# This class represents the configuration for NotificationsApiService REST,
|
586
|
+
# providing control over timeouts, retry behavior, logging, transport
|
587
|
+
# parameters, and other low-level controls. Certain parameters can also be
|
588
|
+
# applied individually to specific RPCs. See
|
589
|
+
# {::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client::Configuration::Rpcs}
|
590
|
+
# for a list of RPCs that can be configured independently.
|
591
|
+
#
|
592
|
+
# Configuration can be applied globally to all clients, or to a single client
|
593
|
+
# on construction.
|
594
|
+
#
|
595
|
+
# @example
|
596
|
+
#
|
597
|
+
# # Modify the global config, setting the timeout for
|
598
|
+
# # get_notification_subscription to 20 seconds,
|
599
|
+
# # and all remaining timeouts to 10 seconds.
|
600
|
+
# ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.configure do |config|
|
601
|
+
# config.timeout = 10.0
|
602
|
+
# config.rpcs.get_notification_subscription.timeout = 20.0
|
603
|
+
# end
|
604
|
+
#
|
605
|
+
# # Apply the above configuration only to a new client.
|
606
|
+
# client = ::Google::Shopping::Merchant::Notifications::V1beta::NotificationsApiService::Rest::Client.new do |config|
|
607
|
+
# config.timeout = 10.0
|
608
|
+
# config.rpcs.get_notification_subscription.timeout = 20.0
|
609
|
+
# end
|
610
|
+
#
|
611
|
+
# @!attribute [rw] endpoint
|
612
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
613
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
614
|
+
# @return [::String,nil]
|
615
|
+
# @!attribute [rw] credentials
|
616
|
+
# Credentials to send with calls. You may provide any of the following types:
|
617
|
+
# * (`String`) The path to a service account key file in JSON format
|
618
|
+
# * (`Hash`) A service account key as a Hash
|
619
|
+
# * (`Google::Auth::Credentials`) A googleauth credentials object
|
620
|
+
# (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
|
621
|
+
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
622
|
+
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
623
|
+
# * (`nil`) indicating no credentials
|
624
|
+
# @return [::Object]
|
625
|
+
# @!attribute [rw] scope
|
626
|
+
# The OAuth scopes
|
627
|
+
# @return [::Array<::String>]
|
628
|
+
# @!attribute [rw] lib_name
|
629
|
+
# The library name as recorded in instrumentation and logging
|
630
|
+
# @return [::String]
|
631
|
+
# @!attribute [rw] lib_version
|
632
|
+
# The library version as recorded in instrumentation and logging
|
633
|
+
# @return [::String]
|
634
|
+
# @!attribute [rw] timeout
|
635
|
+
# The call timeout in seconds.
|
636
|
+
# @return [::Numeric]
|
637
|
+
# @!attribute [rw] metadata
|
638
|
+
# Additional headers to be sent with the call.
|
639
|
+
# @return [::Hash{::Symbol=>::String}]
|
640
|
+
# @!attribute [rw] retry_policy
|
641
|
+
# The retry policy. The value is a hash with the following keys:
|
642
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
643
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
644
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
645
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
646
|
+
# trigger a retry.
|
647
|
+
# @return [::Hash]
|
648
|
+
# @!attribute [rw] quota_project
|
649
|
+
# A separate project against which to charge quota.
|
650
|
+
# @return [::String]
|
651
|
+
# @!attribute [rw] universe_domain
|
652
|
+
# The universe domain within which to make requests. This determines the
|
653
|
+
# default endpoint URL. The default value of nil uses the environment
|
654
|
+
# universe (usually the default "googleapis.com" universe).
|
655
|
+
# @return [::String,nil]
|
656
|
+
#
|
657
|
+
class Configuration
|
658
|
+
extend ::Gapic::Config
|
659
|
+
|
660
|
+
# @private
|
661
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
662
|
+
DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
|
663
|
+
|
664
|
+
config_attr :endpoint, nil, ::String, nil
|
665
|
+
config_attr :credentials, nil do |value|
|
666
|
+
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
667
|
+
allowed.any? { |klass| klass === value }
|
668
|
+
end
|
669
|
+
config_attr :scope, nil, ::String, ::Array, nil
|
670
|
+
config_attr :lib_name, nil, ::String, nil
|
671
|
+
config_attr :lib_version, nil, ::String, nil
|
672
|
+
config_attr :timeout, nil, ::Numeric, nil
|
673
|
+
config_attr :metadata, nil, ::Hash, nil
|
674
|
+
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
675
|
+
config_attr :quota_project, nil, ::String, nil
|
676
|
+
config_attr :universe_domain, nil, ::String, nil
|
677
|
+
|
678
|
+
# @private
|
679
|
+
def initialize parent_config = nil
|
680
|
+
@parent_config = parent_config unless parent_config.nil?
|
681
|
+
|
682
|
+
yield self if block_given?
|
683
|
+
end
|
684
|
+
|
685
|
+
##
|
686
|
+
# Configurations for individual RPCs
|
687
|
+
# @return [Rpcs]
|
688
|
+
#
|
689
|
+
def rpcs
|
690
|
+
@rpcs ||= begin
|
691
|
+
parent_rpcs = nil
|
692
|
+
parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
|
693
|
+
Rpcs.new parent_rpcs
|
694
|
+
end
|
695
|
+
end
|
696
|
+
|
697
|
+
##
|
698
|
+
# Configuration RPC class for the NotificationsApiService API.
|
699
|
+
#
|
700
|
+
# Includes fields providing the configuration for each RPC in this service.
|
701
|
+
# Each configuration object is of type `Gapic::Config::Method` and includes
|
702
|
+
# the following configuration fields:
|
703
|
+
#
|
704
|
+
# * `timeout` (*type:* `Numeric`) - The call timeout in seconds
|
705
|
+
# * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
|
706
|
+
# * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
|
707
|
+
# include the following keys:
|
708
|
+
# * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
|
709
|
+
# * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
|
710
|
+
# * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
|
711
|
+
# * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
|
712
|
+
# trigger a retry.
|
713
|
+
#
|
714
|
+
class Rpcs
|
715
|
+
##
|
716
|
+
# RPC-specific configuration for `get_notification_subscription`
|
717
|
+
# @return [::Gapic::Config::Method]
|
718
|
+
#
|
719
|
+
attr_reader :get_notification_subscription
|
720
|
+
##
|
721
|
+
# RPC-specific configuration for `create_notification_subscription`
|
722
|
+
# @return [::Gapic::Config::Method]
|
723
|
+
#
|
724
|
+
attr_reader :create_notification_subscription
|
725
|
+
##
|
726
|
+
# RPC-specific configuration for `update_notification_subscription`
|
727
|
+
# @return [::Gapic::Config::Method]
|
728
|
+
#
|
729
|
+
attr_reader :update_notification_subscription
|
730
|
+
##
|
731
|
+
# RPC-specific configuration for `delete_notification_subscription`
|
732
|
+
# @return [::Gapic::Config::Method]
|
733
|
+
#
|
734
|
+
attr_reader :delete_notification_subscription
|
735
|
+
##
|
736
|
+
# RPC-specific configuration for `list_notification_subscriptions`
|
737
|
+
# @return [::Gapic::Config::Method]
|
738
|
+
#
|
739
|
+
attr_reader :list_notification_subscriptions
|
740
|
+
|
741
|
+
# @private
|
742
|
+
def initialize parent_rpcs = nil
|
743
|
+
get_notification_subscription_config = parent_rpcs.get_notification_subscription if parent_rpcs.respond_to? :get_notification_subscription
|
744
|
+
@get_notification_subscription = ::Gapic::Config::Method.new get_notification_subscription_config
|
745
|
+
create_notification_subscription_config = parent_rpcs.create_notification_subscription if parent_rpcs.respond_to? :create_notification_subscription
|
746
|
+
@create_notification_subscription = ::Gapic::Config::Method.new create_notification_subscription_config
|
747
|
+
update_notification_subscription_config = parent_rpcs.update_notification_subscription if parent_rpcs.respond_to? :update_notification_subscription
|
748
|
+
@update_notification_subscription = ::Gapic::Config::Method.new update_notification_subscription_config
|
749
|
+
delete_notification_subscription_config = parent_rpcs.delete_notification_subscription if parent_rpcs.respond_to? :delete_notification_subscription
|
750
|
+
@delete_notification_subscription = ::Gapic::Config::Method.new delete_notification_subscription_config
|
751
|
+
list_notification_subscriptions_config = parent_rpcs.list_notification_subscriptions if parent_rpcs.respond_to? :list_notification_subscriptions
|
752
|
+
@list_notification_subscriptions = ::Gapic::Config::Method.new list_notification_subscriptions_config
|
753
|
+
|
754
|
+
yield self if block_given?
|
755
|
+
end
|
756
|
+
end
|
757
|
+
end
|
758
|
+
end
|
759
|
+
end
|
760
|
+
end
|
761
|
+
end
|
762
|
+
end
|
763
|
+
end
|
764
|
+
end
|
765
|
+
end
|