google-shopping-merchant-promotions-v1 0.a → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +12 -0
  3. data/AUTHENTICATION.md +122 -0
  4. data/README.md +154 -8
  5. data/lib/google/shopping/merchant/promotions/v1/promotions_common_pb.rb +62 -0
  6. data/lib/google/shopping/merchant/promotions/v1/promotions_pb.rb +57 -0
  7. data/lib/google/shopping/merchant/promotions/v1/promotions_service/client.rb +684 -0
  8. data/lib/google/shopping/merchant/promotions/v1/promotions_service/credentials.rb +49 -0
  9. data/lib/google/shopping/merchant/promotions/v1/promotions_service/paths.rb +52 -0
  10. data/lib/google/shopping/merchant/promotions/v1/promotions_service/rest/client.rb +637 -0
  11. data/lib/google/shopping/merchant/promotions/v1/promotions_service/rest/service_stub.rb +267 -0
  12. data/lib/google/shopping/merchant/promotions/v1/promotions_service/rest.rb +54 -0
  13. data/lib/google/shopping/merchant/promotions/v1/promotions_service.rb +57 -0
  14. data/lib/google/shopping/merchant/promotions/v1/promotions_services_pb.rb +60 -0
  15. data/lib/google/shopping/merchant/promotions/v1/rest.rb +39 -0
  16. data/lib/google/shopping/merchant/promotions/v1/version.rb +7 -2
  17. data/lib/google/shopping/merchant/promotions/v1.rb +47 -0
  18. data/lib/google-shopping-merchant-promotions-v1.rb +21 -0
  19. data/proto_docs/README.md +4 -0
  20. data/proto_docs/google/api/client.rb +473 -0
  21. data/proto_docs/google/api/field_behavior.rb +85 -0
  22. data/proto_docs/google/api/launch_stage.rb +71 -0
  23. data/proto_docs/google/api/resource.rb +227 -0
  24. data/proto_docs/google/protobuf/duration.rb +98 -0
  25. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  26. data/proto_docs/google/shopping/merchant/promotions/v1/promotions.rb +176 -0
  27. data/proto_docs/google/shopping/merchant/promotions/v1/promotions_common.rb +446 -0
  28. data/proto_docs/google/shopping/type/types.rb +210 -0
  29. data/proto_docs/google/type/interval.rb +45 -0
  30. metadata +88 -9
