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