google-shopping-css-v1 0.2.1 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/shopping/css/v1/account_labels_service/client.rb +28 -5
  4. data/lib/google/shopping/css/v1/account_labels_service/rest/client.rb +28 -5
  5. data/lib/google/shopping/css/v1/account_labels_service/rest/service_stub.rb +46 -26
  6. data/lib/google/shopping/css/v1/accounts_service/client.rb +30 -6
  7. data/lib/google/shopping/css/v1/accounts_service/rest/client.rb +30 -6
  8. data/lib/google/shopping/css/v1/accounts_service/rest/service_stub.rb +38 -20
  9. data/lib/google/shopping/css/v1/css_product_inputs_pb.rb +4 -1
  10. data/lib/google/shopping/css/v1/css_product_inputs_service/client.rb +149 -8
  11. data/lib/google/shopping/css/v1/css_product_inputs_service/rest/client.rb +142 -8
  12. data/lib/google/shopping/css/v1/css_product_inputs_service/rest/service_stub.rb +91 -13
  13. data/lib/google/shopping/css/v1/css_product_inputs_services_pb.rb +5 -0
  14. data/lib/google/shopping/css/v1/css_products_service/client.rb +28 -3
  15. data/lib/google/shopping/css/v1/css_products_service/rest/client.rb +28 -3
  16. data/lib/google/shopping/css/v1/css_products_service/rest/service_stub.rb +30 -14
  17. data/lib/google/shopping/css/v1/version.rb +1 -1
  18. data/proto_docs/google/api/client.rb +19 -0
  19. data/proto_docs/google/protobuf/field_mask.rb +229 -0
  20. data/proto_docs/google/shopping/css/v1/accounts.rb +2 -2
  21. data/proto_docs/google/shopping/css/v1/css_product_common.rb +10 -10
  22. data/proto_docs/google/shopping/css/v1/css_product_inputs.rb +38 -5
  23. data/proto_docs/google/shopping/css/v1/css_products.rb +1 -1
  24. metadata +6 -5
@@ -9,12 +9,13 @@ require 'google/api/client_pb'
9
9
  require 'google/api/field_behavior_pb'
10
10
  require 'google/api/resource_pb'
11
11
  require 'google/protobuf/empty_pb'
12
+ require 'google/protobuf/field_mask_pb'
12
13
  require 'google/protobuf/timestamp_pb'
13
14
  require 'google/shopping/css/v1/css_product_common_pb'
14
15
  require 'google/shopping/type/types_pb'
15
16
 
16
17
 
