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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +30 -20
  3. data/lib/google/shopping/merchant/accounts/v1beta/account_issue_service/client.rb +28 -2
  4. data/lib/google/shopping/merchant/accounts/v1beta/account_issue_service/rest/client.rb +28 -2
  5. data/lib/google/shopping/merchant/accounts/v1beta/account_issue_service/rest/service_stub.rb +22 -8
  6. data/lib/google/shopping/merchant/accounts/v1beta/account_tax_service/client.rb +28 -4
  7. data/lib/google/shopping/merchant/accounts/v1beta/account_tax_service/rest/client.rb +28 -4
  8. data/lib/google/shopping/merchant/accounts/v1beta/account_tax_service/rest/service_stub.rb +38 -20
  9. data/lib/google/shopping/merchant/accounts/v1beta/accounts_service/client.rb +29 -7
  10. data/lib/google/shopping/merchant/accounts/v1beta/accounts_service/rest/client.rb +29 -7
  11. data/lib/google/shopping/merchant/accounts/v1beta/accounts_service/rest/service_stub.rb +62 -38
  12. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/client.rb +27 -3
  13. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/rest/client.rb +27 -3
  14. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/rest/service_stub.rb +30 -14
  15. data/lib/google/shopping/merchant/accounts/v1beta/business_identity_service/client.rb +27 -3
  16. data/lib/google/shopping/merchant/accounts/v1beta/business_identity_service/rest/client.rb +27 -3
  17. data/lib/google/shopping/merchant/accounts/v1beta/business_identity_service/rest/service_stub.rb +30 -14
  18. data/lib/google/shopping/merchant/accounts/v1beta/business_info_service/client.rb +27 -3
  19. data/lib/google/shopping/merchant/accounts/v1beta/business_info_service/rest/client.rb +27 -3
  20. data/lib/google/shopping/merchant/accounts/v1beta/business_info_service/rest/service_stub.rb +30 -14
  21. data/lib/google/shopping/merchant/accounts/v1beta/email_preferences_service/client.rb +27 -3
  22. data/lib/google/shopping/merchant/accounts/v1beta/email_preferences_service/rest/client.rb +27 -3
  23. data/lib/google/shopping/merchant/accounts/v1beta/email_preferences_service/rest/service_stub.rb +30 -14
  24. data/lib/google/shopping/merchant/accounts/v1beta/homepage_service/client.rb +27 -5
  25. data/lib/google/shopping/merchant/accounts/v1beta/homepage_service/rest/client.rb +27 -5
  26. data/lib/google/shopping/merchant/accounts/v1beta/homepage_service/rest/service_stub.rb +46 -26
  27. data/lib/google/shopping/merchant/accounts/v1beta/online_return_policy_service/client.rb +28 -3
  28. data/lib/google/shopping/merchant/accounts/v1beta/online_return_policy_service/rest/client.rb +28 -3
  29. data/lib/google/shopping/merchant/accounts/v1beta/online_return_policy_service/rest/service_stub.rb +30 -14
  30. data/lib/google/shopping/merchant/accounts/v1beta/programs_service/client.rb +28 -5
  31. data/lib/google/shopping/merchant/accounts/v1beta/programs_service/rest/client.rb +28 -5
  32. data/lib/google/shopping/merchant/accounts/v1beta/programs_service/rest/service_stub.rb +46 -26
  33. data/lib/google/shopping/merchant/accounts/v1beta/regions_service/client.rb +28 -6
  34. data/lib/google/shopping/merchant/accounts/v1beta/regions_service/rest/client.rb +28 -6
  35. data/lib/google/shopping/merchant/accounts/v1beta/regions_service/rest/service_stub.rb +54 -32
  36. data/lib/google/shopping/merchant/accounts/v1beta/shipping_settings_service/client.rb +27 -3
  37. data/lib/google/shopping/merchant/accounts/v1beta/shipping_settings_service/rest/client.rb +27 -3
  38. data/lib/google/shopping/merchant/accounts/v1beta/shipping_settings_service/rest/service_stub.rb +30 -14
  39. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_agreement_state_service/client.rb +27 -3
  40. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_agreement_state_service/rest/client.rb +27 -3
  41. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_agreement_state_service/rest/service_stub.rb +30 -14
  42. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_service/client.rb +27 -4
  43. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_service/rest/client.rb +27 -4
  44. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_service/rest/service_stub.rb +38 -20
  45. data/lib/google/shopping/merchant/accounts/v1beta/user_service/client.rb +28 -6
  46. data/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/client.rb +28 -6
  47. data/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb +54 -32
  48. data/lib/google/shopping/merchant/accounts/v1beta/version.rb +1 -1
  49. data/proto_docs/google/api/client.rb +39 -0
  50. metadata +5 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e2f6f2338a43af794906b544cfc9d5abe09aa175edf87335054bcc1359a1298b
