google-shopping-merchant-reviews-v1beta 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/LICENSE.md +201 -0
  5. data/README.md +154 -0
  6. data/lib/google/shopping/merchant/reviews/v1beta/merchant_reviews_service/client.rb +762 -0
  7. data/lib/google/shopping/merchant/reviews/v1beta/merchant_reviews_service/credentials.rb +49 -0
  8. data/lib/google/shopping/merchant/reviews/v1beta/merchant_reviews_service/paths.rb +66 -0
  9. data/lib/google/shopping/merchant/reviews/v1beta/merchant_reviews_service/rest/client.rb +708 -0
  10. data/lib/google/shopping/merchant/reviews/v1beta/merchant_reviews_service/rest/service_stub.rb +328 -0
  11. data/lib/google/shopping/merchant/reviews/v1beta/merchant_reviews_service/rest.rb +54 -0
  12. data/lib/google/shopping/merchant/reviews/v1beta/merchant_reviews_service.rb +57 -0
  13. data/lib/google/shopping/merchant/reviews/v1beta/merchantreviews_common_pb.rb +54 -0
  14. data/lib/google/shopping/merchant/reviews/v1beta/merchantreviews_pb.rb +59 -0
  15. data/lib/google/shopping/merchant/reviews/v1beta/merchantreviews_services_pb.rb +54 -0
  16. data/lib/google/shopping/merchant/reviews/v1beta/product_reviews_service/client.rb +757 -0
  17. data/lib/google/shopping/merchant/reviews/v1beta/product_reviews_service/credentials.rb +49 -0
  18. data/lib/google/shopping/merchant/reviews/v1beta/product_reviews_service/paths.rb +66 -0
  19. data/lib/google/shopping/merchant/reviews/v1beta/product_reviews_service/rest/client.rb +703 -0
  20. data/lib/google/shopping/merchant/reviews/v1beta/product_reviews_service/rest/service_stub.rb +328 -0
  21. data/lib/google/shopping/merchant/reviews/v1beta/product_reviews_service/rest.rb +54 -0
  22. data/lib/google/shopping/merchant/reviews/v1beta/product_reviews_service.rb +57 -0
  23. data/lib/google/shopping/merchant/reviews/v1beta/productreviews_common_pb.rb +56 -0
  24. data/lib/google/shopping/merchant/reviews/v1beta/productreviews_pb.rb +59 -0
  25. data/lib/google/shopping/merchant/reviews/v1beta/productreviews_services_pb.rb +53 -0
  26. data/lib/google/shopping/merchant/reviews/v1beta/rest.rb +40 -0
  27. data/lib/google/shopping/merchant/reviews/v1beta/version.rb +30 -0
  28. data/lib/google/shopping/merchant/reviews/v1beta.rb +48 -0
  29. data/lib/google-shopping-merchant-reviews-v1beta.rb +21 -0
  30. data/proto_docs/README.md +4 -0
  31. data/proto_docs/google/api/client.rb +459 -0
  32. data/proto_docs/google/api/field_behavior.rb +85 -0
  33. data/proto_docs/google/api/launch_stage.rb +71 -0
  34. data/proto_docs/google/api/resource.rb +227 -0
  35. data/proto_docs/google/protobuf/duration.rb +98 -0
  36. data/proto_docs/google/protobuf/empty.rb +34 -0
  37. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  38. data/proto_docs/google/shopping/merchant/reviews/v1beta/merchantreviews.rb +142 -0
  39. data/proto_docs/google/shopping/merchant/reviews/v1beta/merchantreviews_common.rb +187 -0
  40. data/proto_docs/google/shopping/merchant/reviews/v1beta/productreviews.rb +129 -0
  41. data/proto_docs/google/shopping/merchant/reviews/v1beta/productreviews_common.rb +266 -0
  42. data/proto_docs/google/shopping/type/types.rb +210 -0
  43. metadata +152 -0