17
- descriptor_data = "\n/google/shopping/css/v1/css_product_inputs.proto\x12\x16google.shopping.css.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a/google/shopping/css/v1/css_product_common.proto\x1a google/shopping/type/types.proto\"\x9e\x03\n\x0f\x43ssProductInput\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x17\n\nfinal_name\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12\x1c\n\x0fraw_provided_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x1d\n\x10\x63ontent_language\x18\x04 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\nfeed_label\x18\x05 \x01(\tB\x03\xe0\x41\x02\x12\x32\n\x0e\x66reshness_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x36\n\nattributes\x18\x07 \x01(\x0b\x32\".google.shopping.css.v1.Attributes\x12@\n\x11\x63ustom_attributes\x18\x08 \x03(\x0b\x32%.google.shopping.type.CustomAttribute:`\xea\x41]\n\"css.googleapis.com/CssProductInput\x12\x37\x61\x63\x63ounts/{account}/cssProductInputs/{css_product_input}\"\xb9\x01\n\x1cInsertCssProductInputRequest\x12:\n\x06parent\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\x12\"css.googleapis.com/CssProductInput\x12G\n\x11\x63ss_product_input\x18\x02 \x01(\x0b\x32\'.google.shopping.css.v1.CssProductInputB\x03\xe0\x41\x02\x12\x14\n\x07\x66\x65\x65\x64_id\x18\x03 \x01(\x03\x42\x03\xe0\x41\x02\"\x94\x01\n\x1c\x44\x65leteCssProductInputRequest\x12\x38\n\x04name\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n\"css.googleapis.com/CssProductInput\x12!\n\x14supplemental_feed_id\x18\x02 \x01(\x03H\x00\x88\x01\x01\x42\x17\n\x15_supplemental_feed_id2\xc0\x03\n\x17\x43ssProductInputsService\x12\xc2\x01\n\x15InsertCssProductInput\x12\x34.google.shopping.css.v1.InsertCssProductInputRequest\x1a\'.google.shopping.css.v1.CssProductInput\"J\x82\xd3\xe4\x93\x02\x44\"//v1/{parent=accounts/*}/cssProductInputs:insert:\x11\x63ss_product_input\x12\x9e\x01\n\x15\x44\x65leteCssProductInput\x12\x34.google.shopping.css.v1.DeleteCssProductInputRequest\x1a\x16.google.protobuf.Empty\"7\xda\x41\x04name\x82\xd3\xe4\x93\x02**(/v1/{name=accounts/*/cssProductInputs/*}\x1a?\xca\x41\x12\x63ss.googleapis.com\xd2\x41\'https://www.googleapis.com/auth/contentB\xb7\x01\n\x1a\x63om.google.shopping.css.v1B\x15\x43ssProductInputsProtoP\x01Z2cloud.google.com/go/shopping/css/apiv1/csspb;csspb\xaa\x02\x16Google.Shopping.Css.V1\xca\x02\x16Google\\Shopping\\Css\\V1\xea\x02\x19Google::Shopping::Css::V1b\x06proto3"
18
+ descriptor_data = "\n/google/shopping/css/v1/css_product_inputs.proto\x12\x16google.shopping.css.v1\x1a\x1cgoogle/api/annotations.proto\x1a\x17google/api/client.proto\x1a\x1fgoogle/api/field_behavior.proto\x1a\x19google/api/resource.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a google/protobuf/field_mask.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a/google/shopping/css/v1/css_product_common.proto\x1a google/shopping/type/types.proto\"\xa2\x03\n\x0f\x43ssProductInput\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\x17\n\nfinal_name\x18\x02 \x01(\tB\x03\xe0\x41\x03\x12\x1c\n\x0fraw_provided_id\x18\x03 \x01(\tB\x03\xe0\x41\x02\x12\x1d\n\x10\x63ontent_language\x18\x04 \x01(\tB\x03\xe0\x41\x02\x12\x17\n\nfeed_label\x18\x05 \x01(\tB\x03\xe0\x41\x02\x12\x36\n\x0e\x66reshness_time\x18\x06 \x01(\x0b\x32\x1a.google.protobuf.TimestampB\x02\x18\x01\x12\x36\n\nattributes\x18\x07 \x01(\x0b\x32\".google.shopping.css.v1.Attributes\x12@\n\x11\x63ustom_attributes\x18\x08 \x03(\x0b\x32%.google.shopping.type.CustomAttribute:`\xea\x41]\n\"css.googleapis.com/CssProductInput\x12\x37\x61\x63\x63ounts/{account}/cssProductInputs/{css_product_input}\"\xbb\x01\n\x1cInsertCssProductInputRequest\x12:\n\x06parent\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\x12\"css.googleapis.com/CssProductInput\x12G\n\x11\x63ss_product_input\x18\x02 \x01(\x0b\x32\'.google.shopping.css.v1.CssProductInputB\x03\xe0\x41\x02\x12\x16\n\x07\x66\x65\x65\x64_id\x18\x03 \x01(\x03\x42\x05\x18\x01\xe0\x41\x01\"\x98\x01\n\x1cUpdateCssProductInputRequest\x12G\n\x11\x63ss_product_input\x18\x01 \x01(\x0b\x32\'.google.shopping.css.v1.CssProductInputB\x03\xe0\x41\x02\x12/\n\x0bupdate_mask\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.FieldMask\"\x94\x01\n\x1c\x44\x65leteCssProductInputRequest\x12\x38\n\x04name\x18\x01 \x01(\tB*\xe0\x41\x02\xfa\x41$\n\"css.googleapis.com/CssProductInput\x12!\n\x14supplemental_feed_id\x18\x02 \x01(\x03H\x00\x88\x01\x01\x42\x17\n\x15_supplemental_feed_id2\xb0\x05\n\x17\x43ssProductInputsService\x12\xc2\x01\n\x15InsertCssProductInput\x12\x34.google.shopping.css.v1.InsertCssProductInputRequest\x1a\'.google.shopping.css.v1.CssProductInput\"J\x82\xd3\xe4\x93\x02\x44\"//v1/{parent=accounts/*}/cssProductInputs:insert:\x11\x63ss_product_input\x12\xed\x01\n\x15UpdateCssProductInput\x12\x34.google.shopping.css.v1.UpdateCssProductInputRequest\x1a\'.google.shopping.css.v1.CssProductInput\"u\xda\x41\x1d\x63ss_product_input,update_mask\x82\xd3\xe4\x93\x02O2:/v1/{css_product_input.name=accounts/*/cssProductInputs/*}:\x11\x63ss_product_input\x12\x9e\x01\n\x15\x44\x65leteCssProductInput\x12\x34.google.shopping.css.v1.DeleteCssProductInputRequest\x1a\x16.google.protobuf.Empty\"7\xda\x41\x04name\x82\xd3\xe4\x93\x02**(/v1/{name=accounts/*/cssProductInputs/*}\x1a?\xca\x41\x12\x63ss.googleapis.com\xd2\x41\'https://www.googleapis.com/auth/contentB\xb7\x01\n\x1a\x63om.google.shopping.css.v1B\x15\x43ssProductInputsProtoP\x01Z2cloud.google.com/go/shopping/css/apiv1/csspb;csspb\xaa\x02\x16Google.Shopping.Css.V1\xca\x02\x16Google\\Shopping\\Css\\V1\xea\x02\x19Google::Shopping::Css::V1b\x06proto3"
18
19
 
