google-shopping-merchant-accounts-v1beta 0.1.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/lib/google/shopping/merchant/accounts/v1beta/account_issue_service/client.rb +6 -1
  4. data/lib/google/shopping/merchant/accounts/v1beta/account_issue_service/rest/client.rb +6 -1
  5. data/lib/google/shopping/merchant/accounts/v1beta/account_tax_service/client.rb +5 -0
  6. data/lib/google/shopping/merchant/accounts/v1beta/account_tax_service/rest/client.rb +5 -0
  7. data/lib/google/shopping/merchant/accounts/v1beta/accountissue_pb.rb +1 -3
  8. data/lib/google/shopping/merchant/accounts/v1beta/accounts_pb.rb +3 -2
  9. data/lib/google/shopping/merchant/accounts/v1beta/accounts_service/client.rb +15 -5
  10. data/lib/google/shopping/merchant/accounts/v1beta/accounts_service/rest/client.rb +15 -5
  11. data/lib/google/shopping/merchant/accounts/v1beta/accounts_services_pb.rb +5 -1
  12. data/lib/google/shopping/merchant/accounts/v1beta/accountservices_pb.rb +49 -0
  13. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/client.rb +529 -0
  14. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/credentials.rb +49 -0
  15. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/paths.rb +49 -0
  16. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/rest/client.rb +489 -0
  17. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/rest/service_stub.rb +190 -0
  18. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/rest.rb +55 -0
  19. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service.rb +58 -0
  20. data/lib/google/shopping/merchant/accounts/v1beta/autofeedsettings_pb.rb +53 -0
  21. data/lib/google/shopping/merchant/accounts/v1beta/autofeedsettings_services_pb.rb +50 -0
  22. data/lib/google/shopping/merchant/accounts/v1beta/business_identity_service/client.rb +5 -0
  23. data/lib/google/shopping/merchant/accounts/v1beta/business_identity_service/rest/client.rb +5 -0
  24. data/lib/google/shopping/merchant/accounts/v1beta/business_info_service/client.rb +5 -0
  25. data/lib/google/shopping/merchant/accounts/v1beta/business_info_service/rest/client.rb +5 -0
  26. data/lib/google/shopping/merchant/accounts/v1beta/businessinfo_pb.rb +1 -1
  27. data/lib/google/shopping/merchant/accounts/v1beta/email_preferences_service/client.rb +5 -0
  28. data/lib/google/shopping/merchant/accounts/v1beta/email_preferences_service/rest/client.rb +5 -0
  29. data/lib/google/shopping/merchant/accounts/v1beta/homepage_service/client.rb +5 -0
  30. data/lib/google/shopping/merchant/accounts/v1beta/homepage_service/rest/client.rb +5 -0
  31. data/lib/google/shopping/merchant/accounts/v1beta/programs_service/client.rb +5 -0
  32. data/lib/google/shopping/merchant/accounts/v1beta/programs_service/rest/client.rb +5 -0
  33. data/lib/google/shopping/merchant/accounts/v1beta/regions_service/client.rb +5 -0
  34. data/lib/google/shopping/merchant/accounts/v1beta/regions_service/rest/client.rb +5 -0
  35. data/lib/google/shopping/merchant/accounts/v1beta/rest.rb +1 -0
  36. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_agreement_state_service/client.rb +6 -0
  37. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_agreement_state_service/rest/client.rb +6 -0
  38. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_service/client.rb +4 -4
  39. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_service/rest/client.rb +4 -4
  40. data/lib/google/shopping/merchant/accounts/v1beta/termsofservice_pb.rb +1 -1
  41. data/lib/google/shopping/merchant/accounts/v1beta/user_service/client.rb +5 -0
  42. data/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/client.rb +5 -0
  43. data/lib/google/shopping/merchant/accounts/v1beta/version.rb +1 -1
  44. data/lib/google/shopping/merchant/accounts/v1beta.rb +1 -0
  45. data/proto_docs/google/shopping/merchant/accounts/v1beta/accountissue.rb +1 -1
  46. data/proto_docs/google/shopping/merchant/accounts/v1beta/accounts.rb +18 -6
  47. data/proto_docs/google/shopping/merchant/accounts/v1beta/accountservices.rb +34 -0
  48. data/proto_docs/google/shopping/merchant/accounts/v1beta/autofeedsettings.rb +75 -0
  49. data/proto_docs/google/shopping/merchant/accounts/v1beta/businessinfo.rb +5 -0
  50. data/proto_docs/google/shopping/merchant/accounts/v1beta/shippingsettings.rb +5 -1
  51. data/proto_docs/google/shopping/merchant/accounts/v1beta/termsofservice.rb +4 -4
  52. data/proto_docs/google/shopping/merchant/accounts/v1beta/termsofserviceagreementstate.rb +3 -0
  53. metadata +29 -5