4
- data.tar.gz: 8c7c247795eac76c10ea0c537dde90dfe31434d0eaa14f28336a79cd280cace8
3
+ metadata.gz: 6915e815f2e5bd835a5c3fdaa7bf35659bf51105b52d7792711f85c53def0eb5
4
+ data.tar.gz: b770db28737f35e302053038b4a5a3b59b15f76ae4edeac8c5cb67a24214f9a1
5
5
  SHA512:
6
- metadata.gz: b07e40eb9ab09551f949108c9032d91c82803d24ccd767182ed6799ec3ed24d3baf27c90adc0497323adfade1046d79b43f2c1dc6db2506923c93ac7b7e36a60
7
- data.tar.gz: b4a6ead03463b7df794d0fb447eefa0badb2919d9f999a6358843c4612d8d3ea62a6536e80f87d84965dc89321683874458c0114f3b7be5f59afb6953a3eb627
6
+ metadata.gz: 9c41dde993a8233da09e8da48237e242d84ad3677d37030e779a73fcf2f2365414ec01a585078bb97d1729af2d9bbb6b0e700e2b7a03705e9f63d417f14f555f
7
+ data.tar.gz: bb32b5d841f840958ba05cd83ca88ddf340643e0fc1c9fd90cef95211a46d17a33e457584dc92bff747ad30cf57f6978903f1a5a3d3f358ddc263b192e4c74ec
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://developers.google.com/merchant/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/merchant/accounts/v1beta"
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::Merchant::Accounts::V1beta::AccountTaxService::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).
@@ -163,8 +163,28 @@ module Google
163
163
  universe_domain: @config.universe_domain,
164
164
  channel_args: @config.channel_args,
165
165
  interceptors: @config.interceptors,
166
- channel_pool_config: @config.channel_pool
166
+ channel_pool_config: @config.channel_pool,
167
+ logger: @config.logger
167
168
  )
169
+
170
+ @account_issue_service_stub.stub_logger&.info do |entry|
171
+ entry.set_system_name
172
+ entry.set_service
173
+ entry.message = "Created client for #{entry.service}"
174
+ entry.set_credentials_fields credentials
175
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
176
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
177
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
178
+ end
179
+ end
180
+
181
+ ##
182
+ # The logger used for request/response debug logging.
183
+ #
184
+ # @return [Logger]
185
+ #
186
+ def logger
187
+ @account_issue_service_stub.logger
168
188
  end
169
189
 
170
190
  # Service calls
@@ -274,7 +294,7 @@ module Google
274
294
  @account_issue_service_stub.call_rpc :list_account_issues, request, options: options do |response, operation|
275
295
  response = ::Gapic::PagedEnumerable.new @account_issue_service_stub, :list_account_issues, request, response, operation, options
276
296
  yield response, operation if block_given?
277
- return response
297
+ throw :response, response
278
298
  end
279
299
  rescue ::GRPC::BadStatus => e
280
300
  raise ::Google::Cloud::Error.from_error(e)
@@ -363,6 +383,11 @@ module Google
363
383
  # default endpoint URL. The default value of nil uses the environment
364
384
  # universe (usually the default "googleapis.com" universe).
365
385
  # @return [::String,nil]
386
+ # @!attribute [rw] logger
387
+ # A custom logger to use for request/response debug logging, or the value
388
+ # `:default` (the default) to construct a default logger, or `nil` to
389
+ # explicitly disable logging.
390
+ # @return [::Logger,:default,nil]
366
391
  #
367
392
  class Configuration
368
393
  extend ::Gapic::Config
@@ -387,6 +412,7 @@ module Google
387
412
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
388
413
  config_attr :quota_project, nil, ::String, nil
389
414
  config_attr :universe_domain, nil, ::String, nil
415
+ config_attr :logger, :default, ::Logger, nil, :default
390
416
 
391
417
  # @private
392
418
  def initialize parent_config = nil
@@ -156,8 +156,28 @@ module Google
156
156
  endpoint: @config.endpoint,