19
20
  pool = Google::Protobuf::DescriptorPool.generated_pool
20
21
 
@@ -32,6 +33,7 @@ rescue TypeError
32
33
  ["google.protobuf.Timestamp", "google/protobuf/timestamp.proto"],
33
34
  ["google.shopping.css.v1.Attributes", "google/shopping/css/v1/css_product_common.proto"],
34
35
  ["google.shopping.type.CustomAttribute", "google/shopping/type/types.proto"],
36
+ ["google.protobuf.FieldMask", "google/protobuf/field_mask.proto"],
35
37
  ]
36
38
  imports.each do |type_name, expected_filename|
37
39
  import_file = pool.lookup(type_name).file_descriptor
@@ -49,6 +51,7 @@ module Google
49
51
  module V1
50
52
  CssProductInput = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.css.v1.CssProductInput").msgclass
51
53
  InsertCssProductInputRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.css.v1.InsertCssProductInputRequest").msgclass
54
+ UpdateCssProductInputRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.css.v1.UpdateCssProductInputRequest").msgclass
52
55
  DeleteCssProductInputRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("google.shopping.css.v1.DeleteCssProductInputRequest").msgclass
53
56
  end
54
57
  end
@@ -73,6 +73,8 @@ module Google
73
73
 
74
74
  default_config.rpcs.insert_css_product_input.timeout = 60.0
75
75
 
76
+ default_config.rpcs.update_css_product_input.timeout = 60.0
77
+
76
78
  default_config.rpcs.delete_css_product_input.timeout = 60.0
77
79
 
78
80
  default_config
@@ -162,8 +164,28 @@ module Google
162
164
  universe_domain: @config.universe_domain,
163
165
  channel_args: @config.channel_args,
164
166
  interceptors: @config.interceptors,
165
- channel_pool_config: @config.channel_pool
167
+ channel_pool_config: @config.channel_pool,
168
+ logger: @config.logger
166
169
  )
170
+
171
+ @css_product_inputs_service_stub.stub_logger&.info do |entry|
172
+ entry.set_system_name
173
+ entry.set_service
174
+ entry.message = "Created client for #{entry.service}"
175
+ entry.set_credentials_fields credentials
176
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
177
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
178
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
179
+ end
180
+ end
181
+
182
+ ##
183
+ # The logger used for request/response debug logging.
184
+ #
185
+ # @return [Logger]
186
+ #
187
+ def logger
188
+ @css_product_inputs_service_stub.logger
167
189
  end
168
190
 
169
191
  # Service calls
@@ -197,11 +219,13 @@ module Google
197
219
  # @param css_product_input [::Google::Shopping::Css::V1::CssProductInput, ::Hash]
198
220
  # Required. The CSS Product Input to insert.
199
221
  # @param feed_id [::Integer]
200
- # Required. The primary or supplemental feed id. If CSS Product already
201
- # exists and feed id provided is different, then the CSS Product will be
202
- # moved to a new feed. Note: For now, CSSs do not need to provide feed ids as
203
- # we create feeds on the fly. We do not have supplemental feed support for
204
- # CSS Products yet.
222
+ # Optional. DEPRECATED. Feed id is not required for CSS Products.
223
+ # The primary or supplemental feed id. If CSS Product already exists and
224
+ # feed id provided is different, then the CSS Product will be moved to a
225
+ # new feed.
226
+ # Note: For now, CSSs do not need to provide feed ids as we create
227
+ # feeds on the fly.
228
+ # We do not have supplemental feed support for CSS Products yet.
205
229
  #
