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,708 @@
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/merchantreviews_pb"
21
+ require "google/shopping/merchant/reviews/v1beta/merchant_reviews_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Reviews
27
+ module V1beta
28
+ module MerchantReviewsService
29
+ module Rest
30
+ ##
31
+ # REST client for the MerchantReviewsService service.
32
+ #
33
+ # Service to manage merchant 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 :merchant_reviews_service_stub
46
+
47
+ ##
48
+ # Configure the MerchantReviewsService Client class.
49
+ #
50
+ # See {::Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all MerchantReviewsService clients
56
+ # ::Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::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 MerchantReviewsService 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::MerchantReviewsService::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
+ @merchant_reviews_service_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new MerchantReviewsService REST client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::Rest::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::Rest::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the MerchantReviewsService 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
+ @merchant_reviews_service_stub = ::Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::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
+ @merchant_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
+ @merchant_reviews_service_stub.logger
181
+ end
182
+
183
+ # Service calls
184
+
185
+ ##
186
+ # Gets a merchant review.
187
+ #
188
+ # @overload get_merchant_review(request, options = nil)
189
+ # Pass arguments to `get_merchant_review` via a request object, either of type
190
+ # {::Google::Shopping::Merchant::Reviews::V1beta::GetMerchantReviewRequest} or an equivalent Hash.
191
+ #
192
+ # @param request [::Google::Shopping::Merchant::Reviews::V1beta::GetMerchantReviewRequest, ::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_merchant_review(name: nil)
199
+ # Pass arguments to `get_merchant_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}/merchantReviews/\\{merchantReview}
206
+ # @yield [result, operation] Access the result along with the TransportOperation object
207
+ # @yieldparam result [::Google::Shopping::Merchant::Reviews::V1beta::MerchantReview]
208
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
209
+ #
210
+ # @return [::Google::Shopping::Merchant::Reviews::V1beta::MerchantReview]
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::MerchantReviewsService::Rest::Client.new
219
+ #
220
+ # # Create a request. To set request fields, pass in keyword arguments.
221
+ # request = Google::Shopping::Merchant::Reviews::V1beta::GetMerchantReviewRequest.new
222
+ #
223
+ # # Call the get_merchant_review method.
224
+ # result = client.get_merchant_review request
225
+ #
226
+ # # The returned object is of type Google::Shopping::Merchant::Reviews::V1beta::MerchantReview.
227
+ # p result
228
+ #
229
+ def get_merchant_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::GetMerchantReviewRequest
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_merchant_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_merchant_review.timeout,
250
+ metadata: call_metadata,
251
+ retry_policy: @config.rpcs.get_merchant_review.retry_policy
252
+
253
+ options.apply_defaults timeout: @config.timeout,
254
+ metadata: @config.metadata,
255
+ retry_policy: @config.retry_policy
256
+
257
+ @merchant_reviews_service_stub.get_merchant_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 merchant reviews.
266
+ #
267
+ # @overload list_merchant_reviews(request, options = nil)
268
+ # Pass arguments to `list_merchant_reviews` via a request object, either of type
269
+ # {::Google::Shopping::Merchant::Reviews::V1beta::ListMerchantReviewsRequest} or an equivalent Hash.
270
+ #
271
+ # @param request [::Google::Shopping::Merchant::Reviews::V1beta::ListMerchantReviewsRequest, ::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_merchant_reviews(parent: nil, page_size: nil, page_token: nil)
278
+ # Pass arguments to `list_merchant_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 merchant reviews for.
284
+ # Format: accounts/\\{account}
285
+ # @param page_size [::Integer]
286
+ # Optional. The maximum number of merchant reviews to return. The service can
287
+ # return fewer than this value. The maximum value is 1000; values above 1000
288
+ # are coerced to 1000. If unspecified, the maximum number of reviews is
289
+ # returned.
290
+ # @param page_token [::String]
291
+ # Optional. A page token, received from a previous `ListMerchantReviews`
292
+ # call. Provide this to retrieve the subsequent page.
293
+ #
294
+ # When paginating, all other parameters provided to `ListMerchantReviews`
295
+ # must match the call that provided the page token.
296
+ # @yield [result, operation] Access the result along with the TransportOperation object
297
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Reviews::V1beta::MerchantReview>]
298
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
299
+ #
300
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Reviews::V1beta::MerchantReview>]
301
+ #
302
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
303
+ #
304
+ # @example Basic example
305
+ # require "google/shopping/merchant/reviews/v1beta"
306
+ #
307
+ # # Create a client object. The client can be reused for multiple calls.
308
+ # client = Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::Rest::Client.new
309
+ #
310
+ # # Create a request. To set request fields, pass in keyword arguments.
311
+ # request = Google::Shopping::Merchant::Reviews::V1beta::ListMerchantReviewsRequest.new
312
+ #
313
+ # # Call the list_merchant_reviews method.
314
+ # result = client.list_merchant_reviews request
315
+ #
316
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
317
+ # # over elements, and API calls will be issued to fetch pages as needed.
318
+ # result.each do |item|
319
+ # # Each element is of type ::Google::Shopping::Merchant::Reviews::V1beta::MerchantReview.
320
+ # p item
321
+ # end
322
+ #
323
+ def list_merchant_reviews request, options = nil
324
+ raise ::ArgumentError, "request must be provided" if request.nil?
325
+
326
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Reviews::V1beta::ListMerchantReviewsRequest
327
+
328
+ # Converts hash and nil to an options object
329
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
330
+
331
+ # Customize the options with defaults
332
+ call_metadata = @config.rpcs.list_merchant_reviews.metadata.to_h
333
+
334
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
335
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
336
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
337
+ gapic_version: ::Google::Shopping::Merchant::Reviews::V1beta::VERSION,
338
+ transports_version_send: [:rest]
339
+
340
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
341
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
342
+
343
+ options.apply_defaults timeout: @config.rpcs.list_merchant_reviews.timeout,
344
+ metadata: call_metadata,
345
+ retry_policy: @config.rpcs.list_merchant_reviews.retry_policy
346
+
347
+ options.apply_defaults timeout: @config.timeout,
348
+ metadata: @config.metadata,
349
+ retry_policy: @config.retry_policy
350
+
351
+ @merchant_reviews_service_stub.list_merchant_reviews request, options do |result, operation|
352
+ result = ::Gapic::Rest::PagedEnumerable.new @merchant_reviews_service_stub, :list_merchant_reviews, "merchant_reviews", request, result, options
353
+ yield result, operation if block_given?
354
+ throw :response, result
355
+ end
356
+ rescue ::Gapic::Rest::Error => e
357
+ raise ::Google::Cloud::Error.from_error(e)
358
+ end
359
+
360
+ ##
361
+ # Inserts a review for your Merchant Center account. If the review
362
+ # already exists, then the review is replaced with the new instance.
363
+ #
364
+ # @overload insert_merchant_review(request, options = nil)
365
+ # Pass arguments to `insert_merchant_review` via a request object, either of type
366
+ # {::Google::Shopping::Merchant::Reviews::V1beta::InsertMerchantReviewRequest} or an equivalent Hash.
367
+ #
368
+ # @param request [::Google::Shopping::Merchant::Reviews::V1beta::InsertMerchantReviewRequest, ::Hash]
369
+ # A request object representing the call parameters. Required. To specify no
370
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
371
+ # @param options [::Gapic::CallOptions, ::Hash]
372
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
373
+ #
374
+ # @overload insert_merchant_review(parent: nil, merchant_review: nil, data_source: nil)
375
+ # Pass arguments to `insert_merchant_review` via keyword arguments. Note that at
376
+ # least one keyword argument is required. To specify no parameters, or to keep all
377
+ # the default parameter values, pass an empty Hash as a request object (see above).
378
+ #
379
+ # @param parent [::String]
380
+ # Required. The account where the merchant review will be inserted.
381
+ # Format: accounts/\\{account}
382
+ # @param merchant_review [::Google::Shopping::Merchant::Reviews::V1beta::MerchantReview, ::Hash]
383
+ # Required. The merchant review to insert.
384
+ # @param data_source [::String]
385
+ # Required. The data source of the
386
+ # [merchantreview](https://support.google.com/merchants/answer/7045996?sjid=5253581244217581976-EU)
387
+ # Format:
388
+ # `accounts/{account}/dataSources/{datasource}`.
389
+ # @yield [result, operation] Access the result along with the TransportOperation object
390
+ # @yieldparam result [::Google::Shopping::Merchant::Reviews::V1beta::MerchantReview]
391
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
392
+ #
393
+ # @return [::Google::Shopping::Merchant::Reviews::V1beta::MerchantReview]
394
+ #
395
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
396
+ #
397
+ # @example Basic example
398
+ # require "google/shopping/merchant/reviews/v1beta"
399
+ #
400
+ # # Create a client object. The client can be reused for multiple calls.
401
+ # client = Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::Rest::Client.new
402
+ #
403
+ # # Create a request. To set request fields, pass in keyword arguments.
404
+ # request = Google::Shopping::Merchant::Reviews::V1beta::InsertMerchantReviewRequest.new
405
+ #
406
+ # # Call the insert_merchant_review method.
407
+ # result = client.insert_merchant_review request
408
+ #
409
+ # # The returned object is of type Google::Shopping::Merchant::Reviews::V1beta::MerchantReview.
410
+ # p result
411
+ #
412
+ def insert_merchant_review request, options = nil
413
+ raise ::ArgumentError, "request must be provided" if request.nil?
414
+
415
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Reviews::V1beta::InsertMerchantReviewRequest
416
+
417
+ # Converts hash and nil to an options object
418
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
419
+
420
+ # Customize the options with defaults
421
+ call_metadata = @config.rpcs.insert_merchant_review.metadata.to_h
422
+
423
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
424
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
425
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
426
+ gapic_version: ::Google::Shopping::Merchant::Reviews::V1beta::VERSION,
427
+ transports_version_send: [:rest]
428
+
429
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
430
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
431
+
432
+ options.apply_defaults timeout: @config.rpcs.insert_merchant_review.timeout,
433
+ metadata: call_metadata,
434
+ retry_policy: @config.rpcs.insert_merchant_review.retry_policy
435
+
436
+ options.apply_defaults timeout: @config.timeout,
437
+ metadata: @config.metadata,
438
+ retry_policy: @config.retry_policy
439
+
440
+ @merchant_reviews_service_stub.insert_merchant_review request, options do |result, operation|
441
+ yield result, operation if block_given?
442
+ end
443
+ rescue ::Gapic::Rest::Error => e
444
+ raise ::Google::Cloud::Error.from_error(e)
445
+ end
446
+
447
+ ##
448
+ # Deletes merchant review.
449
+ #
450
+ # @overload delete_merchant_review(request, options = nil)
451
+ # Pass arguments to `delete_merchant_review` via a request object, either of type
452
+ # {::Google::Shopping::Merchant::Reviews::V1beta::DeleteMerchantReviewRequest} or an equivalent Hash.
453
+ #
454
+ # @param request [::Google::Shopping::Merchant::Reviews::V1beta::DeleteMerchantReviewRequest, ::Hash]
455
+ # A request object representing the call parameters. Required. To specify no
456
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
457
+ # @param options [::Gapic::CallOptions, ::Hash]
458
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
459
+ #
460
+ # @overload delete_merchant_review(name: nil)
461
+ # Pass arguments to `delete_merchant_review` via keyword arguments. Note that at
462
+ # least one keyword argument is required. To specify no parameters, or to keep all
463
+ # the default parameter values, pass an empty Hash as a request object (see above).
464
+ #
465
+ # @param name [::String]
466
+ # Required. The ID of the merchant review.
467
+ # Format: accounts/\\{account}/merchantReviews/\\{merchantReview}
468
+ # @yield [result, operation] Access the result along with the TransportOperation object
469
+ # @yieldparam result [::Google::Protobuf::Empty]
470
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
471
+ #
472
+ # @return [::Google::Protobuf::Empty]
473
+ #
474
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
475
+ #
476
+ # @example Basic example
477
+ # require "google/shopping/merchant/reviews/v1beta"
478
+ #
479
+ # # Create a client object. The client can be reused for multiple calls.
480
+ # client = Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::Rest::Client.new
481
+ #
482
+ # # Create a request. To set request fields, pass in keyword arguments.
483
+ # request = Google::Shopping::Merchant::Reviews::V1beta::DeleteMerchantReviewRequest.new
484
+ #
485
+ # # Call the delete_merchant_review method.
486
+ # result = client.delete_merchant_review request
487
+ #
488
+ # # The returned object is of type Google::Protobuf::Empty.
489
+ # p result
490
+ #
491
+ def delete_merchant_review request, options = nil
492
+ raise ::ArgumentError, "request must be provided" if request.nil?
493
+
494
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Reviews::V1beta::DeleteMerchantReviewRequest
495
+
496
+ # Converts hash and nil to an options object
497
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
498
+
499
+ # Customize the options with defaults
500
+ call_metadata = @config.rpcs.delete_merchant_review.metadata.to_h
501
+
502
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
503
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
504
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
505
+ gapic_version: ::Google::Shopping::Merchant::Reviews::V1beta::VERSION,
506
+ transports_version_send: [:rest]
507
+
508
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
509
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
510
+
511
+ options.apply_defaults timeout: @config.rpcs.delete_merchant_review.timeout,
512
+ metadata: call_metadata,
513
+ retry_policy: @config.rpcs.delete_merchant_review.retry_policy
514
+
515
+ options.apply_defaults timeout: @config.timeout,
516
+ metadata: @config.metadata,
517
+ retry_policy: @config.retry_policy
518
+
519
+ @merchant_reviews_service_stub.delete_merchant_review request, options do |result, operation|
520
+ yield result, operation if block_given?
521
+ end
522
+ rescue ::Gapic::Rest::Error => e
523
+ raise ::Google::Cloud::Error.from_error(e)
524
+ end
525
+
526
+ ##
527
+ # Configuration class for the MerchantReviewsService REST API.
528
+ #
529
+ # This class represents the configuration for MerchantReviewsService REST,
530
+ # providing control over timeouts, retry behavior, logging, transport
531
+ # parameters, and other low-level controls. Certain parameters can also be
532
+ # applied individually to specific RPCs. See
533
+ # {::Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::Rest::Client::Configuration::Rpcs}
534
+ # for a list of RPCs that can be configured independently.
535
+ #
536
+ # Configuration can be applied globally to all clients, or to a single client
537
+ # on construction.
538
+ #
539
+ # @example
540
+ #
541
+ # # Modify the global config, setting the timeout for
542
+ # # get_merchant_review to 20 seconds,
543
+ # # and all remaining timeouts to 10 seconds.
544
+ # ::Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::Rest::Client.configure do |config|
545
+ # config.timeout = 10.0
546
+ # config.rpcs.get_merchant_review.timeout = 20.0
547
+ # end
548
+ #
549
+ # # Apply the above configuration only to a new client.
550
+ # client = ::Google::Shopping::Merchant::Reviews::V1beta::MerchantReviewsService::Rest::Client.new do |config|
551
+ # config.timeout = 10.0
552
+ # config.rpcs.get_merchant_review.timeout = 20.0
553
+ # end
554
+ #
555
+ # @!attribute [rw] endpoint
556
+ # A custom service endpoint, as a hostname or hostname:port. The default is
557
+ # nil, indicating to use the default endpoint in the current universe domain.
558
+ # @return [::String,nil]
559
+ # @!attribute [rw] credentials
560
+ # Credentials to send with calls. You may provide any of the following types:
561
+ # * (`String`) The path to a service account key file in JSON format
562
+ # * (`Hash`) A service account key as a Hash
563
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
564
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
565
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
566
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
567
+ # * (`nil`) indicating no credentials
568
+ # @return [::Object]
569
+ # @!attribute [rw] scope
570
+ # The OAuth scopes
571
+ # @return [::Array<::String>]
572
+ # @!attribute [rw] lib_name
573
+ # The library name as recorded in instrumentation and logging
574
+ # @return [::String]
575
+ # @!attribute [rw] lib_version
576
+ # The library version as recorded in instrumentation and logging
577
+ # @return [::String]
578
+ # @!attribute [rw] timeout
579
+ # The call timeout in seconds.
580
+ # @return [::Numeric]
581
+ # @!attribute [rw] metadata
582
+ # Additional headers to be sent with the call.
583
+ # @return [::Hash{::Symbol=>::String}]
584
+ # @!attribute [rw] retry_policy
585
+ # The retry policy. The value is a hash with the following keys:
586
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
587
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
588
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
589
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
590
+ # trigger a retry.
591
+ # @return [::Hash]
592
+ # @!attribute [rw] quota_project
593
+ # A separate project against which to charge quota.
594
+ # @return [::String]
595
+ # @!attribute [rw] universe_domain
596
+ # The universe domain within which to make requests. This determines the
597
+ # default endpoint URL. The default value of nil uses the environment
598
+ # universe (usually the default "googleapis.com" universe).
599
+ # @return [::String,nil]
600
+ # @!attribute [rw] logger
601
+ # A custom logger to use for request/response debug logging, or the value
602
+ # `:default` (the default) to construct a default logger, or `nil` to
603
+ # explicitly disable logging.
604
+ # @return [::Logger,:default,nil]
605
+ #
606
+ class Configuration
607
+ extend ::Gapic::Config
608
+
609
+ # @private
610
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
611
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
612
+
613
+ config_attr :endpoint, nil, ::String, nil
614
+ config_attr :credentials, nil do |value|
615
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
616
+ allowed.any? { |klass| klass === value }
617
+ end
618
+ config_attr :scope, nil, ::String, ::Array, nil
619
+ config_attr :lib_name, nil, ::String, nil
620
+ config_attr :lib_version, nil, ::String, nil
621
+ config_attr :timeout, nil, ::Numeric, nil
622
+ config_attr :metadata, nil, ::Hash, nil
623
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
624
+ config_attr :quota_project, nil, ::String, nil
625
+ config_attr :universe_domain, nil, ::String, nil
626
+ config_attr :logger, :default, ::Logger, nil, :default
627
+
628
+ # @private
629
+ def initialize parent_config = nil
630
+ @parent_config = parent_config unless parent_config.nil?
631
+
632
+ yield self if block_given?
633
+ end
634
+
635
+ ##
636
+ # Configurations for individual RPCs
637
+ # @return [Rpcs]
638
+ #
639
+ def rpcs
640
+ @rpcs ||= begin
641
+ parent_rpcs = nil
642
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
643
+ Rpcs.new parent_rpcs
644
+ end
645
+ end
646
+
647
+ ##
648
+ # Configuration RPC class for the MerchantReviewsService API.
649
+ #
650
+ # Includes fields providing the configuration for each RPC in this service.
651
+ # Each configuration object is of type `Gapic::Config::Method` and includes
652
+ # the following configuration fields:
653
+ #
654
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
655
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
656
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
657
+ # include the following keys:
658
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
659
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
660
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
661
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
662
+ # trigger a retry.
663
+ #
664
+ class Rpcs
665
+ ##
666
+ # RPC-specific configuration for `get_merchant_review`
667
+ # @return [::Gapic::Config::Method]
668
+ #
669
+ attr_reader :get_merchant_review
670
+ ##
671
+ # RPC-specific configuration for `list_merchant_reviews`
672
+ # @return [::Gapic::Config::Method]
673
+ #
674
+ attr_reader :list_merchant_reviews
675
+ ##
676
+ # RPC-specific configuration for `insert_merchant_review`
677
+ # @return [::Gapic::Config::Method]
678
+ #
679
+ attr_reader :insert_merchant_review
680
+ ##
681
+ # RPC-specific configuration for `delete_merchant_review`
682
+ # @return [::Gapic::Config::Method]
683
+ #
684
+ attr_reader :delete_merchant_review
685
+
686
+ # @private
687
+ def initialize parent_rpcs = nil
688
+ get_merchant_review_config = parent_rpcs.get_merchant_review if parent_rpcs.respond_to? :get_merchant_review
689
+ @get_merchant_review = ::Gapic::Config::Method.new get_merchant_review_config
690
+ list_merchant_reviews_config = parent_rpcs.list_merchant_reviews if parent_rpcs.respond_to? :list_merchant_reviews
691
+ @list_merchant_reviews = ::Gapic::Config::Method.new list_merchant_reviews_config
692
+ insert_merchant_review_config = parent_rpcs.insert_merchant_review if parent_rpcs.respond_to? :insert_merchant_review
693
+ @insert_merchant_review = ::Gapic::Config::Method.new insert_merchant_review_config
694
+ delete_merchant_review_config = parent_rpcs.delete_merchant_review if parent_rpcs.respond_to? :delete_merchant_review
695
+ @delete_merchant_review = ::Gapic::Config::Method.new delete_merchant_review_config
696
+
697
+ yield self if block_given?
698
+ end
699
+ end
700
+ end
701
+ end
702
+ end
703
+ end
704
+ end
705
+ end
706
+ end
707
+ end
708
+ end