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