206
230
  # @yield [response, operation] Access the result along with the RPC operation
207
231
  # @yieldparam response [::Google::Shopping::Css::V1::CssProductInput]
@@ -262,7 +286,112 @@ module Google
262
286
 
263
287
  @css_product_inputs_service_stub.call_rpc :insert_css_product_input, request, options: options do |response, operation|
264
288
  yield response, operation if block_given?
265
- return response
289
+ end
290
+ rescue ::GRPC::BadStatus => e
291
+ raise ::Google::Cloud::Error.from_error(e)
292
+ end
293
+
294
+ ##
295
+ # Updates the existing Css Product input in your CSS Center account.
296
+ #
297
+ # After inserting, updating, or deleting a CSS Product input, it may take
298
+ # several minutes before the processed Css Product can be retrieved.
299
+ #
300
+ # @overload update_css_product_input(request, options = nil)
301
+ # Pass arguments to `update_css_product_input` via a request object, either of type
302
+ # {::Google::Shopping::Css::V1::UpdateCssProductInputRequest} or an equivalent Hash.
303
+ #
304
+ # @param request [::Google::Shopping::Css::V1::UpdateCssProductInputRequest, ::Hash]
305
+ # A request object representing the call parameters. Required. To specify no
306
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
307
+ # @param options [::Gapic::CallOptions, ::Hash]
308
+ # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
309
+ #
310
+ # @overload update_css_product_input(css_product_input: nil, update_mask: nil)
311
+ # Pass arguments to `update_css_product_input` via keyword arguments. Note that at
312
+ # least one keyword argument is required. To specify no parameters, or to keep all
313
+ # the default parameter values, pass an empty Hash as a request object (see above).
314
+ #
315
+ # @param css_product_input [::Google::Shopping::Css::V1::CssProductInput, ::Hash]
316
+ # Required. The CSS product input resource to update. Information you submit
317
+ # will be applied to the processed CSS product as well.
318
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
319
+ # The list of CSS product attributes to be updated.
320
+ #
321
+ # If the update mask is omitted, then it is treated as implied field mask
322
+ # equivalent to all fields that are populated (have a non-empty value).
323
+ #
324
+ # Attributes specified in the update mask without a value specified in the
325
+ # body will be deleted from the CSS product.
326
+ #
327
+ # Update mask can only be specified for top level fields in
328
+ # attributes and custom attributes.
329
+ #
330
+ # To specify the update mask for custom attributes you need to add the
331
+ # `custom_attribute.` prefix.
332
+ #
333
+ # Providing special "*" value for full CSS product replacement is not
334
+ # supported.
335
+ #
336
+ # @yield [response, operation] Access the result along with the RPC operation
337
+ # @yieldparam response [::Google::Shopping::Css::V1::CssProductInput]
338
+ # @yieldparam operation [::GRPC::ActiveCall::Operation]
339
+ #
340
+ # @return [::Google::Shopping::Css::V1::CssProductInput]
341
+ #
342
+ # @raise [::Google::Cloud::Error] if the RPC is aborted.
343
+ #
344
+ # @example Basic example
345
+ # require "google/shopping/css/v1"
346
+ #
347
+ # # Create a client object. The client can be reused for multiple calls.
348
+ # client = Google::Shopping::Css::V1::CssProductInputsService::Client.new
349
+ #
350
+ # # Create a request. To set request fields, pass in keyword arguments.
351
+ # request = Google::Shopping::Css::V1::UpdateCssProductInputRequest.new
352
+ #
353
+ # # Call the update_css_product_input method.
354
+ # result = client.update_css_product_input request
355
+ #
356
+ # # The returned object is of type Google::Shopping::Css::V1::CssProductInput.
357
+ # p result
358
+ #
359
+ def update_css_product_input request, options = nil
360
+ raise ::ArgumentError, "request must be provided" if request.nil?
361
+
362
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Css::V1::UpdateCssProductInputRequest
363
+
364
+ # Converts hash and nil to an options object
365
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
366
+
367
+ # Customize the options with defaults
368
+ metadata = @config.rpcs.update_css_product_input.metadata.to_h
369
+
370
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
371
+ metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
372
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
373
+ gapic_version: ::Google::Shopping::Css::V1::VERSION
374
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
375
+ metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
376
+
377
+ header_params = {}
378
+ if request.css_product_input&.name
379
+ header_params["css_product_input.name"] = request.css_product_input.name
380
+ end
381
+
382
+ request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
383
+ metadata[:"x-goog-request-params"] ||= request_params_header
384
+
385
+ options.apply_defaults timeout: @config.rpcs.update_css_product_input.timeout,
386
+ metadata: metadata,
387
+ retry_policy: @config.rpcs.update_css_product_input.retry_policy
388
+
389
+ options.apply_defaults timeout: @config.timeout,
390
+ metadata: @config.metadata,
391
+ retry_policy: @config.retry_policy
392
+
393
+ @css_product_inputs_service_stub.call_rpc :update_css_product_input, request, options: options do |response, operation|
394
+ yield response, operation if block_given?
266
395
  end
