google-shopping-merchant-promotions-v1beta 0.a → 0.1.0

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