google-shopping-merchant-conversions-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 (28) 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/conversions/v1beta/conversion_sources_service/client.rb +919 -0
  6. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service/credentials.rb +49 -0
  7. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service/paths.rb +66 -0
  8. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service/rest/client.rb +851 -0
  9. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service/rest/service_stub.rb +428 -0
  10. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service/rest.rb +54 -0
  11. data/lib/google/shopping/merchant/conversions/v1beta/conversion_sources_service.rb +57 -0
  12. data/lib/google/shopping/merchant/conversions/v1beta/conversionsources_pb.rb +68 -0
  13. data/lib/google/shopping/merchant/conversions/v1beta/conversionsources_services_pb.rb +62 -0
  14. data/lib/google/shopping/merchant/conversions/v1beta/rest.rb +39 -0
  15. data/lib/google/shopping/merchant/conversions/v1beta/version.rb +7 -2
  16. data/lib/google/shopping/merchant/conversions/v1beta.rb +47 -0
  17. data/lib/google-shopping-merchant-conversions-v1beta.rb +21 -0
  18. data/proto_docs/README.md +4 -0
  19. data/proto_docs/google/api/client.rb +399 -0
  20. data/proto_docs/google/api/field_behavior.rb +85 -0
  21. data/proto_docs/google/api/launch_stage.rb +71 -0
  22. data/proto_docs/google/api/resource.rb +222 -0
  23. data/proto_docs/google/protobuf/duration.rb +98 -0
  24. data/proto_docs/google/protobuf/empty.rb +34 -0
  25. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  26. data/proto_docs/google/protobuf/timestamp.rb +127 -0
  27. data/proto_docs/google/shopping/merchant/conversions/v1beta/conversionsources.rb +286 -0
  28. metadata +67 -10