267
396
  rescue ::GRPC::BadStatus => e
268
397
  raise ::Google::Cloud::Error.from_error(e)
@@ -357,7 +486,6 @@ module Google
357
486
 
358
487
  @css_product_inputs_service_stub.call_rpc :delete_css_product_input, request, options: options do |response, operation|
359
488
  yield response, operation if block_given?
360
- return response
361
489
  end
362
490
  rescue ::GRPC::BadStatus => e
363
491
  raise ::Google::Cloud::Error.from_error(e)
@@ -446,6 +574,11 @@ module Google
446
574
  # default endpoint URL. The default value of nil uses the environment
447
575
  # universe (usually the default "googleapis.com" universe).
448
576
  # @return [::String,nil]
577
+ # @!attribute [rw] logger
578
+ # A custom logger to use for request/response debug logging, or the value
579
+ # `:default` (the default) to construct a default logger, or `nil` to
580
+ # explicitly disable logging.
581
+ # @return [::Logger,:default,nil]
449
582
  #
450
583
  class Configuration
451
584
  extend ::Gapic::Config
@@ -470,6 +603,7 @@ module Google
470
603
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
471
604
  config_attr :quota_project, nil, ::String, nil
472
605
  config_attr :universe_domain, nil, ::String, nil
606
+ config_attr :logger, :default, ::Logger, nil, :default
473
607
 
474
608
  # @private
475
609
  def initialize parent_config = nil
@@ -522,6 +656,11 @@ module Google
522
656
  #
523
657
  attr_reader :insert_css_product_input
524
658
  ##
659
+ # RPC-specific configuration for `update_css_product_input`
660
+ # @return [::Gapic::Config::Method]
661
+ #
662
+ attr_reader :update_css_product_input
663
+ ##
525
664
  # RPC-specific configuration for `delete_css_product_input`
526
665
  # @return [::Gapic::Config::Method]
527
666
  #
@@ -531,6 +670,8 @@ module Google
531
670
  def initialize parent_rpcs = nil
532
671
  insert_css_product_input_config = parent_rpcs.insert_css_product_input if parent_rpcs.respond_to? :insert_css_product_input
533
672
  @insert_css_product_input = ::Gapic::Config::Method.new insert_css_product_input_config
673
+ update_css_product_input_config = parent_rpcs.update_css_product_input if parent_rpcs.respond_to? :update_css_product_input
674
+ @update_css_product_input = ::Gapic::Config::Method.new update_css_product_input_config
534
675
  delete_css_product_input_config = parent_rpcs.delete_css_product_input if parent_rpcs.respond_to? :delete_css_product_input
535
676
  @delete_css_product_input = ::Gapic::Config::Method.new delete_css_product_input_config
536
677
 
@@ -75,6 +75,8 @@ module Google
75
75
 
76
76
  default_config.rpcs.insert_css_product_input.timeout = 60.0
77
77
 
78
+ default_config.rpcs.update_css_product_input.timeout = 60.0
79
+
78
80
  default_config.rpcs.delete_css_product_input.timeout = 60.0
79
81
 
80
82
  default_config
@@ -155,8 +157,28 @@ module Google
155
157
  endpoint: @config.endpoint,
156
158
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
157
159
  universe_domain: @config.universe_domain,
158
- credentials: credentials
160
+ credentials: credentials,
161
+ logger: @config.logger
159
162
  )
163
+
164
+ @css_product_inputs_service_stub.logger(stub: true)&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+ end
174
+
175
+ ##
176
+ # The logger used for request/response debug logging.
177
+ #
178
+ # @return [Logger]
179
+ #
180
+ def logger
181
+ @css_product_inputs_service_stub.logger
160
182
  end