@@ -0,0 +1,703 @@
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/reviews/v1beta/productreviews_pb"
21
+ require "google/shopping/merchant/reviews/v1beta/product_reviews_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Reviews
27
+ module V1beta
28
+ module ProductReviewsService
29
+ module Rest
30
+ ##
31
+ # REST client for the ProductReviewsService service.
32
+ #
33
+ # Service to manage product reviews.
34
+ #
35
+ class Client
36
+ # @private
37
+ API_VERSION = ""
38
+
39
+ # @private
40
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
41
+
42
+ include Paths
43
+
44
+ # @private
45
+ attr_reader :product_reviews_service_stub
46
+
47
+ ##
48
+ # Configure the ProductReviewsService Client class.
49
+ #
50
+ # See {::Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all ProductReviewsService clients
56
+ # ::Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client.configure do |config|
57
+ # config.timeout = 10.0
58
+ # end
59
+ #
60
+ # @yield [config] Configure the Client client.
61
+ # @yieldparam config [Client::Configuration]
62
+ #
63
+ # @return [Client::Configuration]
64
+ #
65
+ def self.configure
66
+ @configure ||= begin
67
+ namespace = ["Google", "Shopping", "Merchant", "Reviews", "V1beta"]
68
+ parent_config = while namespace.any?
69
+ parent_name = namespace.join "::"
70
+ parent_const = const_get parent_name
71
+ break parent_const.configure if parent_const.respond_to? :configure
72
+ namespace.pop
73
+ end
74
+ default_config = Client::Configuration.new parent_config
75
+
76
+ default_config.timeout = 60.0
77
+ default_config.retry_policy = {
78
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
79
+ }
80
+
81
+ default_config
82
+ end
83
+ yield @configure if block_given?
84
+ @configure
85
+ end
86
+
87
+ ##
88
+ # Configure the ProductReviewsService Client instance.
89
+ #
90
+ # The configuration is set to the derived mode, meaning that values can be changed,
91
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
92
+ # should be made on {Client.configure}.
93
+ #
94
+ # See {::Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client::Configuration}
95
+ # for a description of the configuration fields.
96
+ #
97
+ # @yield [config] Configure the Client client.
98
+ # @yieldparam config [Client::Configuration]
99
+ #
100
+ # @return [Client::Configuration]
101
+ #
102
+ def configure
103
+ yield @config if block_given?
104
+ @config
105
+ end
106
+
107
+ ##
108
+ # The effective universe domain
109
+ #
110
+ # @return [String]
111
+ #
112
+ def universe_domain
113
+ @product_reviews_service_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new ProductReviewsService REST client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the ProductReviewsService client.
130
+ # @yieldparam config [Client::Configuration]
131
+ #
132
+ def initialize
133
+ # Create the configuration object
134
+ @config = Configuration.new Client.configure
135
+
136
+ # Yield the configuration if needed
137
+ yield @config if block_given?
138
+
139
+ # Create credentials
140
+ credentials = @config.credentials
141
+ # Use self-signed JWT if the endpoint is unchanged from default,
142
+ # but only if the default endpoint does not have a region prefix.
143
+ enable_self_signed_jwt = @config.endpoint.nil? ||
144
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
145
+ !@config.endpoint.split(".").first.include?("-"))
146
+ credentials ||= Credentials.default scope: @config.scope,
147
+ enable_self_signed_jwt: enable_self_signed_jwt
148
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
149
+ credentials = Credentials.new credentials, scope: @config.scope
150
+ end
151
+
152
+ @quota_project_id = @config.quota_project
153
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
154
+
155
+ @product_reviews_service_stub = ::Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::ServiceStub.new(
156
+ endpoint: @config.endpoint,
157
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
158
+ universe_domain: @config.universe_domain,
159
+ credentials: credentials,
160
+ logger: @config.logger
161
+ )
162
+
163
+ @product_reviews_service_stub.logger(stub: true)&.info do |entry|
164
+ entry.set_system_name
165
+ entry.set_service
166
+ entry.message = "Created client for #{entry.service}"
167
+ entry.set_credentials_fields credentials
168
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
169
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
170
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
171
+ end
172
+ end
173
+
174
+ ##
175
+ # The logger used for request/response debug logging.
176
+ #
177
+ # @return [Logger]
178
+ #
179
+ def logger
180
+ @product_reviews_service_stub.logger
181
+ end
182
+
183
+ # Service calls
184
+
185
+ ##
186
+ # Gets a product review.
187
+ #
188
+ # @overload get_product_review(request, options = nil)
189
+ # Pass arguments to `get_product_review` via a request object, either of type
190
+ # {::Google::Shopping::Merchant::Reviews::V1beta::GetProductReviewRequest} or an equivalent Hash.
191
+ #
192
+ # @param request [::Google::Shopping::Merchant::Reviews::V1beta::GetProductReviewRequest, ::Hash]
193
+ # A request object representing the call parameters. Required. To specify no
194
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
195
+ # @param options [::Gapic::CallOptions, ::Hash]
196
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
197
+ #
198
+ # @overload get_product_review(name: nil)
199
+ # Pass arguments to `get_product_review` via keyword arguments. Note that at
200
+ # least one keyword argument is required. To specify no parameters, or to keep all
201
+ # the default parameter values, pass an empty Hash as a request object (see above).
202
+ #
203
+ # @param name [::String]
204
+ # Required. The ID of the merchant review.
205
+ # Format: accounts/\\{account}/productReviews/\\{productReview}
206
+ # @yield [result, operation] Access the result along with the TransportOperation object
207
+ # @yieldparam result [::Google::Shopping::Merchant::Reviews::V1beta::ProductReview]
208
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
209
+ #
210
+ # @return [::Google::Shopping::Merchant::Reviews::V1beta::ProductReview]
211
+ #
212
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
213
+ #
214
+ # @example Basic example
215
+ # require "google/shopping/merchant/reviews/v1beta"
216
+ #
217
+ # # Create a client object. The client can be reused for multiple calls.
218
+ # client = Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client.new
219
+ #
220
+ # # Create a request. To set request fields, pass in keyword arguments.
221
+ # request = Google::Shopping::Merchant::Reviews::V1beta::GetProductReviewRequest.new
222
+ #
223
+ # # Call the get_product_review method.
224
+ # result = client.get_product_review request
225
+ #
226
+ # # The returned object is of type Google::Shopping::Merchant::Reviews::V1beta::ProductReview.
227
+ # p result
228
+ #
229
+ def get_product_review request, options = nil
230
+ raise ::ArgumentError, "request must be provided" if request.nil?
231
+
232
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Reviews::V1beta::GetProductReviewRequest
233
+
234
+ # Converts hash and nil to an options object
235
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
236
+
237
+ # Customize the options with defaults
238
+ call_metadata = @config.rpcs.get_product_review.metadata.to_h
239
+
240
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
241
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
242
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
243
+ gapic_version: ::Google::Shopping::Merchant::Reviews::V1beta::VERSION,
244
+ transports_version_send: [:rest]
245
+
246
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
247
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
248
+
249
+ options.apply_defaults timeout: @config.rpcs.get_product_review.timeout,
250
+ metadata: call_metadata,
251
+ retry_policy: @config.rpcs.get_product_review.retry_policy
252
+
253
+ options.apply_defaults timeout: @config.timeout,
254
+ metadata: @config.metadata,
255
+ retry_policy: @config.retry_policy
256
+
257
+ @product_reviews_service_stub.get_product_review request, options do |result, operation|
258
+ yield result, operation if block_given?
259
+ end
260
+ rescue ::Gapic::Rest::Error => e
261
+ raise ::Google::Cloud::Error.from_error(e)
262
+ end
263
+
264
+ ##
265
+ # Lists product reviews.
266
+ #
267
+ # @overload list_product_reviews(request, options = nil)
268
+ # Pass arguments to `list_product_reviews` via a request object, either of type
269
+ # {::Google::Shopping::Merchant::Reviews::V1beta::ListProductReviewsRequest} or an equivalent Hash.
270
+ #
271
+ # @param request [::Google::Shopping::Merchant::Reviews::V1beta::ListProductReviewsRequest, ::Hash]
272
+ # A request object representing the call parameters. Required. To specify no
273
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
274
+ # @param options [::Gapic::CallOptions, ::Hash]
275
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
276
+ #
277
+ # @overload list_product_reviews(parent: nil, page_size: nil, page_token: nil)
278
+ # Pass arguments to `list_product_reviews` via keyword arguments. Note that at
279
+ # least one keyword argument is required. To specify no parameters, or to keep all
280
+ # the default parameter values, pass an empty Hash as a request object (see above).
281
+ #
282
+ # @param parent [::String]
283
+ # Required. The account to list product reviews for.
284
+ # Format: accounts/\\{account}
285
+ # @param page_size [::Integer]
286
+ # Optional. The maximum number of products to return. The service may return
287
+ # fewer than this value.
288
+ # @param page_token [::String]
289
+ # Optional. A page token, received from a previous `ListProductReviews` call.
290
+ # Provide this to retrieve the subsequent page.
291
+ #
292
+ # When paginating, all other parameters provided to `ListProductReviews`
293
+ # must match the call that provided the page token.
294
+ # @yield [result, operation] Access the result along with the TransportOperation object
295
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Reviews::V1beta::ProductReview>]
296
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
297
+ #
298
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Reviews::V1beta::ProductReview>]
299
+ #
300
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
301
+ #
302
+ # @example Basic example
303
+ # require "google/shopping/merchant/reviews/v1beta"
304
+ #
305
+ # # Create a client object. The client can be reused for multiple calls.
306
+ # client = Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client.new
307
+ #
308
+ # # Create a request. To set request fields, pass in keyword arguments.
309
+ # request = Google::Shopping::Merchant::Reviews::V1beta::ListProductReviewsRequest.new
310
+ #
311
+ # # Call the list_product_reviews method.
312
+ # result = client.list_product_reviews request
313
+ #
314
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
315
+ # # over elements, and API calls will be issued to fetch pages as needed.
316
+ # result.each do |item|
317
+ # # Each element is of type ::Google::Shopping::Merchant::Reviews::V1beta::ProductReview.
318
+ # p item
319
+ # end
320
+ #
321
+ def list_product_reviews request, options = nil
322
+ raise ::ArgumentError, "request must be provided" if request.nil?
323
+
324
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Reviews::V1beta::ListProductReviewsRequest
325
+
326
+ # Converts hash and nil to an options object
327
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
328
+
329
+ # Customize the options with defaults
330
+ call_metadata = @config.rpcs.list_product_reviews.metadata.to_h
331
+
332
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
333
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
334
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
335
+ gapic_version: ::Google::Shopping::Merchant::Reviews::V1beta::VERSION,
336
+ transports_version_send: [:rest]
337
+
338
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
339
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
340
+
341
+ options.apply_defaults timeout: @config.rpcs.list_product_reviews.timeout,
342
+ metadata: call_metadata,
343
+ retry_policy: @config.rpcs.list_product_reviews.retry_policy
344
+
345
+ options.apply_defaults timeout: @config.timeout,
346
+ metadata: @config.metadata,
347
+ retry_policy: @config.retry_policy
348
+
349
+ @product_reviews_service_stub.list_product_reviews request, options do |result, operation|
350
+ result = ::Gapic::Rest::PagedEnumerable.new @product_reviews_service_stub, :list_product_reviews, "product_reviews", request, result, options
351
+ yield result, operation if block_given?
352
+ throw :response, result
353
+ end
354
+ rescue ::Gapic::Rest::Error => e
355
+ raise ::Google::Cloud::Error.from_error(e)
356
+ end
357
+
358
+ ##
359
+ # Inserts a product review.
360
+ #
361
+ # @overload insert_product_review(request, options = nil)
362
+ # Pass arguments to `insert_product_review` via a request object, either of type
363
+ # {::Google::Shopping::Merchant::Reviews::V1beta::InsertProductReviewRequest} or an equivalent Hash.
364
+ #
365
+ # @param request [::Google::Shopping::Merchant::Reviews::V1beta::InsertProductReviewRequest, ::Hash]
366
+ # A request object representing the call parameters. Required. To specify no
367
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
368
+ # @param options [::Gapic::CallOptions, ::Hash]
369
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
370
+ #
371
+ # @overload insert_product_review(parent: nil, product_review: nil, data_source: nil)
372
+ # Pass arguments to `insert_product_review` via keyword arguments. Note that at
373
+ # least one keyword argument is required. To specify no parameters, or to keep all
374
+ # the default parameter values, pass an empty Hash as a request object (see above).
375
+ #
376
+ # @param parent [::String]
377
+ # Required. The account where the product review will be inserted.
378
+ # Format: accounts/\\{account}
379
+ # @param product_review [::Google::Shopping::Merchant::Reviews::V1beta::ProductReview, ::Hash]
380
+ # Required. The product review to insert.
381
+ # @param data_source [::String]
382
+ # Required. Format:
383
+ # `accounts/{account}/dataSources/{datasource}`.
384
+ # @yield [result, operation] Access the result along with the TransportOperation object
385
+ # @yieldparam result [::Google::Shopping::Merchant::Reviews::V1beta::ProductReview]
386
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
387
+ #
388
+ # @return [::Google::Shopping::Merchant::Reviews::V1beta::ProductReview]
389
+ #
390
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
391
+ #
392
+ # @example Basic example
393
+ # require "google/shopping/merchant/reviews/v1beta"
394
+ #
395
+ # # Create a client object. The client can be reused for multiple calls.
396
+ # client = Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client.new
397
+ #
398
+ # # Create a request. To set request fields, pass in keyword arguments.
399
+ # request = Google::Shopping::Merchant::Reviews::V1beta::InsertProductReviewRequest.new
400
+ #
401
+ # # Call the insert_product_review method.
402
+ # result = client.insert_product_review request
403
+ #
404
+ # # The returned object is of type Google::Shopping::Merchant::Reviews::V1beta::ProductReview.
405
+ # p result
406
+ #
407
+ def insert_product_review request, options = nil
408
+ raise ::ArgumentError, "request must be provided" if request.nil?
409
+
410
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Reviews::V1beta::InsertProductReviewRequest
411
+
412
+ # Converts hash and nil to an options object
413
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
414
+
415
+ # Customize the options with defaults
416
+ call_metadata = @config.rpcs.insert_product_review.metadata.to_h
417
+
418
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
419
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
420
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
421
+ gapic_version: ::Google::Shopping::Merchant::Reviews::V1beta::VERSION,
422
+ transports_version_send: [:rest]
423
+
424
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
425
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
426
+
427
+ options.apply_defaults timeout: @config.rpcs.insert_product_review.timeout,
428
+ metadata: call_metadata,
429
+ retry_policy: @config.rpcs.insert_product_review.retry_policy
430
+
431
+ options.apply_defaults timeout: @config.timeout,
432
+ metadata: @config.metadata,
433
+ retry_policy: @config.retry_policy
434
+
435
+ @product_reviews_service_stub.insert_product_review request, options do |result, operation|
436
+ yield result, operation if block_given?
437
+ end
438
+ rescue ::Gapic::Rest::Error => e
439
+ raise ::Google::Cloud::Error.from_error(e)
440
+ end
441
+
442
+ ##
443
+ # Deletes a product review.
444
+ #
445
+ # @overload delete_product_review(request, options = nil)
446
+ # Pass arguments to `delete_product_review` via a request object, either of type
447
+ # {::Google::Shopping::Merchant::Reviews::V1beta::DeleteProductReviewRequest} or an equivalent Hash.
448
+ #
449
+ # @param request [::Google::Shopping::Merchant::Reviews::V1beta::DeleteProductReviewRequest, ::Hash]
450
+ # A request object representing the call parameters. Required. To specify no
451
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
452
+ # @param options [::Gapic::CallOptions, ::Hash]
453
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
454
+ #
455
+ # @overload delete_product_review(name: nil)
456
+ # Pass arguments to `delete_product_review` via keyword arguments. Note that at
457
+ # least one keyword argument is required. To specify no parameters, or to keep all
458
+ # the default parameter values, pass an empty Hash as a request object (see above).
459
+ #
460
+ # @param name [::String]
461
+ # Required. The ID of the Product review.
462
+ # Format: accounts/\\{account}/productReviews/\\{productReview}
463
+ # @yield [result, operation] Access the result along with the TransportOperation object
464
+ # @yieldparam result [::Google::Protobuf::Empty]
465
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
466
+ #
467
+ # @return [::Google::Protobuf::Empty]
468
+ #
469
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
470
+ #
471
+ # @example Basic example
472
+ # require "google/shopping/merchant/reviews/v1beta"
473
+ #
474
+ # # Create a client object. The client can be reused for multiple calls.
475
+ # client = Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client.new
476
+ #
477
+ # # Create a request. To set request fields, pass in keyword arguments.
478
+ # request = Google::Shopping::Merchant::Reviews::V1beta::DeleteProductReviewRequest.new
479
+ #
480
+ # # Call the delete_product_review method.
481
+ # result = client.delete_product_review request
482
+ #
483
+ # # The returned object is of type Google::Protobuf::Empty.
484
+ # p result
485
+ #
486
+ def delete_product_review request, options = nil
487
+ raise ::ArgumentError, "request must be provided" if request.nil?
488
+
489
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Reviews::V1beta::DeleteProductReviewRequest
490
+
491
+ # Converts hash and nil to an options object
492
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
493
+
494
+ # Customize the options with defaults
495
+ call_metadata = @config.rpcs.delete_product_review.metadata.to_h
496
+
497
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
498
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
499
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
500
+ gapic_version: ::Google::Shopping::Merchant::Reviews::V1beta::VERSION,
501
+ transports_version_send: [:rest]
502
+
503
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
504
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
505
+
506
+ options.apply_defaults timeout: @config.rpcs.delete_product_review.timeout,
507
+ metadata: call_metadata,
508
+ retry_policy: @config.rpcs.delete_product_review.retry_policy
509
+
510
+ options.apply_defaults timeout: @config.timeout,
511
+ metadata: @config.metadata,
512
+ retry_policy: @config.retry_policy
513
+
514
+ @product_reviews_service_stub.delete_product_review request, options do |result, operation|
515
+ yield result, operation if block_given?
516
+ end
517
+ rescue ::Gapic::Rest::Error => e
518
+ raise ::Google::Cloud::Error.from_error(e)
519
+ end
520
+
521
+ ##
522
+ # Configuration class for the ProductReviewsService REST API.
523
+ #
524
+ # This class represents the configuration for ProductReviewsService REST,
525
+ # providing control over timeouts, retry behavior, logging, transport
526
+ # parameters, and other low-level controls. Certain parameters can also be
527
+ # applied individually to specific RPCs. See
528
+ # {::Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client::Configuration::Rpcs}
529
+ # for a list of RPCs that can be configured independently.
530
+ #
531
+ # Configuration can be applied globally to all clients, or to a single client
532
+ # on construction.
533
+ #
534
+ # @example
535
+ #
536
+ # # Modify the global config, setting the timeout for
537
+ # # get_product_review to 20 seconds,
538
+ # # and all remaining timeouts to 10 seconds.
539
+ # ::Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client.configure do |config|
540
+ # config.timeout = 10.0
541
+ # config.rpcs.get_product_review.timeout = 20.0
542
+ # end
543
+ #
544
+ # # Apply the above configuration only to a new client.
545
+ # client = ::Google::Shopping::Merchant::Reviews::V1beta::ProductReviewsService::Rest::Client.new do |config|
546
+ # config.timeout = 10.0
547
+ # config.rpcs.get_product_review.timeout = 20.0
548
+ # end
549
+ #
550
+ # @!attribute [rw] endpoint
551
+ # A custom service endpoint, as a hostname or hostname:port. The default is
552
+ # nil, indicating to use the default endpoint in the current universe domain.
553
+ # @return [::String,nil]
554
+ # @!attribute [rw] credentials
555
+ # Credentials to send with calls. You may provide any of the following types:
556
+ # * (`String`) The path to a service account key file in JSON format
557
+ # * (`Hash`) A service account key as a Hash
558
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
559
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
560
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
561
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
562
+ # * (`nil`) indicating no credentials
563
+ # @return [::Object]
564
+ # @!attribute [rw] scope
565
+ # The OAuth scopes
566
+ # @return [::Array<::String>]
567
+ # @!attribute [rw] lib_name
568
+ # The library name as recorded in instrumentation and logging
569
+ # @return [::String]
570
+ # @!attribute [rw] lib_version
571
+ # The library version as recorded in instrumentation and logging
572
+ # @return [::String]
573
+ # @!attribute [rw] timeout
574
+ # The call timeout in seconds.
575
+ # @return [::Numeric]
576
+ # @!attribute [rw] metadata
577
+ # Additional headers to be sent with the call.
578
+ # @return [::Hash{::Symbol=>::String}]
579
+ # @!attribute [rw] retry_policy
580
+ # The retry policy. The value is a hash with the following keys:
581
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
582
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
583
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
584
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
585
+ # trigger a retry.
586
+ # @return [::Hash]
587
+ # @!attribute [rw] quota_project
588
+ # A separate project against which to charge quota.
589
+ # @return [::String]
590
+ # @!attribute [rw] universe_domain
591
+ # The universe domain within which to make requests. This determines the
592
+ # default endpoint URL. The default value of nil uses the environment
593
+ # universe (usually the default "googleapis.com" universe).
594
+ # @return [::String,nil]
595
+ # @!attribute [rw] logger
596
+ # A custom logger to use for request/response debug logging, or the value
597
+ # `:default` (the default) to construct a default logger, or `nil` to
598
+ # explicitly disable logging.
599
+ # @return [::Logger,:default,nil]
600
+ #
601
+ class Configuration
602
+ extend ::Gapic::Config
603
+
604
+ # @private
605
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
606
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
607
+
608
+ config_attr :endpoint, nil, ::String, nil
609
+ config_attr :credentials, nil do |value|
610
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
611
+ allowed.any? { |klass| klass === value }
612
+ end
613
+ config_attr :scope, nil, ::String, ::Array, nil
614
+ config_attr :lib_name, nil, ::String, nil
615
+ config_attr :lib_version, nil, ::String, nil
616
+ config_attr :timeout, nil, ::Numeric, nil
617
+ config_attr :metadata, nil, ::Hash, nil
618
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
619
+ config_attr :quota_project, nil, ::String, nil
620
+ config_attr :universe_domain, nil, ::String, nil
621
+ config_attr :logger, :default, ::Logger, nil, :default
622
+
623
+ # @private
624
+ def initialize parent_config = nil
625
+ @parent_config = parent_config unless parent_config.nil?
626
+
627
+ yield self if block_given?
628
+ end
629
+
630
+ ##
631
+ # Configurations for individual RPCs
632
+ # @return [Rpcs]
633
+ #
634
+ def rpcs
635
+ @rpcs ||= begin
636
+ parent_rpcs = nil
637
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
638
+ Rpcs.new parent_rpcs
639
+ end
640
+ end
641
+
642
+ ##
643
+ # Configuration RPC class for the ProductReviewsService API.
644
+ #
645
+ # Includes fields providing the configuration for each RPC in this service.
646
+ # Each configuration object is of type `Gapic::Config::Method` and includes
647
+ # the following configuration fields:
648
+ #
649
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
650
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
651
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
652
+ # include the following keys:
653
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
654
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
655
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
656
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
657
+ # trigger a retry.
658
+ #
659
+ class Rpcs
660
+ ##
661
+ # RPC-specific configuration for `get_product_review`
662
+ # @return [::Gapic::Config::Method]
663
+ #
664
+ attr_reader :get_product_review
665
+ ##
666
+ # RPC-specific configuration for `list_product_reviews`
667
+ # @return [::Gapic::Config::Method]
668
+ #
669
+ attr_reader :list_product_reviews
670
+ ##
671
+ # RPC-specific configuration for `insert_product_review`
672
+ # @return [::Gapic::Config::Method]
673
+ #
674
+ attr_reader :insert_product_review
675
+ ##
676
+ # RPC-specific configuration for `delete_product_review`
677
+ # @return [::Gapic::Config::Method]
678
+ #
679
+ attr_reader :delete_product_review
680
+
681
+ # @private
682
+ def initialize parent_rpcs = nil
683
+ get_product_review_config = parent_rpcs.get_product_review if parent_rpcs.respond_to? :get_product_review
684
+ @get_product_review = ::Gapic::Config::Method.new get_product_review_config
685
+ list_product_reviews_config = parent_rpcs.list_product_reviews if parent_rpcs.respond_to? :list_product_reviews
686
+ @list_product_reviews = ::Gapic::Config::Method.new list_product_reviews_config
687
+ insert_product_review_config = parent_rpcs.insert_product_review if parent_rpcs.respond_to? :insert_product_review
688
+ @insert_product_review = ::Gapic::Config::Method.new insert_product_review_config
689
+ delete_product_review_config = parent_rpcs.delete_product_review if parent_rpcs.respond_to? :delete_product_review
690
+ @delete_product_review = ::Gapic::Config::Method.new delete_product_review_config
691
+
692
+ yield self if block_given?
693
+ end
694
+ end
695
+ end
696
+ end
697
+ end
698
+ end
699
+ end
700
+ end
701
+ end
702
+ end
703
+ end