157
157
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
158
158
  universe_domain: @config.universe_domain,
159
- credentials: credentials
159
+ credentials: credentials,
160
+ logger: @config.logger
160
161
  )
162
+
163
+ @account_issue_service_stub.logger(stub: true)&.info do |entry|
164
+ entry.set_system_name
165
+ entry.set_service
166
+ entry.message = "Created client for #{entry.service}"
167
+ entry.set_credentials_fields credentials
168
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
169
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
170
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
171
+ end
172
+ end
173
+
174
+ ##
175
+ # The logger used for request/response debug logging.
176
+ #
177
+ # @return [Logger]
178
+ #
179
+ def logger
180
+ @account_issue_service_stub.logger
161
181
  end
162
182
 
163
183
  # Service calls
@@ -260,7 +280,7 @@ module Google
260
280
  @account_issue_service_stub.list_account_issues request, options do |result, operation|
261
281
  result = ::Gapic::Rest::PagedEnumerable.new @account_issue_service_stub, :list_account_issues, "account_issues", request, result, options
262
282
  yield result, operation if block_given?
263
- return result
283
+ throw :response, result
264
284
  end
265
285
  rescue ::Gapic::Rest::Error => e
266
286
  raise ::Google::Cloud::Error.from_error(e)
@@ -340,6 +360,11 @@ module Google
340
360
  # default endpoint URL. The default value of nil uses the environment
341
361
  # universe (usually the default "googleapis.com" universe).
342
362
  # @return [::String,nil]
363
+ # @!attribute [rw] logger
364
+ # A custom logger to use for request/response debug logging, or the value
365
+ # `:default` (the default) to construct a default logger, or `nil` to
366
+ # explicitly disable logging.
367
+ # @return [::Logger,:default,nil]
343
368
  #
344
369
  class Configuration
345
370
  extend ::Gapic::Config
@@ -361,6 +386,7 @@ module Google
361
386
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
362
387
  config_attr :quota_project, nil, ::String, nil
363
388
  config_attr :universe_domain, nil, ::String, nil
389
+ config_attr :logger, :default, ::Logger, nil, :default
364
390
 
365
391
  # @private
366
392
  def initialize parent_config = nil
@@ -31,7 +31,8 @@ module Google
31
31
  # including transcoding, making the REST call, and deserialing the response.
32
32
  #
33
33
  class ServiceStub
34
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
+ # @private
35
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
36
  # These require statements are intentionally placed here to initialize
36
37
  # the REST modules only when it's required.
37
38
  require "gapic/rest"
@@ -41,7 +42,9 @@ module Google
41
42
  universe_domain: universe_domain,
42
43
  credentials: credentials,
43
44
  numeric_enums: true,
44
- raise_faraday_errors: false
45
+ service_name: self.class,
46
+ raise_faraday_errors: false,
47
+ logger: logger
45
48
  end
46
49
 
47
50
  ##
@@ -62,6 +65,15 @@ module Google
62
65
  @client_stub.endpoint
63
66
  end
64
67
 
68
+ ##
69
+ # The logger used for request/response debug logging.
70
+ #
71
+ # @return [Logger]
72
+ #
73
+ def logger stub: false
74
+ stub ? @client_stub.stub_logger : @client_stub.logger
75
+ end
76
+
65
77
  ##
66
78
  # Baseline implementation for the list_account_issues REST call
67
79
  #
@@ -88,16 +100,18 @@ module Google
88
100
 
89
101
  response = @client_stub.make_http_request(
90
102
  verb,
91
- uri: uri,
92
- body: body || "",
93
- params: query_string_params,
103
+ uri: uri,
104
+ body: body || "",
105
+ params: query_string_params,
106
+ method_name: "list_account_issues",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ListAccountIssuesResponse.decode_json response.body, ignore_unknown_fields: true
98
-
99
- yield result, operation if block_given?
100
- result
111
+ catch :response do
112
+ yield result, operation if block_given?
113
+ result
114
+ end
101
115
  end
102
116
 
103
117
  ##
@@ -167,8 +167,28 @@ module Google
167
167
  universe_domain: @config.universe_domain,
168
168
  channel_args: @config.channel_args,
169
169
  interceptors: @config.interceptors,
170
- channel_pool_config: @config.channel_pool
170
+ channel_pool_config: @config.channel_pool,
171
+ logger: @config.logger
171
172
  )