161
183
 
162
184
  # Service calls
@@ -190,11 +212,13 @@ module Google
190
212
  # @param css_product_input [::Google::Shopping::Css::V1::CssProductInput, ::Hash]
191
213
  # Required. The CSS Product Input to insert.
192
214
  # @param feed_id [::Integer]
193
- # Required. The primary or supplemental feed id. If CSS Product already
194
- # exists and feed id provided is different, then the CSS Product will be
195
- # moved to a new feed. Note: For now, CSSs do not need to provide feed ids as
196
- # we create feeds on the fly. We do not have supplemental feed support for
197
- # CSS Products yet.
215
+ # Optional. DEPRECATED. Feed id is not required for CSS Products.
216
+ # The primary or supplemental feed id. If CSS Product already exists and
217
+ # feed id provided is different, then the CSS Product will be moved to a
218
+ # new feed.
219
+ # Note: For now, CSSs do not need to provide feed ids as we create
220
+ # feeds on the fly.
221
+ # We do not have supplemental feed support for CSS Products yet.
198
222
  # @yield [result, operation] Access the result along with the TransportOperation object
199
223
  # @yieldparam result [::Google::Shopping::Css::V1::CssProductInput]
200
224
  # @yieldparam operation [::Gapic::Rest::TransportOperation]
@@ -248,7 +272,105 @@ module Google
248
272
 
249
273
  @css_product_inputs_service_stub.insert_css_product_input request, options do |result, operation|
250
274
  yield result, operation if block_given?
251
- return result
275
+ end
276
+ rescue ::Gapic::Rest::Error => e
277
+ raise ::Google::Cloud::Error.from_error(e)
278
+ end
279
+
280
+ ##
281
+ # Updates the existing Css Product input in your CSS Center account.
282
+ #
283
+ # After inserting, updating, or deleting a CSS Product input, it may take
284
+ # several minutes before the processed Css Product can be retrieved.
285
+ #
286
+ # @overload update_css_product_input(request, options = nil)
287
+ # Pass arguments to `update_css_product_input` via a request object, either of type
288
+ # {::Google::Shopping::Css::V1::UpdateCssProductInputRequest} or an equivalent Hash.
289
+ #
290
+ # @param request [::Google::Shopping::Css::V1::UpdateCssProductInputRequest, ::Hash]
291
+ # A request object representing the call parameters. Required. To specify no
292
+ # parameters, or to keep all the default parameter values, pass an empty Hash.
293
+ # @param options [::Gapic::CallOptions, ::Hash]
294
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
295
+ #
296
+ # @overload update_css_product_input(css_product_input: nil, update_mask: nil)
297
+ # Pass arguments to `update_css_product_input` via keyword arguments. Note that at
298
+ # least one keyword argument is required. To specify no parameters, or to keep all
299
+ # the default parameter values, pass an empty Hash as a request object (see above).
300
+ #
301
+ # @param css_product_input [::Google::Shopping::Css::V1::CssProductInput, ::Hash]
302
+ # Required. The CSS product input resource to update. Information you submit
303
+ # will be applied to the processed CSS product as well.
304
+ # @param update_mask [::Google::Protobuf::FieldMask, ::Hash]
305
+ # The list of CSS product attributes to be updated.
306
+ #
307
+ # If the update mask is omitted, then it is treated as implied field mask
308
+ # equivalent to all fields that are populated (have a non-empty value).
309
+ #
310
+ # Attributes specified in the update mask without a value specified in the
311
+ # body will be deleted from the CSS product.
312
+ #
313
+ # Update mask can only be specified for top level fields in
314
+ # attributes and custom attributes.
315
+ #
316
+ # To specify the update mask for custom attributes you need to add the
317
+ # `custom_attribute.` prefix.
318
+ #
319
+ # Providing special "*" value for full CSS product replacement is not
320
+ # supported.
321
+ # @yield [result, operation] Access the result along with the TransportOperation object
322
+ # @yieldparam result [::Google::Shopping::Css::V1::CssProductInput]
323
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
324
+ #
325
+ # @return [::Google::Shopping::Css::V1::CssProductInput]
326
+ #
327
+ # @raise [::Google::Cloud::Error] if the REST call is aborted.
328
+ #
329
+ # @example Basic example
330
+ # require "google/shopping/css/v1"
331
+ #
332
+ # # Create a client object. The client can be reused for multiple calls.
333
+ # client = Google::Shopping::Css::V1::CssProductInputsService::Rest::Client.new
334
+ #
335
+ # # Create a request. To set request fields, pass in keyword arguments.
336
+ # request = Google::Shopping::Css::V1::UpdateCssProductInputRequest.new
337
+ #
338
+ # # Call the update_css_product_input method.
339
+ # result = client.update_css_product_input request
340
+ #
341
+ # # The returned object is of type Google::Shopping::Css::V1::CssProductInput.
342
+ # p result
343
+ #
344
+ def update_css_product_input request, options = nil
345
+ raise ::ArgumentError, "request must be provided" if request.nil?
346
+
347
+ request = ::Gapic::Protobuf.coerce request, to: ::Google::Shopping::Css::V1::UpdateCssProductInputRequest
348
+
349
+ # Converts hash and nil to an options object
350
+ options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h
351
+
352
+ # Customize the options with defaults
353
+ call_metadata = @config.rpcs.update_css_product_input.metadata.to_h
354
+
355
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
356
+ call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
357
+ lib_name: @config.lib_name, lib_version: @config.lib_version,
358
+ gapic_version: ::Google::Shopping::Css::V1::VERSION,
359
+ transports_version_send: [:rest]
360
+
361
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
362
+ call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
363
+
364
+ options.apply_defaults timeout: @config.rpcs.update_css_product_input.timeout,
365
+ metadata: call_metadata,
366
+ retry_policy: @config.rpcs.update_css_product_input.retry_policy
367
+
368
+ options.apply_defaults timeout: @config.timeout,
369
+ metadata: @config.metadata,
370
+ retry_policy: @config.retry_policy
371
+
372
+ @css_product_inputs_service_stub.update_css_product_input request, options do |result, operation|
373
+ yield result, operation if block_given?
252
374
  end
