google-shopping-merchant-conversions-v1beta 0.a → 0.1.2

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