173
+
174
+ @account_tax_service_stub.stub_logger&.info do |entry|
175
+ entry.set_system_name
176
+ entry.set_service
177
+ entry.message = "Created client for #{entry.service}"
178
+ entry.set_credentials_fields credentials
179
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
180
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
181
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
182
+ end
183
+ end
184
+
185
+ ##
186
+ # The logger used for request/response debug logging.
187
+ #
188
+ # @return [Logger]
189
+ #
190
+ def logger
191
+ @account_tax_service_stub.logger
172
192
  end
173
193
 
174
194
  # Service calls
@@ -253,7 +273,6 @@ module Google
253
273
 
254
274
  @account_tax_service_stub.call_rpc :get_account_tax, request, options: options do |response, operation|
255
275
  yield response, operation if block_given?
256
- return response
257
276
  end
258
277
  rescue ::GRPC::BadStatus => e
259
278
  raise ::Google::Cloud::Error.from_error(e)
@@ -353,7 +372,7 @@ module Google
353
372
  @account_tax_service_stub.call_rpc :list_account_tax, request, options: options do |response, operation|
354
373
  response = ::Gapic::PagedEnumerable.new @account_tax_service_stub, :list_account_tax, request, response, operation, options
355
374
  yield response, operation if block_given?
356
- return response
375
+ throw :response, response
357
376
  end
358
377
  rescue ::GRPC::BadStatus => e
359
378
  raise ::Google::Cloud::Error.from_error(e)
@@ -441,7 +460,6 @@ module Google
441
460
 
442
461
  @account_tax_service_stub.call_rpc :update_account_tax, request, options: options do |response, operation|
443
462
  yield response, operation if block_given?
444
- return response
445
463
  end
446
464
  rescue ::GRPC::BadStatus => e
447
465
  raise ::Google::Cloud::Error.from_error(e)
@@ -530,6 +548,11 @@ module Google
530
548
  # default endpoint URL. The default value of nil uses the environment
531
549
  # universe (usually the default "googleapis.com" universe).
532
550
  # @return [::String,nil]
551
+ # @!attribute [rw] logger
552
+ # A custom logger to use for request/response debug logging, or the value
553
+ # `:default` (the default) to construct a default logger, or `nil` to
554
+ # explicitly disable logging.
555
+ # @return [::Logger,:default,nil]
533
556
  #
534
557
  class Configuration
535
558
  extend ::Gapic::Config
@@ -554,6 +577,7 @@ module Google
554
577
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
555
578
  config_attr :quota_project, nil, ::String, nil
556
579
  config_attr :universe_domain, nil, ::String, nil
580
+ config_attr :logger, :default, ::Logger, nil, :default
557
581
 
558
582
  # @private
559
583
  def initialize parent_config = nil
@@ -160,8 +160,28 @@ module Google
160
160
  endpoint: @config.endpoint,
161
161
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
162
162
  universe_domain: @config.universe_domain,
163
- credentials: credentials
163
+ credentials: credentials,
164
+ logger: @config.logger
164
165
  )
166
+
167
+ @account_tax_service_stub.logger(stub: true)&.info do |entry|
168
+ entry.set_system_name
169
+ entry.set_service
170
+ entry.message = "Created client for #{entry.service}"
171
+ entry.set_credentials_fields credentials
172
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
173
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
174
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
175
+ end
176
+ end
177
+
178
+ ##
179
+ # The logger used for request/response debug logging.
180
+ #
181
+ # @return [Logger]
182
+ #
183
+ def logger
184
+ @account_tax_service_stub.logger
165
185
  end
166
186
 
167
187
  # Service calls
@@ -239,7 +259,6 @@ module Google
239
259
 
240
260
  @account_tax_service_stub.get_account_tax request, options do |result, operation|
241
261
  yield result, operation if block_given?
242
- return result
243
262
  end
244
263
  rescue ::Gapic::Rest::Error => e
245
264
  raise ::Google::Cloud::Error.from_error(e)
@@ -332,7 +351,7 @@ module Google
332
351
  @account_tax_service_stub.list_account_tax request, options do |result, operation|
333
352
  result = ::Gapic::Rest::PagedEnumerable.new @account_tax_service_stub, :list_account_tax, "account_taxes", request, result, options
334
353
  yield result, operation if block_given?
335
- return result
354
+ throw :response, result
336
355
  end
337
356
  rescue ::Gapic::Rest::Error => e
338
357
  raise ::Google::Cloud::Error.from_error(e)