253
375
  rescue ::Gapic::Rest::Error => e
254
376
  raise ::Google::Cloud::Error.from_error(e)
@@ -336,7 +458,6 @@ module Google
336
458
 
337
459
  @css_product_inputs_service_stub.delete_css_product_input request, options do |result, operation|
338
460
  yield result, operation if block_given?
339
- return result
340
461
  end
341
462
  rescue ::Gapic::Rest::Error => e
342
463
  raise ::Google::Cloud::Error.from_error(e)
@@ -416,6 +537,11 @@ module Google
416
537
  # default endpoint URL. The default value of nil uses the environment
417
538
  # universe (usually the default "googleapis.com" universe).
418
539
  # @return [::String,nil]
540
+ # @!attribute [rw] logger
541
+ # A custom logger to use for request/response debug logging, or the value
542
+ # `:default` (the default) to construct a default logger, or `nil` to
543
+ # explicitly disable logging.
544
+ # @return [::Logger,:default,nil]
419
545
  #
420
546
  class Configuration
421
547
  extend ::Gapic::Config
@@ -437,6 +563,7 @@ module Google
437
563
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
438
564
  config_attr :quota_project, nil, ::String, nil
439
565
  config_attr :universe_domain, nil, ::String, nil
566
+ config_attr :logger, :default, ::Logger, nil, :default
440
567
 
441
568
  # @private
442
569
  def initialize parent_config = nil
@@ -481,6 +608,11 @@ module Google
481
608
  #
482
609
  attr_reader :insert_css_product_input
483
610
  ##
611
+ # RPC-specific configuration for `update_css_product_input`
612
+ # @return [::Gapic::Config::Method]
613
+ #
614
+ attr_reader :update_css_product_input
615
+ ##
484
616
  # RPC-specific configuration for `delete_css_product_input`
485
617
  # @return [::Gapic::Config::Method]
486
618
  #
@@ -490,6 +622,8 @@ module Google
490
622
  def initialize parent_rpcs = nil
491
623
  insert_css_product_input_config = parent_rpcs.insert_css_product_input if parent_rpcs.respond_to? :insert_css_product_input
492
624
  @insert_css_product_input = ::Gapic::Config::Method.new insert_css_product_input_config
625
+ update_css_product_input_config = parent_rpcs.update_css_product_input if parent_rpcs.respond_to? :update_css_product_input
626
+ @update_css_product_input = ::Gapic::Config::Method.new update_css_product_input_config
493
627
  delete_css_product_input_config = parent_rpcs.delete_css_product_input if parent_rpcs.respond_to? :delete_css_product_input