@@ -0,0 +1,851 @@
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/conversions/v1beta/conversionsources_pb"
21
+ require "google/shopping/merchant/conversions/v1beta/conversion_sources_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Conversions
27
+ module V1beta
28
+ module ConversionSourcesService
29
+ module Rest
30
+ ##
31
+ # REST client for the ConversionSourcesService service.
32
+ #
33
+ # Service for managing conversion sources for a merchant account.
34
+ #
35
+ class Client
36
+ # @private
37
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
38
+
39
+ include Paths
40
+
41
+ # @private
42
+ attr_reader :conversion_sources_service_stub
43
+
44
+ ##
45
+ # Configure the ConversionSourcesService Client class.
46
+ #
47
+ # See {::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client::Configuration}
48
+ # for a description of the configuration fields.
49
+ #
50
+ # @example
51
+ #
52
+ # # Modify the configuration for all ConversionSourcesService clients
53
+ # ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.configure do |config|
54
+ # config.timeout = 10.0
55
+ # end
56
+ #
57
+ # @yield [config] Configure the Client client.
58
+ # @yieldparam config [Client::Configuration]
59
+ #
60
+ # @return [Client::Configuration]
61
+ #
62
+ def self.configure
63
+ @configure ||= begin
64
+ namespace = ["Google", "Shopping", "Merchant", "Conversions", "V1beta"]
65
+ parent_config = while namespace.any?
66
+ parent_name = namespace.join "::"
67
+ parent_const = const_get parent_name
68
+ break parent_const.configure if parent_const.respond_to? :configure
69
+ namespace.pop
70
+ end
71
+ default_config = Client::Configuration.new parent_config
72
+
73
+ default_config.timeout = 60.0
74
+ default_config.retry_policy = {
75
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
76
+ }
77
+
78
+ default_config
79
+ end
80
+ yield @configure if block_given?
81
+ @configure
82
+ end
83
+
84
+ ##
85
+ # Configure the ConversionSourcesService Client instance.
86
+ #
87
+ # The configuration is set to the derived mode, meaning that values can be changed,
88
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
89
+ # should be made on {Client.configure}.
90
+ #
91
+ # See {::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client::Configuration}
92
+ # for a description of the configuration fields.
93
+ #
94
+ # @yield [config] Configure the Client client.
95
+ # @yieldparam config [Client::Configuration]
96
+ #
97
+ # @return [Client::Configuration]
98
+ #
99
+ def configure
100
+ yield @config if block_given?
101
+ @config
102
+ end
103
+
104
+ ##
105
+ # The effective universe domain
106
+ #
107
+ # @return [String]
108
+ #
109
+ def universe_domain
110
+ @conversion_sources_service_stub.universe_domain
111
+ end
112
+
113
+ ##
114
+ # Create a new ConversionSourcesService REST client object.
115
+ #
116
+ # @example
117
+ #
118
+ # # Create a client using the default configuration
119
+ # client = ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.new
120
+ #
121
+ # # Create a client using a custom configuration
122
+ # client = ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.new do |config|
123
+ # config.timeout = 10.0
124
+ # end
125
+ #
126
+ # @yield [config] Configure the ConversionSourcesService client.
127
+ # @yieldparam config [Client::Configuration]
128
+ #
129
+ def initialize
130
+ # Create the configuration object
131
+ @config = Configuration.new Client.configure
132
+
133
+ # Yield the configuration if needed
134
+ yield @config if block_given?
135
+
136
+ # Create credentials
137
+ credentials = @config.credentials
138
+ # Use self-signed JWT if the endpoint is unchanged from default,
139
+ # but only if the default endpoint does not have a region prefix.
140
+ enable_self_signed_jwt = @config.endpoint.nil? ||
141
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
142
+ !@config.endpoint.split(".").first.include?("-"))
143
+ credentials ||= Credentials.default scope: @config.scope,
144
+ enable_self_signed_jwt: enable_self_signed_jwt
145
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
146
+ credentials = Credentials.new credentials, scope: @config.scope
147
+ end
148
+
149
+ @quota_project_id = @config.quota_project
150
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
151
+
152
+ @conversion_sources_service_stub = ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::ServiceStub.new(
153
+ endpoint: @config.endpoint,
154
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
155
+ universe_domain: @config.universe_domain,
156
+ credentials: credentials
157
+ )
158
+ end
159
+
160
+ # Service calls
161
+
162
+ ##
163
+ # Creates a new conversion source.
164
+ #
165
+ # @overload create_conversion_source(request, options = nil)
166
+ # Pass arguments to `create_conversion_source` via a request object, either of type
167
+ # {::Google::Shopping::Merchant::Conversions::V1beta::CreateConversionSourceRequest} or an equivalent Hash.
168
+ #
169
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::CreateConversionSourceRequest, ::Hash]
170
+ # A request object representing the call parameters. Required. To specify no
171
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
172
+ # @param options [::Gapic::CallOptions, ::Hash]
173
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
174
+ #
175
+ # @overload create_conversion_source(parent: nil, conversion_source: nil)
176
+ # Pass arguments to `create_conversion_source` via keyword arguments. Note that at
177
+ # least one keyword argument is required. To specify no parameters, or to keep all
178
+ # the default parameter values, pass an empty Hash as a request object (see above).
179
+ #
180
+ # @param parent [::String]
181
+ # Required. The merchant account that will own the new conversion source.
182
+ # Format: accounts/\\{account}
183
+ # @param conversion_source [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource, ::Hash]
184
+ # Required. The conversion source description. A new ID will be automatically
185
+ # assigned to it upon creation.
186
+ # @yield [result, operation] Access the result along with the TransportOperation object
187
+ # @yieldparam result [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
188
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
189
+ #
190
+ # @return [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
191
+ #
192
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
193
+ #
194
+ # @example Basic example
195
+ # require "google/shopping/merchant/conversions/v1beta"
196
+ #
197
+ # # Create a client object. The client can be reused for multiple calls.
198
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.new
199
+ #
200
+ # # Create a request. To set request fields, pass in keyword arguments.
201
+ # request = Google::Shopping::Merchant::Conversions::V1beta::CreateConversionSourceRequest.new
202
+ #
203
+ # # Call the create_conversion_source method.
204
+ # result = client.create_conversion_source request
205
+ #
206
+ # # The returned object is of type Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
207
+ # p result
208
+ #
209
+ def create_conversion_source request, options = nil
210
+ raise ::ArgumentError, "request must be provided" if request.nil?
211
+
212
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::CreateConversionSourceRequest
213
+
214
+ # Converts hash and nil to an options object
215
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
216
+
217
+ # Customize the options with defaults
218
+ call_metadata = @config.rpcs.create_conversion_source.metadata.to_h
219
+
220
+ # Set x-goog-api-client and x-goog-user-project headers
221
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
222
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
223
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION,
224
+ transports_version_send: [:rest]
225
+
226
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
227
+
228
+ options.apply_defaults timeout: @config.rpcs.create_conversion_source.timeout,
229
+ metadata: call_metadata,
230
+ retry_policy: @config.rpcs.create_conversion_source.retry_policy
231
+
232
+ options.apply_defaults timeout: @config.timeout,
233
+ metadata: @config.metadata,
234
+ retry_policy: @config.retry_policy
235
+
236
+ @conversion_sources_service_stub.create_conversion_source request, options do |result, operation|
237
+ yield result, operation if block_given?
238
+ return result
239
+ end
240
+ rescue ::Gapic::Rest::Error => e
241
+ raise ::Google::Cloud::Error.from_error(e)
242
+ end
243
+
244
+ ##
245
+ # Updates information of an existing conversion source. Available only for
246
+ # Merchant Center Destination conversion sources.
247
+ #
248
+ # @overload update_conversion_source(request, options = nil)
249
+ # Pass arguments to `update_conversion_source` via a request object, either of type
250
+ # {::Google::Shopping::Merchant::Conversions::V1beta::UpdateConversionSourceRequest} or an equivalent Hash.
251
+ #
252
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::UpdateConversionSourceRequest, ::Hash]
253
+ # A request object representing the call parameters. Required. To specify no
254
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
255
+ # @param options [::Gapic::CallOptions, ::Hash]
256
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
257
+ #
258
+ # @overload update_conversion_source(conversion_source: nil, update_mask: nil)
259
+ # Pass arguments to `update_conversion_source` via keyword arguments. Note that at
260
+ # least one keyword argument is required. To specify no parameters, or to keep all
261
+ # the default parameter values, pass an empty Hash as a request object (see above).
262
+ #
263
+ # @param conversion_source [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource, ::Hash]
264
+ # Required. The new version of the conversion source data.
265
+ # Format: accounts/\\{account}/conversionSources/\\{conversion_source}
266
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
267
+ # Required. List of fields being updated.
268
+ # @yield [result, operation] Access the result along with the TransportOperation object
269
+ # @yieldparam result [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
270
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
271
+ #
272
+ # @return [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
273
+ #
274
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
275
+ #
276
+ # @example Basic example
277
+ # require "google/shopping/merchant/conversions/v1beta"
278
+ #
279
+ # # Create a client object. The client can be reused for multiple calls.
280
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.new
281
+ #
282
+ # # Create a request. To set request fields, pass in keyword arguments.
283
+ # request = Google::Shopping::Merchant::Conversions::V1beta::UpdateConversionSourceRequest.new
284
+ #
285
+ # # Call the update_conversion_source method.
286
+ # result = client.update_conversion_source request
287
+ #
288
+ # # The returned object is of type Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
289
+ # p result
290
+ #
291
+ def update_conversion_source request, options = nil
292
+ raise ::ArgumentError, "request must be provided" if request.nil?
293
+
294
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::UpdateConversionSourceRequest
295
+
296
+ # Converts hash and nil to an options object
297
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
298
+
299
+ # Customize the options with defaults
300
+ call_metadata = @config.rpcs.update_conversion_source.metadata.to_h
301
+
302
+ # Set x-goog-api-client and x-goog-user-project headers
303
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
304
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
305
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION,
306
+ transports_version_send: [:rest]
307
+
308
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
309
+
310
+ options.apply_defaults timeout: @config.rpcs.update_conversion_source.timeout,
311
+ metadata: call_metadata,
312
+ retry_policy: @config.rpcs.update_conversion_source.retry_policy
313
+
314
+ options.apply_defaults timeout: @config.timeout,
315
+ metadata: @config.metadata,
316
+ retry_policy: @config.retry_policy
317
+
318
+ @conversion_sources_service_stub.update_conversion_source request, options do |result, operation|
319
+ yield result, operation if block_given?
320
+ return result
321
+ end
322
+ rescue ::Gapic::Rest::Error => e
323
+ raise ::Google::Cloud::Error.from_error(e)
324
+ end
325
+
326
+ ##
327
+ # Archives an existing conversion source. If the conversion source is a
328
+ # Merchant Center Destination, it will be recoverable for 30 days. If the
329
+ # conversion source is a Google Analytics Link, it will be deleted
330
+ # immediately and can be restored by creating a new one.
331
+ #
332
+ # @overload delete_conversion_source(request, options = nil)
333
+ # Pass arguments to `delete_conversion_source` via a request object, either of type
334
+ # {::Google::Shopping::Merchant::Conversions::V1beta::DeleteConversionSourceRequest} or an equivalent Hash.
335
+ #
336
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::DeleteConversionSourceRequest, ::Hash]
337
+ # A request object representing the call parameters. Required. To specify no
338
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
339
+ # @param options [::Gapic::CallOptions, ::Hash]
340
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
341
+ #
342
+ # @overload delete_conversion_source(name: nil)
343
+ # Pass arguments to `delete_conversion_source` via keyword arguments. Note that at
344
+ # least one keyword argument is required. To specify no parameters, or to keep all
345
+ # the default parameter values, pass an empty Hash as a request object (see above).
346
+ #
347
+ # @param name [::String]
348
+ # Required. The name of the conversion source to be deleted.
349
+ # Format: accounts/\\{account}/conversionSources/\\{conversion_source}
350
+ # @yield [result, operation] Access the result along with the TransportOperation object
351
+ # @yieldparam result [::Google::Protobuf::Empty]
352
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
353
+ #
354
+ # @return [::Google::Protobuf::Empty]
355
+ #
356
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
357
+ #
358
+ # @example Basic example
359
+ # require "google/shopping/merchant/conversions/v1beta"
360
+ #
361
+ # # Create a client object. The client can be reused for multiple calls.
362
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.new
363
+ #
364
+ # # Create a request. To set request fields, pass in keyword arguments.
365
+ # request = Google::Shopping::Merchant::Conversions::V1beta::DeleteConversionSourceRequest.new
366
+ #
367
+ # # Call the delete_conversion_source method.
368
+ # result = client.delete_conversion_source request
369
+ #
370
+ # # The returned object is of type Google::Protobuf::Empty.
371
+ # p result
372
+ #
373
+ def delete_conversion_source request, options = nil
374
+ raise ::ArgumentError, "request must be provided" if request.nil?
375
+
376
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::DeleteConversionSourceRequest
377
+
378
+ # Converts hash and nil to an options object
379
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
380
+
381
+ # Customize the options with defaults
382
+ call_metadata = @config.rpcs.delete_conversion_source.metadata.to_h
383
+
384
+ # Set x-goog-api-client and x-goog-user-project headers
385
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
386
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
387
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION,
388
+ transports_version_send: [:rest]
389
+
390
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
391
+
392
+ options.apply_defaults timeout: @config.rpcs.delete_conversion_source.timeout,
393
+ metadata: call_metadata,
394
+ retry_policy: @config.rpcs.delete_conversion_source.retry_policy
395
+
396
+ options.apply_defaults timeout: @config.timeout,
397
+ metadata: @config.metadata,
398
+ retry_policy: @config.retry_policy
399
+
400
+ @conversion_sources_service_stub.delete_conversion_source request, options do |result, operation|
401
+ yield result, operation if block_given?
402
+ return result
403
+ end
404
+ rescue ::Gapic::Rest::Error => e
405
+ raise ::Google::Cloud::Error.from_error(e)
406
+ end
407
+
408
+ ##
409
+ # Re-enables an archived conversion source. Only Available for Merchant
410
+ # Center Destination conversion sources.
411
+ #
412
+ # @overload undelete_conversion_source(request, options = nil)
413
+ # Pass arguments to `undelete_conversion_source` via a request object, either of type
414
+ # {::Google::Shopping::Merchant::Conversions::V1beta::UndeleteConversionSourceRequest} or an equivalent Hash.
415
+ #
416
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::UndeleteConversionSourceRequest, ::Hash]
417
+ # A request object representing the call parameters. Required. To specify no
418
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
419
+ # @param options [::Gapic::CallOptions, ::Hash]
420
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
421
+ #
422
+ # @overload undelete_conversion_source(name: nil)
423
+ # Pass arguments to `undelete_conversion_source` via keyword arguments. Note that at
424
+ # least one keyword argument is required. To specify no parameters, or to keep all
425
+ # the default parameter values, pass an empty Hash as a request object (see above).
426
+ #
427
+ # @param name [::String]
428
+ # Required. The name of the conversion source to be undeleted.
429
+ # Format: accounts/\\{account}/conversionSources/\\{conversion_source}
430
+ # @yield [result, operation] Access the result along with the TransportOperation object
431
+ # @yieldparam result [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
432
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
433
+ #
434
+ # @return [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
435
+ #
436
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
437
+ #
438
+ # @example Basic example
439
+ # require "google/shopping/merchant/conversions/v1beta"
440
+ #
441
+ # # Create a client object. The client can be reused for multiple calls.
442
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.new
443
+ #
444
+ # # Create a request. To set request fields, pass in keyword arguments.
445
+ # request = Google::Shopping::Merchant::Conversions::V1beta::UndeleteConversionSourceRequest.new
446
+ #
447
+ # # Call the undelete_conversion_source method.
448
+ # result = client.undelete_conversion_source request
449
+ #
450
+ # # The returned object is of type Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
451
+ # p result
452
+ #
453
+ def undelete_conversion_source request, options = nil
454
+ raise ::ArgumentError, "request must be provided" if request.nil?
455
+
456
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::UndeleteConversionSourceRequest
457
+
458
+ # Converts hash and nil to an options object
459
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
460
+
461
+ # Customize the options with defaults
462
+ call_metadata = @config.rpcs.undelete_conversion_source.metadata.to_h
463
+
464
+ # Set x-goog-api-client and x-goog-user-project headers
465
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
466
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
467
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION,
468
+ transports_version_send: [:rest]
469
+
470
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
471
+
472
+ options.apply_defaults timeout: @config.rpcs.undelete_conversion_source.timeout,
473
+ metadata: call_metadata,
474
+ retry_policy: @config.rpcs.undelete_conversion_source.retry_policy
475
+
476
+ options.apply_defaults timeout: @config.timeout,
477
+ metadata: @config.metadata,
478
+ retry_policy: @config.retry_policy
479
+
480
+ @conversion_sources_service_stub.undelete_conversion_source request, options do |result, operation|
481
+ yield result, operation if block_given?
482
+ return result
483
+ end
484
+ rescue ::Gapic::Rest::Error => e
485
+ raise ::Google::Cloud::Error.from_error(e)
486
+ end
487
+
488
+ ##
489
+ # Fetches a conversion source.
490
+ #
491
+ # @overload get_conversion_source(request, options = nil)
492
+ # Pass arguments to `get_conversion_source` via a request object, either of type
493
+ # {::Google::Shopping::Merchant::Conversions::V1beta::GetConversionSourceRequest} or an equivalent Hash.
494
+ #
495
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::GetConversionSourceRequest, ::Hash]
496
+ # A request object representing the call parameters. Required. To specify no
497
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
498
+ # @param options [::Gapic::CallOptions, ::Hash]
499
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
500
+ #
501
+ # @overload get_conversion_source(name: nil)
502
+ # Pass arguments to `get_conversion_source` via keyword arguments. Note that at
503
+ # least one keyword argument is required. To specify no parameters, or to keep all
504
+ # the default parameter values, pass an empty Hash as a request object (see above).
505
+ #
506
+ # @param name [::String]
507
+ # Required. The name of the conversion source to be fetched.
508
+ # Format: accounts/\\{account}/conversionsources/\\{conversion_source}
509
+ # @yield [result, operation] Access the result along with the TransportOperation object
510
+ # @yieldparam result [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
511
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
512
+ #
513
+ # @return [::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource]
514
+ #
515
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
516
+ #
517
+ # @example Basic example
518
+ # require "google/shopping/merchant/conversions/v1beta"
519
+ #
520
+ # # Create a client object. The client can be reused for multiple calls.
521
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.new
522
+ #
523
+ # # Create a request. To set request fields, pass in keyword arguments.
524
+ # request = Google::Shopping::Merchant::Conversions::V1beta::GetConversionSourceRequest.new
525
+ #
526
+ # # Call the get_conversion_source method.
527
+ # result = client.get_conversion_source request
528
+ #
529
+ # # The returned object is of type Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
530
+ # p result
531
+ #
532
+ def get_conversion_source request, options = nil
533
+ raise ::ArgumentError, "request must be provided" if request.nil?
534
+
535
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::GetConversionSourceRequest
536
+
537
+ # Converts hash and nil to an options object
538
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
539
+
540
+ # Customize the options with defaults
541
+ call_metadata = @config.rpcs.get_conversion_source.metadata.to_h
542
+
543
+ # Set x-goog-api-client and x-goog-user-project headers
544
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
545
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
546
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION,
547
+ transports_version_send: [:rest]
548
+
549
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
550
+
551
+ options.apply_defaults timeout: @config.rpcs.get_conversion_source.timeout,
552
+ metadata: call_metadata,
553
+ retry_policy: @config.rpcs.get_conversion_source.retry_policy
554
+
555
+ options.apply_defaults timeout: @config.timeout,
556
+ metadata: @config.metadata,
557
+ retry_policy: @config.retry_policy
558
+
559
+ @conversion_sources_service_stub.get_conversion_source request, options do |result, operation|
560
+ yield result, operation if block_given?
561
+ return result
562
+ end
563
+ rescue ::Gapic::Rest::Error => e
564
+ raise ::Google::Cloud::Error.from_error(e)
565
+ end
566
+
567
+ ##
568
+ # Retrieves the list of conversion sources the caller has access to.
569
+ #
570
+ # @overload list_conversion_sources(request, options = nil)
571
+ # Pass arguments to `list_conversion_sources` via a request object, either of type
572
+ # {::Google::Shopping::Merchant::Conversions::V1beta::ListConversionSourcesRequest} or an equivalent Hash.
573
+ #
574
+ # @param request [::Google::Shopping::Merchant::Conversions::V1beta::ListConversionSourcesRequest, ::Hash]
575
+ # A request object representing the call parameters. Required. To specify no
576
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
577
+ # @param options [::Gapic::CallOptions, ::Hash]
578
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
579
+ #
580
+ # @overload list_conversion_sources(parent: nil, page_size: nil, page_token: nil, show_deleted: nil)
581
+ # Pass arguments to `list_conversion_sources` via keyword arguments. Note that at
582
+ # least one keyword argument is required. To specify no parameters, or to keep all
583
+ # the default parameter values, pass an empty Hash as a request object (see above).
584
+ #
585
+ # @param parent [::String]
586
+ # Required. The merchant account who owns the collection of conversion
587
+ # sources. Format: accounts/\\{account}
588
+ # @param page_size [::Integer]
589
+ # Optional. The maximum number of conversion sources to return in a page.
590
+ # If no `page_size` is specified, `100` is used as the default value. The
591
+ # maximum value is `200`. Values above `200` will be coerced to `200`.
592
+ # Regardless of pagination, at most `200` conversion sources are returned
593
+ # in total.
594
+ # @param page_token [::String]
595
+ # Optional. Page token.
596
+ # @param show_deleted [::Boolean]
597
+ # Optional. Show deleted (archived) option.
598
+ # @yield [result, operation] Access the result along with the TransportOperation object
599
+ # @yieldparam result [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource>]
600
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
601
+ #
602
+ # @return [::Gapic::Rest::PagedEnumerable<::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource>]
603
+ #
604
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
605
+ #
606
+ # @example Basic example
607
+ # require "google/shopping/merchant/conversions/v1beta"
608
+ #
609
+ # # Create a client object. The client can be reused for multiple calls.
610
+ # client = Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.new
611
+ #
612
+ # # Create a request. To set request fields, pass in keyword arguments.
613
+ # request = Google::Shopping::Merchant::Conversions::V1beta::ListConversionSourcesRequest.new
614
+ #
615
+ # # Call the list_conversion_sources method.
616
+ # result = client.list_conversion_sources request
617
+ #
618
+ # # The returned object is of type Gapic::PagedEnumerable. You can iterate
619
+ # # over elements, and API calls will be issued to fetch pages as needed.
620
+ # result.each do |item|
621
+ # # Each element is of type ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSource.
622
+ # p item
623
+ # end
624
+ #
625
+ def list_conversion_sources request, options = nil
626
+ raise ::ArgumentError, "request must be provided" if request.nil?
627
+
628
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Conversions::V1beta::ListConversionSourcesRequest
629
+
630
+ # Converts hash and nil to an options object
631
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
632
+
633
+ # Customize the options with defaults
634
+ call_metadata = @config.rpcs.list_conversion_sources.metadata.to_h
635
+
636
+ # Set x-goog-api-client and x-goog-user-project headers
637
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
638
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
639
+ gapic_version: ::Google::Shopping::Merchant::Conversions::V1beta::VERSION,
640
+ transports_version_send: [:rest]
641
+
642
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
643
+
644
+ options.apply_defaults timeout: @config.rpcs.list_conversion_sources.timeout,
645
+ metadata: call_metadata,
646
+ retry_policy: @config.rpcs.list_conversion_sources.retry_policy
647
+
648
+ options.apply_defaults timeout: @config.timeout,
649
+ metadata: @config.metadata,
650
+ retry_policy: @config.retry_policy
651
+
652
+ @conversion_sources_service_stub.list_conversion_sources request, options do |result, operation|
653
+ result = ::Gapic::Rest::PagedEnumerable.new @conversion_sources_service_stub, :list_conversion_sources, "conversion_sources", request, result, options
654
+ yield result, operation if block_given?
655
+ return result
656
+ end
657
+ rescue ::Gapic::Rest::Error => e
658
+ raise ::Google::Cloud::Error.from_error(e)
659
+ end
660
+
661
+ ##
662
+ # Configuration class for the ConversionSourcesService REST API.
663
+ #
664
+ # This class represents the configuration for ConversionSourcesService REST,
665
+ # providing control over timeouts, retry behavior, logging, transport
666
+ # parameters, and other low-level controls. Certain parameters can also be
667
+ # applied individually to specific RPCs. See
668
+ # {::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client::Configuration::Rpcs}
669
+ # for a list of RPCs that can be configured independently.
670
+ #
671
+ # Configuration can be applied globally to all clients, or to a single client
672
+ # on construction.
673
+ #
674
+ # @example
675
+ #
676
+ # # Modify the global config, setting the timeout for
677
+ # # create_conversion_source to 20 seconds,
678
+ # # and all remaining timeouts to 10 seconds.
679
+ # ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.configure do |config|
680
+ # config.timeout = 10.0
681
+ # config.rpcs.create_conversion_source.timeout = 20.0
682
+ # end
683
+ #
684
+ # # Apply the above configuration only to a new client.
685
+ # client = ::Google::Shopping::Merchant::Conversions::V1beta::ConversionSourcesService::Rest::Client.new do |config|
686
+ # config.timeout = 10.0
687
+ # config.rpcs.create_conversion_source.timeout = 20.0
688
+ # end
689
+ #
690
+ # @!attribute [rw] endpoint
691
+ # A custom service endpoint, as a hostname or hostname:port. The default is
692
+ # nil, indicating to use the default endpoint in the current universe domain.
693
+ # @return [::String,nil]
694
+ # @!attribute [rw] credentials
695
+ # Credentials to send with calls. You may provide any of the following types:
696
+ # * (`String`) The path to a service account key file in JSON format
697
+ # * (`Hash`) A service account key as a Hash
698
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
699
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
700
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
701
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
702
+ # * (`nil`) indicating no credentials
703
+ # @return [::Object]
704
+ # @!attribute [rw] scope
705
+ # The OAuth scopes
706
+ # @return [::Array<::String>]
707
+ # @!attribute [rw] lib_name
708
+ # The library name as recorded in instrumentation and logging
709
+ # @return [::String]
710
+ # @!attribute [rw] lib_version
711
+ # The library version as recorded in instrumentation and logging
712
+ # @return [::String]
713
+ # @!attribute [rw] timeout
714
+ # The call timeout in seconds.
715
+ # @return [::Numeric]
716
+ # @!attribute [rw] metadata
717
+ # Additional headers to be sent with the call.
718
+ # @return [::Hash{::Symbol=>::String}]
719
+ # @!attribute [rw] retry_policy
720
+ # The retry policy. The value is a hash with the following keys:
721
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
722
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
723
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
724
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
725
+ # trigger a retry.
726
+ # @return [::Hash]
727
+ # @!attribute [rw] quota_project
728
+ # A separate project against which to charge quota.
729
+ # @return [::String]
730
+ # @!attribute [rw] universe_domain
731
+ # The universe domain within which to make requests. This determines the
732
+ # default endpoint URL. The default value of nil uses the environment
733
+ # universe (usually the default "googleapis.com" universe).
734
+ # @return [::String,nil]
735
+ #
736
+ class Configuration
737
+ extend ::Gapic::Config
738
+
739
+ # @private
740
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
741
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
742
+
743
+ config_attr :endpoint, nil, ::String, nil
744
+ config_attr :credentials, nil do |value|
745
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
746
+ allowed.any? { |klass| klass === value }
747
+ end
748
+ config_attr :scope, nil, ::String, ::Array, nil
749
+ config_attr :lib_name, nil, ::String, nil
750
+ config_attr :lib_version, nil, ::String, nil
751
+ config_attr :timeout, nil, ::Numeric, nil
752
+ config_attr :metadata, nil, ::Hash, nil
753
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
754
+ config_attr :quota_project, nil, ::String, nil
755
+ config_attr :universe_domain, nil, ::String, nil
756
+
757
+ # @private
758
+ def initialize parent_config = nil
759
+ @parent_config = parent_config unless parent_config.nil?
760
+
761
+ yield self if block_given?
762
+ end
763
+
764
+ ##
765
+ # Configurations for individual RPCs
766
+ # @return [Rpcs]
767
+ #
768
+ def rpcs
769
+ @rpcs ||= begin
770
+ parent_rpcs = nil
771
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
772
+ Rpcs.new parent_rpcs
773
+ end
774
+ end
775
+
776
+ ##
777
+ # Configuration RPC class for the ConversionSourcesService API.
778
+ #
779
+ # Includes fields providing the configuration for each RPC in this service.
780
+ # Each configuration object is of type `Gapic::Config::Method` and includes
781
+ # the following configuration fields:
782
+ #
783
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
784
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
785
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
786
+ # include the following keys:
787
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
788
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
789
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
790
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
791
+ # trigger a retry.
792
+ #
793
+ class Rpcs
794
+ ##
795
+ # RPC-specific configuration for `create_conversion_source`
796
+ # @return [::Gapic::Config::Method]
797
+ #
798
+ attr_reader :create_conversion_source
799
+ ##
800
+ # RPC-specific configuration for `update_conversion_source`
801
+ # @return [::Gapic::Config::Method]
802
+ #
803
+ attr_reader :update_conversion_source
804
+ ##
805
+ # RPC-specific configuration for `delete_conversion_source`
806
+ # @return [::Gapic::Config::Method]
807
+ #
808
+ attr_reader :delete_conversion_source
809
+ ##
810
+ # RPC-specific configuration for `undelete_conversion_source`
811
+ # @return [::Gapic::Config::Method]
812
+ #
813
+ attr_reader :undelete_conversion_source
814
+ ##
815
+ # RPC-specific configuration for `get_conversion_source`
816
+ # @return [::Gapic::Config::Method]
817
+ #
818
+ attr_reader :get_conversion_source
819
+ ##
820
+ # RPC-specific configuration for `list_conversion_sources`
821
+ # @return [::Gapic::Config::Method]
822
+ #
823
+ attr_reader :list_conversion_sources
824
+
825
+ # @private
826
+ def initialize parent_rpcs = nil
827
+ create_conversion_source_config = parent_rpcs.create_conversion_source if parent_rpcs.respond_to? :create_conversion_source
828
+ @create_conversion_source = ::Gapic::Config::Method.new create_conversion_source_config
829
+ update_conversion_source_config = parent_rpcs.update_conversion_source if parent_rpcs.respond_to? :update_conversion_source
830
+ @update_conversion_source = ::Gapic::Config::Method.new update_conversion_source_config
831
+ delete_conversion_source_config = parent_rpcs.delete_conversion_source if parent_rpcs.respond_to? :delete_conversion_source
832
+ @delete_conversion_source = ::Gapic::Config::Method.new delete_conversion_source_config
833
+ undelete_conversion_source_config = parent_rpcs.undelete_conversion_source if parent_rpcs.respond_to? :undelete_conversion_source
834
+ @undelete_conversion_source = ::Gapic::Config::Method.new undelete_conversion_source_config
835
+ get_conversion_source_config = parent_rpcs.get_conversion_source if parent_rpcs.respond_to? :get_conversion_source
836
+ @get_conversion_source = ::Gapic::Config::Method.new get_conversion_source_config
837
+ list_conversion_sources_config = parent_rpcs.list_conversion_sources if parent_rpcs.respond_to? :list_conversion_sources
838
+ @list_conversion_sources = ::Gapic::Config::Method.new list_conversion_sources_config
839
+
840
+ yield self if block_given?
841
+ end
842
+ end
843
+ end
844
+ end
845
+ end
846
+ end
847
+ end
848
+ end
849
+ end
850
+ end
851
+ end