@@ -0,0 +1,637 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright 2025 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/promotions/v1/promotions_pb"
21
+ require "google/shopping/merchant/promotions/v1/promotions_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Promotions
27
+ module V1
28
+ module PromotionsService
29
+ module Rest
30
+ ##
31
+ # REST client for the PromotionsService service.
32
+ #
33
+ # Service to manage promotions for products.
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 :promotions_service_stub
46
+
47
+ ##
48
+ # Configure the PromotionsService Client class.
49
+ #
50
+ # See {::Google::Shopping::Merchant::Promotions::V1::PromotionsService::Rest::Client::Configuration}
51
+ # for a description of the configuration fields.
52
+ #
53
+ # @example
54
+ #
55
+ # # Modify the configuration for all PromotionsService clients
56
+ # ::Google::Shopping::Merchant::Promotions::V1::PromotionsService::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", "Promotions", "V1"]
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 PromotionsService 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::Promotions::V1::PromotionsService::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
+ @promotions_service_stub.universe_domain
114
+ end
115
+
116
+ ##
117
+ # Create a new PromotionsService REST client object.
118
+ #
119
+ # @example
120
+ #
121
+ # # Create a client using the default configuration
122
+ # client = ::Google::Shopping::Merchant::Promotions::V1::PromotionsService::Rest::Client.new
123
+ #
124
+ # # Create a client using a custom configuration
125
+ # client = ::Google::Shopping::Merchant::Promotions::V1::PromotionsService::Rest::Client.new do |config|
126
+ # config.timeout = 10.0
127
+ # end
128
+ #
129
+ # @yield [config] Configure the PromotionsService 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
+ @promotions_service_stub = ::Google::Shopping::Merchant::Promotions::V1::PromotionsService::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
+ @promotions_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
+ @promotions_service_stub.logger
181
+ end
182
+
183
+ # Service calls
184
+
185
+ ##
186
+ # Inserts a promotion for your Merchant Center account. If the promotion
187
+ # already exists, then it updates the promotion instead.
188
+ #
189
+ # @overload insert_promotion(request, options = nil)
190
+ # Pass arguments to `insert_promotion` via a request object, either of type
191
+ # {::Google::Shopping::Merchant::Promotions::V1::InsertPromotionRequest} or an equivalent Hash.
192
+ #
193
+ # @param request [::Google::Shopping::Merchant::Promotions::V1::InsertPromotionRequest, ::Hash]
194
+ # A request object representing the call parameters. Required. To specify no
195
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
196
+ # @param options [::Gapic::CallOptions, ::Hash]
197
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
198
+ #
199
+ # @overload insert_promotion(parent: nil, promotion: nil, data_source: nil)
200
+ # Pass arguments to `insert_promotion` via keyword arguments. Note that at
201
+ # least one keyword argument is required. To specify no parameters, or to keep all
202
+ # the default parameter values, pass an empty Hash as a request object (see above).
203
+ #
204
+ # @param parent [::String]
205
+ # Required. The account where the promotion will be inserted.
206
+ # Format: accounts/\\{account}
207
+ # @param promotion [::Google::Shopping::Merchant::Promotions::V1::Promotion, ::Hash]
208
+ # Required. The promotion to insert.
209
+ # @param data_source [::String]
210
+ # Required. The data source of the
211
+ # [promotion](https://support.google.com/merchants/answer/6396268?sjid=5155774230887277618-NC)
212
+ # Format:
213
+ # `accounts/{account}/dataSources/{datasource}`.
214
+ # @yield [result, operation] Access the result along with the TransportOperation object
215
+ # @yieldparam result [::Google::Shopping::Merchant::Promotions::V1::Promotion]
216
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
217
+ #
218
+ # @return [::Google::Shopping::Merchant::Promotions::V1::Promotion]
219
+ #
220
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
221
+ #
222
+ # @example Basic example
223
+ # require "google/shopping/merchant/promotions/v1"
224
+ #
225
+ # # Create a client object. The client can be reused for multiple calls.
226
+ # client = Google::Shopping::Merchant::Promotions::V1::PromotionsService::Rest::Client.new
227
+ #
228
+ # # Create a request. To set request fields, pass in keyword arguments.
229
+ # request = Google::Shopping::Merchant::Promotions::V1::InsertPromotionRequest.new
230
+ #
231
+ # # Call the insert_promotion method.
232
+ # result = client.insert_promotion request
233
+ #
234
+ # # The returned object is of type Google::Shopping::Merchant::Promotions::V1::Promotion.
235
+ # p result
236
+ #
237
+ def insert_promotion request, options = nil
238
+ raise ::ArgumentError, "request must be provided" if request.nil?
239
+
240
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Promotions::V1::InsertPromotionRequest
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
+ call_metadata = @config.rpcs.insert_promotion.metadata.to_h
247
+
248
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
249
+ call_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::Promotions::V1::VERSION,
252
+ transports_version_send: [:rest]
253
+
254
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
255
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
256
+
257
+ options.apply_defaults timeout: @config.rpcs.insert_promotion.timeout,
258
+ metadata: call_metadata,
259
+ retry_policy: @config.rpcs.insert_promotion.retry_policy
260
+
261
+ options.apply_defaults timeout: @config.timeout,
262
+ metadata: @config.metadata,
263
+ retry_policy: @config.retry_policy
264
+
265
+ @promotions_service_stub.insert_promotion request, options do |result, operation|
266
+ yield result, operation if block_given?
267
+ end
268
+ rescue ::Gapic::Rest::Error => e
269
+ raise ::Google::Cloud::Error.from_error(e)
270
+ end
271
+
272
+ ##
273
+ # Retrieves the promotion from your Merchant Center account.
274
+ #
275
+ # After inserting or updating a promotion input, it may take several
276
+ # minutes before the updated promotion can be retrieved.
277
+ #
278
+ # @overload get_promotion(request, options = nil)
279
+ # Pass arguments to `get_promotion` via a request object, either of type
280
+ # {::Google::Shopping::Merchant::Promotions::V1::GetPromotionRequest} or an equivalent Hash.
281
+ #
282
+ # @param request [::Google::Shopping::Merchant::Promotions::V1::GetPromotionRequest, ::Hash]
283
+ # A request object representing the call parameters. Required. To specify no
284
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
285
+ # @param options [::Gapic::CallOptions, ::Hash]
286
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
287
+ #
288
+ # @overload get_promotion(name: nil)
289
+ # Pass arguments to `get_promotion` via keyword arguments. Note that at
290
+ # least one keyword argument is required. To specify no parameters, or to keep all
291
+ # the default parameter values, pass an empty Hash as a request object (see above).
292
+ #
293
+ # @param name [::String]
294
+ # Required. The name of the promotion to retrieve.
295
+ # Format: `accounts/{account}/promotions/{promotions}`
296
+ # @yield [result, operation] Access the result along with the TransportOperation object
297
+ # @yieldparam result [::Google::Shopping::Merchant::Promotions::V1::Promotion]
298
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
299
+ #
300
+ # @return [::Google::Shopping::Merchant::Promotions::V1::Promotion]
301
+ #
302
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
303
+ #
304
+ # @example Basic example
305
+ # require "google/shopping/merchant/promotions/v1"
306
+ #
307
+ # # Create a client object. The client can be reused for multiple calls.
308
+ # client = Google::Shopping::Merchant::Promotions::V1::PromotionsService::Rest::Client.new
309
+ #
310
+ # # Create a request. To set request fields, pass in keyword arguments.
311
+ # request = Google::Shopping::Merchant::Promotions::V1::GetPromotionRequest.new
312
+ #
313
+ # # Call the get_promotion method.
314
+ # result = client.get_promotion request
315
+ #
316
+ # # The returned object is of type Google::Shopping::Merchant::Promotions::V1::Promotion.
317
+ # p result
318
+ #
319
+ def get_promotion request, options = nil
320
+ raise ::ArgumentError, "request must be provided" if request.nil?
321
+
322
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Promotions::V1::GetPromotionRequest
323
+
324
+ # Converts hash and nil to an options object
325
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
326
+
327
+ # Customize the options with defaults
328
+ call_metadata = @config.rpcs.get_promotion.metadata.to_h
329
+
330
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
331
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
332
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
333
+ gapic_version: ::Google::Shopping::Merchant::Promotions::V1::VERSION,
334
+ transports_version_send: [:rest]
335
+
336
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
337
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
338
+
339
+ options.apply_defaults timeout: @config.rpcs.get_promotion.timeout,
340
+ metadata: call_metadata,
341
+ retry_policy: @config.rpcs.get_promotion.retry_policy
342
+
343
+ options.apply_defaults timeout: @config.timeout,
344
+ metadata: @config.metadata,
345
+ retry_policy: @config.retry_policy
346
+
347
+ @promotions_service_stub.get_promotion request, options do |result, operation|
348
+ yield result, operation if block_given?
349
+ end
350
+ rescue ::Gapic::Rest::Error => e
351
+ raise ::Google::Cloud::Error.from_error(e)
352
+ end
353
+
354
+ ##
355
+ # Lists the promotions in your Merchant Center account. The
356
+ # response might contain fewer items than specified by `pageSize`. Rely on
357
+ # `pageToken` to determine if there are more items to be requested.
358
+ #
359
+ # After inserting or updating a promotion, it may take several minutes before
360
+ # the updated processed promotion can be retrieved.
361
+ #
362
+ # @overload list_promotions(request, options = nil)
363
+ # Pass arguments to `list_promotions` via a request object, either of type
364
+ # {::Google::Shopping::Merchant::Promotions::V1::ListPromotionsRequest} or an equivalent Hash.
365
+ #
366
+ # @param request [::Google::Shopping::Merchant::Promotions::V1::ListPromotionsRequest, ::Hash]
367
+ # A request object representing the call parameters. Required. To specify no
368
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
369
+ # @param options [::Gapic::CallOptions, ::Hash]
370
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
371
+ #
372
+ # @overload list_promotions(parent: nil, page_size: nil, page_token: nil)
373
+ # Pass arguments to `list_promotions` via keyword arguments. Note that at
374
+ # least one keyword argument is required. To specify no parameters, or to keep all
375
+ # the default parameter values, pass an empty Hash as a request object (see above).
376
+ #
377
+ # @param parent [::String]
378
+ # Required. The account to list processed promotions for.
379
+ # Format: `accounts/{account}`
380
+ # @param page_size [::Integer]
381
+ # Optional. The maximum number of promotions to return. The service may
382
+ # return fewer than this value. The maximum value is 250; values above 250
383
+ # will be coerced to 250. If unspecified, the maximum number of promotions
384
+ # will be returned.
385
+ # @param page_token [::String]
386
+ # Optional. A page token, received from a previous `ListPromotions` call.
387
+ # Provide this to retrieve the subsequent page.
388
+ #
389
+ # When paginating, all other parameters provided to `ListPromotions` must
390
+ # match the call that provided the page token.
391
+ # @yield [result, operation] Access the result along with the TransportOperation object
392
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Promotions::V1::Promotion>]
393
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
394
+ #
395
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Promotions::V1::Promotion>]
396
+ #
397
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
398
+ #
399
+ # @example Basic example
400
+ # require "google/shopping/merchant/promotions/v1"
401
+ #
402
+ # # Create a client object. The client can be reused for multiple calls.
403
+ # client = Google::Shopping::Merchant::Promotions::V1::PromotionsService::Rest::Client.new
404
+ #
405
+ # # Create a request. To set request fields, pass in keyword arguments.
406
+ # request = Google::Shopping::Merchant::Promotions::V1::ListPromotionsRequest.new
407
+ #
408
+ # # Call the list_promotions method.
409
+ # result = client.list_promotions request
410
+ #
411
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
412
+ # # over elements, and API calls will be issued to fetch pages as needed.
413
+ # result.each do |item|
414
+ # # Each element is of type ::Google::Shopping::Merchant::Promotions::V1::Promotion.
415
+ # p item
416
+ # end
417
+ #
418
+ def list_promotions request, options = nil
419
+ raise ::ArgumentError, "request must be provided" if request.nil?
420
+
421
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Promotions::V1::ListPromotionsRequest
422
+
423
+ # Converts hash and nil to an options object
424
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
425
+
426
+ # Customize the options with defaults
427
+ call_metadata = @config.rpcs.list_promotions.metadata.to_h
428
+
429
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
430
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
431
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
432
+ gapic_version: ::Google::Shopping::Merchant::Promotions::V1::VERSION,
433
+ transports_version_send: [:rest]
434
+
435
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
436
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
437
+
438
+ options.apply_defaults timeout: @config.rpcs.list_promotions.timeout,
439
+ metadata: call_metadata,
440
+ retry_policy: @config.rpcs.list_promotions.retry_policy
441
+
442
+ options.apply_defaults timeout: @config.timeout,
443
+ metadata: @config.metadata,
444
+ retry_policy: @config.retry_policy
445
+
446
+ @promotions_service_stub.list_promotions request, options do |result, operation|
447
+ result = ::Gapic::Rest::PagedEnumerable.new @promotions_service_stub, :list_promotions, "promotions", request, result, options
448
+ yield result, operation if block_given?
449
+ throw :response, result
450
+ end
451
+ rescue ::Gapic::Rest::Error => e
452
+ raise ::Google::Cloud::Error.from_error(e)
453
+ end
454
+
455
+ ##
456
+ # Configuration class for the PromotionsService REST API.
457
+ #
458
+ # This class represents the configuration for PromotionsService REST,
459
+ # providing control over timeouts, retry behavior, logging, transport
460
+ # parameters, and other low-level controls. Certain parameters can also be
461
+ # applied individually to specific RPCs. See
462
+ # {::Google::Shopping::Merchant::Promotions::V1::PromotionsService::Rest::Client::Configuration::Rpcs}
463
+ # for a list of RPCs that can be configured independently.
464
+ #
465
+ # Configuration can be applied globally to all clients, or to a single client
466
+ # on construction.
467
+ #
468
+ # @example
469
+ #
470
+ # # Modify the global config, setting the timeout for
471
+ # # insert_promotion to 20 seconds,
472
+ # # and all remaining timeouts to 10 seconds.
473
+ # ::Google::Shopping::Merchant::Promotions::V1::PromotionsService::Rest::Client.configure do |config|
474
+ # config.timeout = 10.0
475
+ # config.rpcs.insert_promotion.timeout = 20.0
476
+ # end
477
+ #
478
+ # # Apply the above configuration only to a new client.
479
+ # client = ::Google::Shopping::Merchant::Promotions::V1::PromotionsService::Rest::Client.new do |config|
480
+ # config.timeout = 10.0
481
+ # config.rpcs.insert_promotion.timeout = 20.0
482
+ # end
483
+ #
484
+ # @!attribute [rw] endpoint
485
+ # A custom service endpoint, as a hostname or hostname:port. The default is
486
+ # nil, indicating to use the default endpoint in the current universe domain.
487
+ # @return [::String,nil]
488
+ # @!attribute [rw] credentials
489
+ # Credentials to send with calls. You may provide any of the following types:
490
+ # * (`String`) The path to a service account key file in JSON format
491
+ # * (`Hash`) A service account key as a Hash
492
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
493
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
494
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
495
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
496
+ # * (`nil`) indicating no credentials
497
+ #
498
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
499
+ # external source for authentication to Google Cloud, you must validate it before
500
+ # providing it to a Google API client library. Providing an unvalidated credential
501
+ # configuration to Google APIs can compromise the security of your systems and data.
502
+ # For more information, refer to [Validate credential configurations from external
503
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
504
+ # @return [::Object]
505
+ # @!attribute [rw] scope
506
+ # The OAuth scopes
507
+ # @return [::Array<::String>]
508
+ # @!attribute [rw] lib_name
509
+ # The library name as recorded in instrumentation and logging
510
+ # @return [::String]
511
+ # @!attribute [rw] lib_version
512
+ # The library version as recorded in instrumentation and logging
513
+ # @return [::String]
514
+ # @!attribute [rw] timeout
515
+ # The call timeout in seconds.
516
+ # @return [::Numeric]
517
+ # @!attribute [rw] metadata
518
+ # Additional headers to be sent with the call.
519
+ # @return [::Hash{::Symbol=>::String}]
520
+ # @!attribute [rw] retry_policy
521
+ # The retry policy. The value is a hash with the following keys:
522
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
523
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
524
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
525
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
526
+ # trigger a retry.
527
+ # @return [::Hash]
528
+ # @!attribute [rw] quota_project
529
+ # A separate project against which to charge quota.
530
+ # @return [::String]
531
+ # @!attribute [rw] universe_domain
532
+ # The universe domain within which to make requests. This determines the
533
+ # default endpoint URL. The default value of nil uses the environment
534
+ # universe (usually the default "googleapis.com" universe).
535
+ # @return [::String,nil]
536
+ # @!attribute [rw] logger
537
+ # A custom logger to use for request/response debug logging, or the value
538
+ # `:default` (the default) to construct a default logger, or `nil` to
539
+ # explicitly disable logging.
540
+ # @return [::Logger,:default,nil]
541
+ #
542
+ class Configuration
543
+ extend ::Gapic::Config
544
+
545
+ # @private
546
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
547
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
548
+
549
+ config_attr :endpoint, nil, ::String, nil
550
+ config_attr :credentials, nil do |value|
551
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Google::Auth::BaseClient, ::Signet::OAuth2::Client, nil]
552
+ allowed.any? { |klass| klass === value }
553
+ end
554
+ config_attr :scope, nil, ::String, ::Array, nil
555
+ config_attr :lib_name, nil, ::String, nil
556
+ config_attr :lib_version, nil, ::String, nil
557
+ config_attr :timeout, nil, ::Numeric, nil
558
+ config_attr :metadata, nil, ::Hash, nil
559
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
560
+ config_attr :quota_project, nil, ::String, nil
561
+ config_attr :universe_domain, nil, ::String, nil
562
+ config_attr :logger, :default, ::Logger, nil, :default
563
+
564
+ # @private
565
+ def initialize parent_config = nil
566
+ @parent_config = parent_config unless parent_config.nil?
567
+
568
+ yield self if block_given?
569
+ end
570
+
571
+ ##
572
+ # Configurations for individual RPCs
573
+ # @return [Rpcs]
574
+ #
575
+ def rpcs
576
+ @rpcs ||= begin
577
+ parent_rpcs = nil
578
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
579
+ Rpcs.new parent_rpcs
580
+ end
581
+ end
582
+
583
+ ##
584
+ # Configuration RPC class for the PromotionsService API.
585
+ #
586
+ # Includes fields providing the configuration for each RPC in this service.
587
+ # Each configuration object is of type `Gapic::Config::Method` and includes
588
+ # the following configuration fields:
589
+ #
590
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
591
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
592
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
593
+ # include the following keys:
594
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
595
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
596
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
597
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
598
+ # trigger a retry.
599
+ #
600
+ class Rpcs
601
+ ##
602
+ # RPC-specific configuration for `insert_promotion`
603
+ # @return [::Gapic::Config::Method]
604
+ #
605
+ attr_reader :insert_promotion
606
+ ##
607
+ # RPC-specific configuration for `get_promotion`
608
+ # @return [::Gapic::Config::Method]
609
+ #
610
+ attr_reader :get_promotion
611
+ ##
612
+ # RPC-specific configuration for `list_promotions`
613
+ # @return [::Gapic::Config::Method]
614
+ #
615
+ attr_reader :list_promotions
616
+
617
+ # @private
618
+ def initialize parent_rpcs = nil
619
+ insert_promotion_config = parent_rpcs.insert_promotion if parent_rpcs.respond_to? :insert_promotion
620
+ @insert_promotion = ::Gapic::Config::Method.new insert_promotion_config
621
+ get_promotion_config = parent_rpcs.get_promotion if parent_rpcs.respond_to? :get_promotion
622
+ @get_promotion = ::Gapic::Config::Method.new get_promotion_config
623
+ list_promotions_config = parent_rpcs.list_promotions if parent_rpcs.respond_to? :list_promotions
624
+ @list_promotions = ::Gapic::Config::Method.new list_promotions_config
625
+
626
+ yield self if block_given?
627
+ end
628
+ end
629
+ end
630
+ end
631
+ end
632
+ end
633
+ end
634
+ end
635
+ end
636
+ end
637
+ end