494
628
  @delete_css_product_input = ::Gapic::Config::Method.new delete_css_product_input_config
495
629
 
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the insert_css_product_input REST call
66
78
  #
@@ -87,16 +99,58 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "insert_css_product_input",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Shopping::Css::V1::CssProductInput.decode_json response.body, ignore_unknown_fields: true
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
114
+ end
115
+
116
+ ##
117
+ # Baseline implementation for the update_css_product_input REST call
118
+ #
119
+ # @param request_pb [::Google::Shopping::Css::V1::UpdateCssProductInputRequest]
120
+ # A request object representing the call parameters. Required.
121
+ # @param options [::Gapic::CallOptions]
122
+ # Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
123
+ #
124
+ # @yield [result, operation] Access the result along with the TransportOperation object
125
+ # @yieldparam result [::Google::Shopping::Css::V1::CssProductInput]
126
+ # @yieldparam operation [::Gapic::Rest::TransportOperation]
127
+ #
128
+ # @return [::Google::Shopping::Css::V1::CssProductInput]
129
+ # A result object deserialized from the server's reply
130
+ def update_css_product_input request_pb, options = nil
131
+ raise ::ArgumentError, "request must be provided" if request_pb.nil?
132
+
133
+ verb, uri, query_string_params, body = ServiceStub.transcode_update_css_product_input_request request_pb
134
+ query_string_params = if query_string_params.any?
135
+ query_string_params.to_h { |p| p.split "=", 2 }
136
+ else
137
+ {}
138
+ end
97
139
 
98
- yield result, operation if block_given?
99
- result
140
+ response = @client_stub.make_http_request(
141
+ verb,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "update_css_product_input",
146
+ options: options
147
+ )
148
+ operation = ::Gapic::Rest::TransportOperation.new response
149
+ result = ::Google::Shopping::Css::V1::CssProductInput.decode_json response.body, ignore_unknown_fields: true
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
100
154
  end
101
155
 
102
156
  ##
@@ -125,16 +179,18 @@ module Google
125
179
 
126
180
  response = @client_stub.make_http_request(
127
181
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "delete_css_product_input",
131
186
  options: options
132
187
  )
133
188
  operation = ::Gapic::Rest::TransportOperation.new response
134
189
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
138
194
  end
139
195
 
140
196
  ##
@@ -159,6 +215,28 @@ module Google
159
215
  transcoder.transcode request_pb
160
216
  end
161
217
 
218
+ ##
219
+ # @private
220
+ #
221
+ # GRPC transcoding helper method for the update_css_product_input REST call
222
+ #
223
+ # @param request_pb [::Google::Shopping::Css::V1::UpdateCssProductInputRequest]
224
+ # A request object representing the call parameters. Required.
225
+ # @return [Array(String, [String, nil], Hash{String => String})]
226
+ # Uri, Body, Query string parameters
227
+ def self.transcode_update_css_product_input_request request_pb
228
+ transcoder = Gapic::Rest::GrpcTranscoder.new
229
+ .with_bindings(
230
+ uri_method: :patch,
231
+ uri_template: "/v1/{css_product_input.name}",
232
+ body: "css_product_input",
233
+ matches: [
234
+ ["css_product_input.name", %r{^accounts/[^/]+/cssProductInputs/[^/]+/?$}, false]
235
+ ]
236
+ )
237
+ transcoder.transcode request_pb
238
+ end
239
+
162
240
  ##
163
241
  # @private
164
242
  #
@@ -41,6 +41,11 @@ module Google
41
41
  # After inserting, updating, or deleting a CSS Product input, it may
42
42
  # take several minutes before the processed CSS Product can be retrieved.
43
43
  rpc :InsertCssProductInput, ::Google::Shopping::Css::V1::InsertCssProductInputRequest, ::Google::Shopping::Css::V1::CssProductInput
44
+ # Updates the existing Css Product input in your CSS Center account.
45
+ #
46
+ # After inserting, updating, or deleting a CSS Product input, it may take
47
+ # several minutes before the processed Css Product can be retrieved.
48
+ rpc :UpdateCssProductInput, ::Google::Shopping::Css::V1::UpdateCssProductInputRequest, ::Google::Shopping::Css::V1::CssProductInput
44
49
  # Deletes a CSS Product input from your CSS Center account.
45
50
  #
46
51
  # After a delete it may take several minutes until the input is no longer