google-shopping-css-v1 0.2.1 → 0.4.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 (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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b746bf5a019a61dd551fc2cd593a1c574a148ecbfd870f346dad31250f80ad7
4
- data.tar.gz: bcdcd37bebf4616bfe69b8dc51cc0de71b4c02f68fe5d9f47ea679a2d45eebbd
3
+ metadata.gz: 74e07f8af0e05f619c3cbf836670f92333732648d9cfe477326c016561b21aaf
4
+ data.tar.gz: 755475619e401b0041e55f58cd585ffc9321b8a2e22622e9a8fbcd3143fbfc65
5
5
  SHA512:
6
- metadata.gz: e67711ee9ff45e23ac4800bd2f0e9a3abf66bf43392b81e8b840f2cc7fd984d1997b141a83b3878a465f81686da82d306092eb8dd95da3260136024680697993
7
- data.tar.gz: 952a4ac7432afe7038beee56152ea69ec515ea6b848eab098e46a6f6492965d23f2096a019836df11ef386b956f12361d540158188b95516f34e27dfa3e315ae
6
+ metadata.gz: ff70dc1139a76630602a3525ea5f4482c6f26b5e06ac1ce6cabeffbd59145404a2de5f94ebb980d77c26db4f1c8e9b5f187fb1f52c59d5fa656e998907232c74
7
+ data.tar.gz: 514fd167c5375f08e9a7e6c347d6b96d229f2258d0e7e63cd8bdd08fb08340a16c7fc57476b7dd0322c675c129e9cc76ccf888b9145b738977a94e640c58329a
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://developers.google.com/comparison-shopping-services/api)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/shopping/css/v1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Shopping::Css::V1::AccountsService::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -168,8 +168,28 @@ module Google
168
168
  universe_domain: @config.universe_domain,
169
169
  channel_args: @config.channel_args,
170
170
  interceptors: @config.interceptors,
171
- channel_pool_config: @config.channel_pool
171
+ channel_pool_config: @config.channel_pool,
172
+ logger: @config.logger
172
173
  )
174
+
175
+ @account_labels_service_stub.stub_logger&.info do |entry|
176
+ entry.set_system_name
177
+ entry.set_service
178
+ entry.message = "Created client for #{entry.service}"
179
+ entry.set_credentials_fields credentials
180
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
181
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
182
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
183
+ end
184
+ end
185
+
186
+ ##
187
+ # The logger used for request/response debug logging.
188
+ #
189
+ # @return [Logger]
190
+ #
191
+ def logger
192
+ @account_labels_service_stub.logger
173
193
  end
174
194
 
175
195
  # Service calls
@@ -271,7 +291,7 @@ module Google
271
291
  @account_labels_service_stub.call_rpc :list_account_labels, request, options: options do |response, operation|
272
292
  response = ::Gapic::PagedEnumerable.new @account_labels_service_stub, :list_account_labels, request, response, operation, options
273
293
  yield response, operation if block_given?
274
- return response
294
+ throw :response, response
275
295
  end
276
296
  rescue ::GRPC::BadStatus => e
277
297
  raise ::Google::Cloud::Error.from_error(e)
@@ -360,7 +380,6 @@ module Google
360
380
 
361
381
  @account_labels_service_stub.call_rpc :create_account_label, request, options: options do |response, operation|
362
382
  yield response, operation if block_given?
363
- return response
364
383
  end
365
384
  rescue ::GRPC::BadStatus => e
366
385
  raise ::Google::Cloud::Error.from_error(e)
@@ -446,7 +465,6 @@ module Google
446
465
 
447
466
  @account_labels_service_stub.call_rpc :update_account_label, request, options: options do |response, operation|
448
467
  yield response, operation if block_given?
449
- return response
450
468
  end
451
469
  rescue ::GRPC::BadStatus => e
452
470
  raise ::Google::Cloud::Error.from_error(e)
@@ -533,7 +551,6 @@ module Google
533
551
 
534
552
  @account_labels_service_stub.call_rpc :delete_account_label, request, options: options do |response, operation|
535
553
  yield response, operation if block_given?
536
- return response
537
554
  end
538
555
  rescue ::GRPC::BadStatus => e
539
556
  raise ::Google::Cloud::Error.from_error(e)
@@ -622,6 +639,11 @@ module Google
622
639
  # default endpoint URL. The default value of nil uses the environment