@@ -0,0 +1,489 @@
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/accounts/v1beta/autofeedsettings_pb"
21
+ require "google/shopping/merchant/accounts/v1beta/autofeed_settings_service/rest/service_stub"
22
+
23
+ module Google
24
+ module Shopping
25
+ module Merchant
26
+ module Accounts
27
+ module V1beta
28
+ module AutofeedSettingsService
29
+ module Rest
30
+ ##
31
+ # REST client for the AutofeedSettingsService service.
32
+ #
33
+ # Service to support
34
+ # [autofeed](https://support.google.com/merchants/answer/7538732) setting.
35
+ #
36
+ class Client
37
+ # @private
38
+ API_VERSION = ""
39
+
40
+ # @private
41
+ DEFAULT_ENDPOINT_TEMPLATE = "merchantapi.$UNIVERSE_DOMAIN$"
42
+
43
+ include Paths
44
+
45
+ # @private
46
+ attr_reader :autofeed_settings_service_stub
47
+
48
+ ##
49
+ # Configure the AutofeedSettingsService Client class.
50
+ #
51
+ # See {::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client::Configuration}
52
+ # for a description of the configuration fields.
53
+ #
54
+ # @example
55
+ #
56
+ # # Modify the configuration for all AutofeedSettingsService clients
57
+ # ::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client.configure do |config|
58
+ # config.timeout = 10.0
59
+ # end
60
+ #
61
+ # @yield [config] Configure the Client client.
62
+ # @yieldparam config [Client::Configuration]
63
+ #
64
+ # @return [Client::Configuration]
65
+ #
66
+ def self.configure
67
+ @configure ||= begin
68
+ namespace = ["Google", "Shopping", "Merchant", "Accounts", "V1beta"]
69
+ parent_config = while namespace.any?
70
+ parent_name = namespace.join "::"
71
+ parent_const = const_get parent_name
72
+ break parent_const.configure if parent_const.respond_to? :configure
73
+ namespace.pop
74
+ end
75
+ default_config = Client::Configuration.new parent_config
76
+
77
+ default_config.timeout = 60.0
78
+ default_config.retry_policy = {
79
+ initial_delay: 1.0, max_delay: 10.0, multiplier: 1.3, retry_codes: [14]
80
+ }
81
+
82
+ default_config
83
+ end
84
+ yield @configure if block_given?
85
+ @configure
86
+ end
87
+
88
+ ##
89
+ # Configure the AutofeedSettingsService Client instance.
90
+ #
91
+ # The configuration is set to the derived mode, meaning that values can be changed,
92
+ # but structural changes (adding new fields, etc.) are not allowed. Structural changes
93
+ # should be made on {Client.configure}.
94
+ #
95
+ # See {::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client::Configuration}
96
+ # for a description of the configuration fields.
97
+ #
98
+ # @yield [config] Configure the Client client.
99
+ # @yieldparam config [Client::Configuration]
100
+ #
101
+ # @return [Client::Configuration]
102
+ #
103
+ def configure
104
+ yield @config if block_given?
105
+ @config
106
+ end
107
+
108
+ ##
109
+ # The effective universe domain
110
+ #
111
+ # @return [String]
112
+ #
113
+ def universe_domain
114
+ @autofeed_settings_service_stub.universe_domain
115
+ end
116
+
117
+ ##
118
+ # Create a new AutofeedSettingsService REST client object.
119
+ #
120
+ # @example
121
+ #
122
+ # # Create a client using the default configuration
123
+ # client = ::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client.new
124
+ #
125
+ # # Create a client using a custom configuration
126
+ # client = ::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client.new do |config|
127
+ # config.timeout = 10.0
128
+ # end
129
+ #
130
+ # @yield [config] Configure the AutofeedSettingsService client.
131
+ # @yieldparam config [Client::Configuration]
132
+ #
133
+ def initialize
134
+ # Create the configuration object
135
+ @config = Configuration.new Client.configure
136
+
137
+ # Yield the configuration if needed
138
+ yield @config if block_given?
139
+
140
+ # Create credentials
141
+ credentials = @config.credentials
142
+ # Use self-signed JWT if the endpoint is unchanged from default,
143
+ # but only if the default endpoint does not have a region prefix.
144
+ enable_self_signed_jwt = @config.endpoint.nil? ||
145
+ (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
146
+ !@config.endpoint.split(".").first.include?("-"))
147
+ credentials ||= Credentials.default scope: @config.scope,
148
+ enable_self_signed_jwt: enable_self_signed_jwt
149
+ if credentials.is_a?(::String) || credentials.is_a?(::Hash)
150
+ credentials = Credentials.new credentials, scope: @config.scope
151
+ end
152
+
153
+ @quota_project_id = @config.quota_project
154
+ @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
155
+
156
+ @autofeed_settings_service_stub = ::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::ServiceStub.new(
157
+ endpoint: @config.endpoint,
158
+ endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
159
+ universe_domain: @config.universe_domain,
160
+ credentials: credentials
161
+ )
162
+ end
163
+
164
+ # Service calls
165
+
166
+ ##
167
+ # Retrieves the autofeed settings of an account.
168
+ #
169
+ # @overload get_autofeed_settings(request, options = nil)
170
+ # Pass arguments to `get_autofeed_settings` via a request object, either of type
171
+ # {::Google::Shopping::Merchant::Accounts::V1beta::GetAutofeedSettingsRequest} or an equivalent Hash.
172
+ #
173
+ # @param request [::Google::Shopping::Merchant::Accounts::V1beta::GetAutofeedSettingsRequest, ::Hash]
174
+ # A request object representing the call parameters. Required. To specify no
175
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
176
+ # @param options [::Gapic::CallOptions, ::Hash]
177
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
178
+ #
179
+ # @overload get_autofeed_settings(name: nil)
180
+ # Pass arguments to `get_autofeed_settings` via keyword arguments. Note that at
181
+ # least one keyword argument is required. To specify no parameters, or to keep all
182
+ # the default parameter values, pass an empty Hash as a request object (see above).
183
+ #
184
+ # @param name [::String]
185
+ # Required. The resource name of the autofeed settings.
186
+ # Format: `accounts/{account}/autofeedSettings`
187
+ # @yield [result, operation] Access the result along with the TransportOperation object
188
+ # @yieldparam result [::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings]
189
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
190
+ #
191
+ # @return [::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings]
192
+ #
193
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
194
+ #
195
+ # @example Basic example
196
+ # require "google/shopping/merchant/accounts/v1beta"
197
+ #
198
+ # # Create a client object. The client can be reused for multiple calls.
199
+ # client = Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client.new
200
+ #
201
+ # # Create a request. To set request fields, pass in keyword arguments.
202
+ # request = Google::Shopping::Merchant::Accounts::V1beta::GetAutofeedSettingsRequest.new
203
+ #
204
+ # # Call the get_autofeed_settings method.
205
+ # result = client.get_autofeed_settings request
206
+ #
207
+ # # The returned object is of type Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings.
208
+ # p result
209
+ #
210
+ def get_autofeed_settings request, options = nil
211
+ raise ::ArgumentError, "request must be provided" if request.nil?
212
+
213
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Accounts::V1beta::GetAutofeedSettingsRequest
214
+
215
+ # Converts hash and nil to an options object
216
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
217
+
218
+ # Customize the options with defaults
219
+ call_metadata = @config.rpcs.get_autofeed_settings.metadata.to_h
220
+
221
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
222
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
223
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
224
+ gapic_version: ::Google::Shopping::Merchant::Accounts::V1beta::VERSION,
225
+ transports_version_send: [:rest]
226
+
227
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
228
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
229
+
230
+ options.apply_defaults timeout: @config.rpcs.get_autofeed_settings.timeout,
231
+ metadata: call_metadata,
232
+ retry_policy: @config.rpcs.get_autofeed_settings.retry_policy
233
+
234
+ options.apply_defaults timeout: @config.timeout,
235
+ metadata: @config.metadata,
236
+ retry_policy: @config.retry_policy
237
+
238
+ @autofeed_settings_service_stub.get_autofeed_settings request, options do |result, operation|
239
+ yield result, operation if block_given?
240
+ return result
241
+ end
242
+ rescue ::Gapic::Rest::Error => e
243
+ raise ::Google::Cloud::Error.from_error(e)
244
+ end
245
+
246
+ ##
247
+ # Updates the autofeed settings of an account.
248
+ #
249
+ # @overload update_autofeed_settings(request, options = nil)
250
+ # Pass arguments to `update_autofeed_settings` via a request object, either of type
251
+ # {::Google::Shopping::Merchant::Accounts::V1beta::UpdateAutofeedSettingsRequest} or an equivalent Hash.
252
+ #
253
+ # @param request [::Google::Shopping::Merchant::Accounts::V1beta::UpdateAutofeedSettingsRequest, ::Hash]
254
+ # A request object representing the call parameters. Required. To specify no
255
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
256
+ # @param options [::Gapic::CallOptions, ::Hash]
257
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
258
+ #
259
+ # @overload update_autofeed_settings(autofeed_settings: nil, update_mask: nil)
260
+ # Pass arguments to `update_autofeed_settings` via keyword arguments. Note that at
261
+ # least one keyword argument is required. To specify no parameters, or to keep all
262
+ # the default parameter values, pass an empty Hash as a request object (see above).
263
+ #
264
+ # @param autofeed_settings [::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings, ::Hash]
265
+ # Required. The new version of the autofeed setting.
266
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
267
+ # Required. List of fields being updated.
268
+ # @yield [result, operation] Access the result along with the TransportOperation object
269
+ # @yieldparam result [::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings]
270
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
271
+ #
272
+ # @return [::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings]
273
+ #
274
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
275
+ #
276
+ # @example Basic example
277
+ # require "google/shopping/merchant/accounts/v1beta"
278
+ #
279
+ # # Create a client object. The client can be reused for multiple calls.
280
+ # client = Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client.new
281
+ #
282
+ # # Create a request. To set request fields, pass in keyword arguments.
283
+ # request = Google::Shopping::Merchant::Accounts::V1beta::UpdateAutofeedSettingsRequest.new
284
+ #
285
+ # # Call the update_autofeed_settings method.
286
+ # result = client.update_autofeed_settings request
287
+ #
288
+ # # The returned object is of type Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings.
289
+ # p result
290
+ #
291
+ def update_autofeed_settings request, options = nil
292
+ raise ::ArgumentError, "request must be provided" if request.nil?
293
+
294
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Merchant::Accounts::V1beta::UpdateAutofeedSettingsRequest
295
+
296
+ # Converts hash and nil to an options object
297
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
298
+
299
+ # Customize the options with defaults
300
+ call_metadata = @config.rpcs.update_autofeed_settings.metadata.to_h
301
+
302
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
303
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
304
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
305
+ gapic_version: ::Google::Shopping::Merchant::Accounts::V1beta::VERSION,
306
+ transports_version_send: [:rest]
307
+
308
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
309
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
310
+
311
+ options.apply_defaults timeout: @config.rpcs.update_autofeed_settings.timeout,
312
+ metadata: call_metadata,
313
+ retry_policy: @config.rpcs.update_autofeed_settings.retry_policy
314
+
315
+ options.apply_defaults timeout: @config.timeout,
316
+ metadata: @config.metadata,
317
+ retry_policy: @config.retry_policy
318
+
319
+ @autofeed_settings_service_stub.update_autofeed_settings request, options do |result, operation|
320
+ yield result, operation if block_given?
321
+ return result
322
+ end
323
+ rescue ::Gapic::Rest::Error => e
324
+ raise ::Google::Cloud::Error.from_error(e)
325
+ end
326
+
327
+ ##
328
+ # Configuration class for the AutofeedSettingsService REST API.
329
+ #
330
+ # This class represents the configuration for AutofeedSettingsService REST,
331
+ # providing control over timeouts, retry behavior, logging, transport
332
+ # parameters, and other low-level controls. Certain parameters can also be
333
+ # applied individually to specific RPCs. See
334
+ # {::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client::Configuration::Rpcs}
335
+ # for a list of RPCs that can be configured independently.
336
+ #
337
+ # Configuration can be applied globally to all clients, or to a single client
338
+ # on construction.
339
+ #
340
+ # @example
341
+ #
342
+ # # Modify the global config, setting the timeout for
343
+ # # get_autofeed_settings to 20 seconds,
344
+ # # and all remaining timeouts to 10 seconds.
345
+ # ::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client.configure do |config|
346
+ # config.timeout = 10.0
347
+ # config.rpcs.get_autofeed_settings.timeout = 20.0
348
+ # end
349
+ #
350
+ # # Apply the above configuration only to a new client.
351
+ # client = ::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettingsService::Rest::Client.new do |config|
352
+ # config.timeout = 10.0
353
+ # config.rpcs.get_autofeed_settings.timeout = 20.0
354
+ # end
355
+ #
356
+ # @!attribute [rw] endpoint
357
+ # A custom service endpoint, as a hostname or hostname:port. The default is
358
+ # nil, indicating to use the default endpoint in the current universe domain.
359
+ # @return [::String,nil]
360
+ # @!attribute [rw] credentials
361
+ # Credentials to send with calls. You may provide any of the following types:
362
+ # * (`String`) The path to a service account key file in JSON format
363
+ # * (`Hash`) A service account key as a Hash
364
+ # * (`Google::Auth::Credentials`) A googleauth credentials object
365
+ # (see the [googleauth docs](https://rubydoc.info/gems/googleauth/Google/Auth/Credentials))
366
+ # * (`Signet::OAuth2::Client`) A signet oauth2 client object
367
+ # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
368
+ # * (`nil`) indicating no credentials
369
+ # @return [::Object]
370
+ # @!attribute [rw] scope
371
+ # The OAuth scopes
372
+ # @return [::Array<::String>]
373
+ # @!attribute [rw] lib_name
374
+ # The library name as recorded in instrumentation and logging
375
+ # @return [::String]
376
+ # @!attribute [rw] lib_version
377
+ # The library version as recorded in instrumentation and logging
378
+ # @return [::String]
379
+ # @!attribute [rw] timeout
380
+ # The call timeout in seconds.
381
+ # @return [::Numeric]
382
+ # @!attribute [rw] metadata
383
+ # Additional headers to be sent with the call.
384
+ # @return [::Hash{::Symbol=>::String}]
385
+ # @!attribute [rw] retry_policy
386
+ # The retry policy. The value is a hash with the following keys:
387
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
388
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
389
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
390
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
391
+ # trigger a retry.
392
+ # @return [::Hash]
393
+ # @!attribute [rw] quota_project
394
+ # A separate project against which to charge quota.
395
+ # @return [::String]
396
+ # @!attribute [rw] universe_domain
397
+ # The universe domain within which to make requests. This determines the
398
+ # default endpoint URL. The default value of nil uses the environment
399
+ # universe (usually the default "googleapis.com" universe).
400
+ # @return [::String,nil]
401
+ #
402
+ class Configuration
403
+ extend ::Gapic::Config
404
+
405
+ # @private
406
+ # The endpoint specific to the default "googleapis.com" universe. Deprecated.
407
+ DEFAULT_ENDPOINT = "merchantapi.googleapis.com"
408
+
409
+ config_attr :endpoint, nil, ::String, nil
410
+ config_attr :credentials, nil do |value|
411
+ allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
412
+ allowed.any? { |klass| klass === value }
413
+ end
414
+ config_attr :scope, nil, ::String, ::Array, nil
415
+ config_attr :lib_name, nil, ::String, nil
416
+ config_attr :lib_version, nil, ::String, nil
417
+ config_attr :timeout, nil, ::Numeric, nil
418
+ config_attr :metadata, nil, ::Hash, nil
419
+ config_attr :retry_policy, nil, ::Hash, ::Proc, nil
420
+ config_attr :quota_project, nil, ::String, nil
421
+ config_attr :universe_domain, nil, ::String, nil
422
+
423
+ # @private
424
+ def initialize parent_config = nil
425
+ @parent_config = parent_config unless parent_config.nil?
426
+
427
+ yield self if block_given?
428
+ end
429
+
430
+ ##
431
+ # Configurations for individual RPCs
432
+ # @return [Rpcs]
433
+ #
434
+ def rpcs
435
+ @rpcs ||= begin
436
+ parent_rpcs = nil
437
+ parent_rpcs = @parent_config.rpcs if defined?(@parent_config) && @parent_config.respond_to?(:rpcs)
438
+ Rpcs.new parent_rpcs
439
+ end
440
+ end
441
+
442
+ ##
443
+ # Configuration RPC class for the AutofeedSettingsService API.
444
+ #
445
+ # Includes fields providing the configuration for each RPC in this service.
446
+ # Each configuration object is of type `Gapic::Config::Method` and includes
447
+ # the following configuration fields:
448
+ #
449
+ # * `timeout` (*type:* `Numeric`) - The call timeout in seconds
450
+ # * `metadata` (*type:* `Hash{Symbol=>String}`) - Additional headers
451
+ # * `retry_policy (*type:* `Hash`) - The retry policy. The policy fields
452
+ # include the following keys:
453
+ # * `:initial_delay` (*type:* `Numeric`) - The initial delay in seconds.
454
+ # * `:max_delay` (*type:* `Numeric`) - The max delay in seconds.
455
+ # * `:multiplier` (*type:* `Numeric`) - The incremental backoff multiplier.
456
+ # * `:retry_codes` (*type:* `Array<String>`) - The error codes that should
457
+ # trigger a retry.
458
+ #
459
+ class Rpcs
460
+ ##
461
+ # RPC-specific configuration for `get_autofeed_settings`
462
+ # @return [::Gapic::Config::Method]
463
+ #
464
+ attr_reader :get_autofeed_settings
465
+ ##
466
+ # RPC-specific configuration for `update_autofeed_settings`
467
+ # @return [::Gapic::Config::Method]
468
+ #
469
+ attr_reader :update_autofeed_settings
470
+
471
+ # @private
472
+ def initialize parent_rpcs = nil
473
+ get_autofeed_settings_config = parent_rpcs.get_autofeed_settings if parent_rpcs.respond_to? :get_autofeed_settings
474
+ @get_autofeed_settings = ::Gapic::Config::Method.new get_autofeed_settings_config
475
+ update_autofeed_settings_config = parent_rpcs.update_autofeed_settings if parent_rpcs.respond_to? :update_autofeed_settings
476
+ @update_autofeed_settings = ::Gapic::Config::Method.new update_autofeed_settings_config
477
+
478
+ yield self if block_given?
479
+ end
480
+ end
481
+ end
482
+ end
483
+ end
484
+ end
485
+ end
486
+ end
487
+ end
488
+ end
489
+ end
@@ -0,0 +1,190 @@
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/shopping/merchant/accounts/v1beta/autofeedsettings_pb"
20
+
21
+ module Google
22
+ module Shopping
23
+ module Merchant
24
+ module Accounts
25
+ module V1beta
26
+ module AutofeedSettingsService
27
+ module Rest
28
+ ##
29
+ # REST service stub for the AutofeedSettingsService service.
30
+ # Service stub contains baseline method implementations
31
+ # including transcoding, making the REST call, and deserialing the response.
32
+ #
33
+ class ServiceStub
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
35
+ # These require statements are intentionally placed here to initialize
36
+ # the REST modules only when it's required.
37
+ require "gapic/rest"
38
+
39
+ @client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
40
+ endpoint_template: endpoint_template,
41
+ universe_domain: universe_domain,
42
+ credentials: credentials,
43
+ numeric_enums: true,
44
+ raise_faraday_errors: false
45
+ end
46
+
47
+ ##
48
+ # The effective universe domain
49
+ #
50
+ # @return [String]
51
+ #
52
+ def universe_domain
53
+ @client_stub.universe_domain
54
+ end
55
+
56
+ ##
57
+ # The effective endpoint
58
+ #
59
+ # @return [String]
60
+ #
61
+ def endpoint
62
+ @client_stub.endpoint
63
+ end
64
+
65
+ ##
66
+ # Baseline implementation for the get_autofeed_settings REST call
67
+ #
68
+ # @param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::GetAutofeedSettingsRequest]
69
+ # A request object representing the call parameters. Required.
70
+ # @param options [::Gapic::CallOptions]
71
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
72
+ #
73
+ # @yield [result, operation] Access the result along with the TransportOperation object
74
+ # @yieldparam result [::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings]
75
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
76
+ #
77
+ # @return [::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings]
78
+ # A result object deserialized from the server's reply
79
+ def get_autofeed_settings request_pb, options = nil
80
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
81
+
82
+ verb, uri, query_string_params, body = ServiceStub.transcode_get_autofeed_settings_request request_pb
83
+ query_string_params = if query_string_params.any?
84
+ query_string_params.to_h { |p| p.split "=", 2 }
85
+ else
86
+ {}
87
+ end
88
+
89
+ response = @client_stub.make_http_request(
90
+ verb,
91
+ uri: uri,
92
+ body: body || "",
93
+ params: query_string_params,
94
+ options: options
95
+ )
96
+ operation = ::Gapic::Rest::TransportOperation.new response
97
+ result = ::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings.decode_json response.body, ignore_unknown_fields: true
98
+
99
+ yield result, operation if block_given?
100
+ result
101
+ end
102
+
103
+ ##
104
+ # Baseline implementation for the update_autofeed_settings REST call
105
+ #
106
+ # @param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::UpdateAutofeedSettingsRequest]
107
+ # A request object representing the call parameters. Required.
108
+ # @param options [::Gapic::CallOptions]
109
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
110
+ #
111
+ # @yield [result, operation] Access the result along with the TransportOperation object
112
+ # @yieldparam result [::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings]
113
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
114
+ #
115
+ # @return [::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings]
116
+ # A result object deserialized from the server's reply
117
+ def update_autofeed_settings request_pb, options = nil
118
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
119
+
120
+ verb, uri, query_string_params, body = ServiceStub.transcode_update_autofeed_settings_request request_pb
121
+ query_string_params = if query_string_params.any?
122
+ query_string_params.to_h { |p| p.split "=", 2 }
123
+ else
124
+ {}
125
+ end
126
+
127
+ response = @client_stub.make_http_request(
128
+ verb,
129
+ uri: uri,
130
+ body: body || "",
131
+ params: query_string_params,
132
+ options: options
133
+ )
134
+ operation = ::Gapic::Rest::TransportOperation.new response
135
+ result = ::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings.decode_json response.body, ignore_unknown_fields: true
136
+
137
+ yield result, operation if block_given?
138
+ result
139
+ end
140
+
141
+ ##
142
+ # @private
143
+ #
144
+ # GRPC transcoding helper method for the get_autofeed_settings REST call
145
+ #
146
+ # @param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::GetAutofeedSettingsRequest]
147
+ # A request object representing the call parameters. Required.
148
+ # @return [Array(String, [String, nil], Hash{String => String})]
149
+ # Uri, Body, Query string parameters
150
+ def self.transcode_get_autofeed_settings_request request_pb
151
+ transcoder = Gapic::Rest::GrpcTranscoder.new
152
+ .with_bindings(
153
+ uri_method: :get,
154
+ uri_template: "/accounts/v1beta/{name}",
155
+ matches: [
156
+ ["name", %r{^accounts/[^/]+/autofeedSettings/?$}, false]
157
+ ]
158
+ )
159
+ transcoder.transcode request_pb
160
+ end
161
+
162
+ ##
163
+ # @private
164
+ #
165
+ # GRPC transcoding helper method for the update_autofeed_settings REST call
166
+ #
167
+ # @param request_pb [::Google::Shopping::Merchant::Accounts::V1beta::UpdateAutofeedSettingsRequest]
168
+ # A request object representing the call parameters. Required.
169
+ # @return [Array(String, [String, nil], Hash{String => String})]
170
+ # Uri, Body, Query string parameters
171
+ def self.transcode_update_autofeed_settings_request request_pb
172
+ transcoder = Gapic::Rest::GrpcTranscoder.new
173
+ .with_bindings(
174
+ uri_method: :patch,
175
+ uri_template: "/accounts/v1beta/{autofeed_settings.name}",
176
+ body: "autofeed_settings",
177
+ matches: [
178
+ ["autofeed_settings.name", %r{^accounts/[^/]+/autofeedSettings/?$}, false]
179
+ ]
180
+ )
181
+ transcoder.transcode request_pb
182
+ end
183
+ end
184
+ end
185
+ end
186
+ end
187
+ end
188
+ end
189
+ end
190
+ end