@@ -413,7 +432,6 @@ module Google
413
432
 
414
433
  @account_tax_service_stub.update_account_tax request, options do |result, operation|
415
434
  yield result, operation if block_given?
416
- return result
417
435
  end
418
436
  rescue ::Gapic::Rest::Error => e
419
437
  raise ::Google::Cloud::Error.from_error(e)
@@ -493,6 +511,11 @@ module Google
493
511
  # default endpoint URL. The default value of nil uses the environment
494
512
  # universe (usually the default "googleapis.com" universe).
495
513
  # @return [::String,nil]
514
+ # @!attribute [rw] logger
515
+ # A custom logger to use for request/response debug logging, or the value
516
+ # `:default` (the default) to construct a default logger, or `nil` to
517
+ # explicitly disable logging.
518
+ # @return [::Logger,:default,nil]
496
519
  #
497
520
  class Configuration
498
521
  extend ::Gapic::Config
@@ -514,6 +537,7 @@ module Google
514
537
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
515
538
  config_attr :quota_project, nil, ::String, nil
516
539
  config_attr :universe_domain, nil, ::String, nil
540
+ config_attr :logger, :default, ::Logger, nil, :default
517
541
 
518
542
  # @private
519
543
  def initialize parent_config = nil
@@ -31,7 +31,8 @@ module Google
31
31
  # including transcoding, making the REST call, and deserialing the response.
32
32
  #
33
33
  class ServiceStub
34
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
+ # @private
35
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
36
  # These require statements are intentionally placed here to initialize
36
37
  # the REST modules only when it's required.
37
38
  require "gapic/rest"
@@ -41,7 +42,9 @@ module Google
41
42
  universe_domain: universe_domain,
42
43
  credentials: credentials,
43
44
  numeric_enums: true,
44
- raise_faraday_errors: false
45
+ service_name: self.class,
46
+ raise_faraday_errors: false,
47
+ logger: logger
45
48
  end
46
49
 
47
50
  ##
@@ -62,6 +65,15 @@ module Google
62
65
  @client_stub.endpoint
63
66
  end
64
67
 
68
+ ##
69
+ # The logger used for request/response debug logging.
70
+ #
71
+ # @return [Logger]
72
+ #
73
+ def logger stub: false
74
+ stub ? @client_stub.stub_logger : @client_stub.logger
75
+ end
76
+
65
77
  ##
66
78
  # Baseline implementation for the get_account_tax REST call
67
79
  #
@@ -88,16 +100,18 @@ module Google
88
100
 