623
640
  # universe (usually the default "googleapis.com" universe).
624
641
  # @return [::String,nil]
642
+ # @!attribute [rw] logger
643
+ # A custom logger to use for request/response debug logging, or the value
644
+ # `:default` (the default) to construct a default logger, or `nil` to
645
+ # explicitly disable logging.
646
+ # @return [::Logger,:default,nil]
625
647
  #
626
648
  class Configuration
627
649
  extend ::Gapic::Config
@@ -646,6 +668,7 @@ module Google
646
668
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
647
669
  config_attr :quota_project, nil, ::String, nil
648
670
  config_attr :universe_domain, nil, ::String, nil
671
+ config_attr :logger, :default, ::Logger, nil, :default
649
672
 
650
673
  # @private
651
674
  def initialize parent_config = nil
@@ -161,8 +161,28 @@ module Google
161
161
  endpoint: @config.endpoint,
162
162
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
163
  universe_domain: @config.universe_domain,
164
- credentials: credentials
164
+ credentials: credentials,
165
+ logger: @config.logger
165
166
  )
167
+
168
+ @account_labels_service_stub.logger(stub: true)&.info do |entry|
169
+ entry.set_system_name
170
+ entry.set_service
171
+ entry.message = "Created client for #{entry.service}"
172
+ entry.set_credentials_fields credentials
173
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
174
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
175
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
176
+ end
177
+ end
178
+
179
+ ##
180
+ # The logger used for request/response debug logging.
181
+ #
182
+ # @return [Logger]
183
+ #
184
+ def logger
185
+ @account_labels_service_stub.logger
166
186
  end
167
187
 
168
188
  # Service calls
@@ -257,7 +277,7 @@ module Google
257
277
  @account_labels_service_stub.list_account_labels request, options do |result, operation|
258
278
  result = ::Gapic::Rest::PagedEnumerable.new @account_labels_service_stub, :list_account_labels, "account_labels", request, result, options
259
279
  yield result, operation if block_given?
260
- return result
280
+ throw :response, result
261
281
  end
262
282
  rescue ::Gapic::Rest::Error => e
263
283
  raise ::Google::Cloud::Error.from_error(e)
@@ -339,7 +359,6 @@ module Google
339
359
 
340
360
  @account_labels_service_stub.create_account_label request, options do |result, operation|
341
361
  yield result, operation if block_given?
342
- return result
343
362
  end
344
363
  rescue ::Gapic::Rest::Error => e
345
364
  raise ::Google::Cloud::Error.from_error(e)
@@ -418,7 +437,6 @@ module Google
418
437
 
419
438
  @account_labels_service_stub.update_account_label request, options do |result, operation|
420
439
  yield result, operation if block_given?
421
- return result
422
440
  end
423
441
  rescue ::Gapic::Rest::Error => e
424
442
  raise ::Google::Cloud::Error.from_error(e)
@@ -498,7 +516,6 @@ module Google
498
516
 
499
517
  @account_labels_service_stub.delete_account_label request, options do |result, operation|
500
518
  yield result, operation if block_given?
501
- return result
502
519
  end
503
520
  rescue ::Gapic::Rest::Error => e
504
521
  raise ::Google::Cloud::Error.from_error(e)
@@ -578,6 +595,11 @@ module Google
578
595
  # default endpoint URL. The default value of nil uses the environment
579
596
  # universe (usually the default "googleapis.com" universe).
580
597
  # @return [::String,nil]
598
+ # @!attribute [rw] logger
599
+ # A custom logger to use for request/response debug logging, or the value
600
+ # `:default` (the default) to construct a default logger, or `nil` to
601
+ # explicitly disable logging.
602
+ # @return [::Logger,:default,nil]
581
603
  #
582
604
  class Configuration
583
605
  extend ::Gapic::Config
@@ -599,6 +621,7 @@ module Google
599
621
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
600
622
  config_attr :quota_project, nil, ::String, nil
601
623
  config_attr :universe_domain, nil, ::String, nil
624
+ config_attr :logger, :default, ::Logger, nil, :default
602
625
 
603
626
  # @private
604
627
  def initialize parent_config = nil
@@ -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 list_account_labels REST call
66
78
  #
