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