89
101
  response = @client_stub.make_http_request(
90
102
  verb,
91
- uri: uri,
92
- body: body || "",
93
- params: query_string_params,
103
+ uri: uri,
104
+ body: body || "",
105
+ params: query_string_params,
106
+ method_name: "get_account_tax",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::AccountTax.decode_json response.body, ignore_unknown_fields: true
98
-
99
- yield result, operation if block_given?
100
- result
111
+ catch :response do
112
+ yield result, operation if block_given?
113
+ result
114
+ end
101
115
  end
102
116
 
103
117
  ##
@@ -126,16 +140,18 @@ module Google
126
140
 
127
141
  response = @client_stub.make_http_request(
128
142
  verb,
129
- uri: uri,
130
- body: body || "",
131
- params: query_string_params,
143
+ uri: uri,
144
+ body: body || "",
145
+ params: query_string_params,
146
+ method_name: "list_account_tax",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ListAccountTaxResponse.decode_json response.body, ignore_unknown_fields: true
136
-
137
- yield result, operation if block_given?
138
- result
151
+ catch :response do
152
+ yield result, operation if block_given?
153
+ result
154
+ end
139
155
  end
140
156
 
141
157
  ##
@@ -164,16 +180,18 @@ module Google
164
180
 
165
181
  response = @client_stub.make_http_request(
166
182
  verb,
167
- uri: uri,
168
- body: body || "",
169
- params: query_string_params,
183
+ uri: uri,
184
+ body: body || "",
185
+ params: query_string_params,
186
+ method_name: "update_account_tax",
170
187
  options: options
171
188
  )
172
189
  operation = ::Gapic::Rest::TransportOperation.new response
173
190
  result = ::Google::Shopping::Merchant::Accounts::V1beta::AccountTax.decode_json response.body, ignore_unknown_fields: true
174
-
175
- yield result, operation if block_given?
176
- result
191
+ catch :response do
192
+ yield result, operation if block_given?
193
+ result
194
+ end
177
195
  end
178
196
 
179
197
  ##
@@ -163,8 +163,28 @@ module Google
163
163
  universe_domain: @config.universe_domain,
164
164
  channel_args: @config.channel_args,
165
165
  interceptors: @config.interceptors,
166
- channel_pool_config: @config.channel_pool
166
+ channel_pool_config: @config.channel_pool,
167
+ logger: @config.logger
167
168
  )
169
+
170
+ @accounts_service_stub.stub_logger&.info do |entry|
171
+ entry.set_system_name
172
+ entry.set_service
173
+ entry.message = "Created client for #{entry.service}"
174
+ entry.set_credentials_fields credentials
175
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
176
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
177
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
178
+ end
179
+ end
180
+
181
+ ##
182
+ # The logger used for request/response debug logging.
183
+ #
184
+ # @return [Logger]
185
+ #
186
+ def logger
187
+ @accounts_service_stub.logger
168
188
  end
169
189
 
170
190
  # Service calls
@@ -252,7 +272,6 @@ module Google
252
272
 
253
273
  @accounts_service_stub.call_rpc :get_account, request, options: options do |response, operation|
254
274
  yield response, operation if block_given?
255
- return response
256
275
  end
257
276
  rescue ::GRPC::BadStatus => e
258
277
  raise ::Google::Cloud::Error.from_error(e)
@@ -343,7 +362,6 @@ module Google
343
362
 
344
363
  @accounts_service_stub.call_rpc :create_and_configure_account, request, options: options do |response, operation|
345
364
  yield response, operation if block_given?
346
- return response
347
365
  end
348
366
  rescue ::GRPC::BadStatus => e
349
367
  raise ::Google::Cloud::Error.from_error(e)
@@ -438,7 +456,6 @@ module Google
438
456
 
439
457
  @accounts_service_stub.call_rpc :delete_account, request, options: options do |response, operation|
440
458
  yield response, operation if block_given?
441
- return response
442
459
  end
443
460
  rescue ::GRPC::BadStatus => e
444
461
  raise ::Google::Cloud::Error.from_error(e)
@@ -527,7 +544,6 @@ module Google
527
544
 
528
545
  @accounts_service_stub.call_rpc :update_account, request, options: options do |response, operation|
529
546
  yield response, operation if block_given?
530
- return response
531
547
  end
532
548
  rescue ::GRPC::BadStatus => e
533
549
  raise ::Google::Cloud::Error.from_error(e)
@@ -628,7 +644,7 @@ module Google
628
644
  @accounts_service_stub.call_rpc :list_accounts, request, options: options do |response, operation|
629
645
  response = ::Gapic::PagedEnumerable.new @accounts_service_stub, :list_accounts, request, response, operation, options
630
646
  yield response, operation if block_given?
631
- return response
647
+ throw :response, response
632
648
  end
633
649
  rescue ::GRPC::BadStatus => e
634
650
  raise ::Google::Cloud::Error.from_error(e)
@@ -734,7 +750,7 @@ module Google
734
750
  @accounts_service_stub.call_rpc :list_sub_accounts, request, options: options do |response, operation|
735
751
  response = ::Gapic::PagedEnumerable.new @accounts_service_stub, :list_sub_accounts, request, response, operation, options
736
752
  yield response, operation if block_given?
737
- return response
753
+ throw :response, response
738
754
  end
739
755
  rescue ::GRPC::BadStatus => e
740
756
  raise ::Google::Cloud::Error.from_error(e)
@@ -823,6 +839,11 @@ module Google
823
839
  # default endpoint URL. The default value of nil uses the environment
824
840
  # universe (usually the default "googleapis.com" universe).
825
841
  # @return [::String,nil]
842
+ # @!attribute [rw] logger
843
+ # A custom logger to use for request/response debug logging, or the value
844
+ # `:default` (the default) to construct a default logger, or `nil` to
845
+ # explicitly disable logging.
846
+ # @return [::Logger,:default,nil]
826
847
  #
827
848
  class Configuration
828
849
  extend ::Gapic::Config
@@ -847,6 +868,7 @@ module Google
847
868
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
848
869
  config_attr :quota_project, nil, ::String, nil
849
870
  config_attr :universe_domain, nil, ::String, nil
871
+ config_attr :logger, :default, ::Logger, nil, :default
850
872
 
851
873
  # @private
852
874
  def initialize parent_config = nil