@@ -87,16 +99,18 @@ 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: "list_account_labels",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Shopping::Css::V1::ListAccountLabelsResponse.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "create_account_label",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Shopping::Css::V1::AccountLabel.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -163,16 +179,18 @@ module Google
163
179
 
164
180
  response = @client_stub.make_http_request(
165
181
  verb,
166
- uri: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "update_account_label",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Shopping::Css::V1::AccountLabel.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
176
194
  end
177
195
 
178
196
  ##
@@ -201,16 +219,18 @@ module Google
201
219
 
202
220
  response = @client_stub.make_http_request(
203
221
  verb,
204
- uri: uri,
205
- body: body || "",
206
- params: query_string_params,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "delete_account_label",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
211
-
212
- yield result, operation if block_given?
213
- result
230
+ catch :response do
231
+ yield result, operation if block_given?
232
+ result
233
+ end
214
234
  end
215
235
 
216
236
  ##
@@ -169,8 +169,28 @@ module Google
169
169
  universe_domain: @config.universe_domain,
170
170
  channel_args: @config.channel_args,
171
171
  interceptors: @config.interceptors,
172
- channel_pool_config: @config.channel_pool
172
+ channel_pool_config: @config.channel_pool,
173
+ logger: @config.logger
173
174
  )
175
+
176
+ @accounts_service_stub.stub_logger&.info do |entry|
177
+ entry.set_system_name
178
+ entry.set_service
179
+ entry.message = "Created client for #{entry.service}"
180
+ entry.set_credentials_fields credentials
181
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
182
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
183
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
184
+ end
185
+ end
186
+
187
+ ##
188
+ # The logger used for request/response debug logging.
189
+ #
190
+ # @return [Logger]
191
+ #
192
+ def logger
193
+ @accounts_service_stub.logger
174
194
  end
175
195
 
176
196
  # Service calls
@@ -205,8 +225,8 @@ module Google
205
225
  # @param page_size [::Integer]
206
226
  # Optional. The maximum number of accounts to return. The service may return
207
227
  # fewer than this value. If unspecified, at most 50 accounts will be
208
- # returned. The maximum value is 1000; values above 1000 will be coerced to
209
- # 1000.
228
+ # returned. The maximum value is 100; values above 100 will be coerced to
229
+ # 100.
210
230
  # @param page_token [::String]
211
231
  # Optional. A page token, received from a previous `ListChildAccounts` call.
212
232
  # Provide this to retrieve the subsequent page.
@@ -278,7 +298,7 @@ module Google
278
298
  @accounts_service_stub.call_rpc :list_child_accounts, request, options: options do |response, operation|
279
299
  response = ::Gapic::PagedEnumerable.new @accounts_service_stub, :list_child_accounts, request, response, operation, options
280
300
  yield response, operation if block_given?
281
- return response
301
+ throw :response, response
282
302
  end
283
303
  rescue ::GRPC::BadStatus => e
284
304
  raise ::Google::Cloud::Error.from_error(e)
@@ -369,7 +389,6 @@ module Google
369
389
 
370
390
  @accounts_service_stub.call_rpc :get_account, request, options: options do |response, operation|
371
391
  yield response, operation if block_given?
372
- return response
373
392
  end
374
393
  rescue ::GRPC::BadStatus => e
375
394
  raise ::Google::Cloud::Error.from_error(e)
@@ -463,7 +482,6 @@ module Google
463
482
 
464
483
  @accounts_service_stub.call_rpc :update_labels, request, options: options do |response, operation|
465
484
  yield response, operation if block_given?
466
- return response
467
485
  end
468
486
  rescue ::GRPC::BadStatus => e
469
487
  raise ::Google::Cloud::Error.from_error(e)
@@ -552,6 +570,11 @@ module Google
552
570
  # default endpoint URL. The default value of nil uses the environment
553
571
  # universe (usually the default "googleapis.com" universe).
554
572
  # @return [::String,nil]
573
+ # @!attribute [rw] logger
574
+ # A custom logger to use for request/response debug logging, or the value
575
+ # `:default` (the default) to construct a default logger, or `nil` to
576
+ # explicitly disable logging.
577
+ # @return [::Logger,:default,nil]
555
578
  #
556
579
  class Configuration
557
580
  extend ::Gapic::Config
@@ -576,6 +599,7 @@ module Google
576
599
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
577
600
  config_attr :quota_project, nil, ::String, nil
578
601
  config_attr :universe_domain, nil, ::String, nil
602
+ config_attr :logger, :default, ::Logger, nil, :default
579
603
 
580
604
  # @private
581
605
  def initialize parent_config = nil
@@ -162,8 +162,28 @@ module Google
162
162
  endpoint: @config.endpoint,
163
163
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
164
164
  universe_domain: @config.universe_domain,
165
- credentials: credentials
165
+ credentials: credentials,
166
+ logger: @config.logger
166
167
  )
168
+
169
+ @accounts_service_stub.logger(stub: true)&.info do |entry|
170
+ entry.set_system_name
171
+ entry.set_service
172
+ entry.message = "Created client for #{entry.service}"
173
+ entry.set_credentials_fields credentials
174
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
175
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
176
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
177
+ end
178
+ end
179
+
180
+ ##
181
+ # The logger used for request/response debug logging.
182
+ #
183
+ # @return [Logger]
184
+ #
185
+ def logger
186
+ @accounts_service_stub.logger
167
187
  end
168
188
 
169
189
  # Service calls
@@ -198,8 +218,8 @@ module Google
198
218
  # @param page_size [::Integer]
199
219
  # Optional. The maximum number of accounts to return. The service may return
200
220
  # fewer than this value. If unspecified, at most 50 accounts will be
201
- # returned. The maximum value is 1000; values above 1000 will be coerced to
202
- # 1000.
221
+ # returned. The maximum value is 100; values above 100 will be coerced to
222
+ # 100.
203
223
  # @param page_token [::String]
204
224
  # Optional. A page token, received from a previous `ListChildAccounts` call.
205
225
  # Provide this to retrieve the subsequent page.
@@ -264,7 +284,7 @@ module Google
264
284
  @accounts_service_stub.list_child_accounts request, options do |result, operation|
265
285
  result = ::Gapic::Rest::PagedEnumerable.new @accounts_service_stub, :list_child_accounts, "accounts", request, result, options
266
286
  yield result, operation if block_given?
267
- return result
287
+ throw :response, result
268
288
  end
269
289
  rescue ::Gapic::Rest::Error => e
270
290
  raise ::Google::Cloud::Error.from_error(e)
@@ -348,7 +368,6 @@ module Google
348
368
 
349
369
  @accounts_service_stub.get_account request, options do |result, operation|
350
370
  yield result, operation if block_given?
351
- return result
352
371
  end
353
372
  rescue ::Gapic::Rest::Error => e
354
373
  raise ::Google::Cloud::Error.from_error(e)
@@ -435,7 +454,6 @@ module Google
435
454
 
436
455
  @accounts_service_stub.update_labels request, options do |result, operation|
437
456
  yield result, operation if block_given?
438
- return result
439
457
  end
440
458
  rescue ::Gapic::Rest::Error => e
441
459
  raise ::Google::Cloud::Error.from_error(e)
@@ -515,6 +533,11 @@ module Google
515
533
  # default endpoint URL. The default value of nil uses the environment
516
534
  # universe (usually the default "googleapis.com" universe).
517
535
  # @return [::String,nil]
536
+ # @!attribute [rw] logger
537
+ # A custom logger to use for request/response debug logging, or the value
538
+ # `:default` (the default) to construct a default logger, or `nil` to
539
+ # explicitly disable logging.
540
+ # @return [::Logger,:default,nil]
518
541
  #
519
542
  class Configuration
520
543
  extend ::Gapic::Config
@@ -536,6 +559,7 @@ module Google
536
559
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
537
560
  config_attr :quota_project, nil, ::String, nil
538
561
  config_attr :universe_domain, nil, ::String, nil
562
+ config_attr :logger, :default, ::Logger, nil, :default
539
563
 
540
564
  # @private
541
565
  def initialize parent_config = nil
@@ -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 list_child_accounts REST call
66
78
  #
@@ -87,16 +99,18 @@ 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: "list_child_accounts",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Shopping::Css::V1::ListChildAccountsResponse.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "get_account",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Shopping::Css::V1::Account.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -163,16 +179,18 @@ module Google
163
179
 
164
180
  response = @client_stub.make_http_request(
165
181
  verb,
166
- uri: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "update_labels",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Shopping::Css::V1::Account.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
176
194
  end
177
195
 
178
196
  ##