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
@@ -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_program 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_program",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Program.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_programs",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ListProgramsResponse.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: "enable_program",
170
187
  options: options
171
188
  )
172
189
  operation = ::Gapic::Rest::TransportOperation.new response
173
190
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Program.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
  ##
@@ -202,16 +220,18 @@ module Google
202
220
 
203
221
  response = @client_stub.make_http_request(
204
222
  verb,
205
- uri: uri,
206
- body: body || "",
207
- params: query_string_params,
223
+ uri: uri,
224
+ body: body || "",
225
+ params: query_string_params,
226
+ method_name: "disable_program",
208
227
  options: options
209
228
  )
210
229
  operation = ::Gapic::Rest::TransportOperation.new response
211
230
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Program.decode_json response.body, ignore_unknown_fields: true
212
-
213
- yield result, operation if block_given?
214
- result
231
+ catch :response do
232
+ yield result, operation if block_given?
233
+ result
234
+ end
215
235
  end
216
236
 
217
237
  ##
@@ -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
+ @regions_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
+ @regions_service_stub.logger
172
192
  end
173
193
 
174
194
  # Service calls
@@ -254,7 +274,6 @@ module Google
254
274
 
255
275
  @regions_service_stub.call_rpc :get_region, request, options: options do |response, operation|
256
276
  yield response, operation if block_given?
257
- return response
258
277
  end
259
278
  rescue ::GRPC::BadStatus => e
260
279
  raise ::Google::Cloud::Error.from_error(e)
@@ -347,7 +366,6 @@ module Google
347
366
 
348
367
  @regions_service_stub.call_rpc :create_region, request, options: options do |response, operation|
349
368
  yield response, operation if block_given?
350
- return response
351
369
  end
352
370
  rescue ::GRPC::BadStatus => e
353
371
  raise ::Google::Cloud::Error.from_error(e)
@@ -438,7 +456,6 @@ module Google
438
456
 
439
457
  @regions_service_stub.call_rpc :update_region, 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)
@@ -526,7 +543,6 @@ module Google
526
543
 
527
544
  @regions_service_stub.call_rpc :delete_region, request, options: options do |response, operation|
528
545
  yield response, operation if block_given?
529
- return response
530
546
  end
531
547
  rescue ::GRPC::BadStatus => e
532
548
  raise ::Google::Cloud::Error.from_error(e)
@@ -629,7 +645,7 @@ module Google
629
645
  @regions_service_stub.call_rpc :list_regions, request, options: options do |response, operation|
630
646
  response = ::Gapic::PagedEnumerable.new @regions_service_stub, :list_regions, request, response, operation, options
631
647
  yield response, operation if block_given?
632
- return response
648
+ throw :response, response
633
649
  end
634
650
  rescue ::GRPC::BadStatus => e
635
651
  raise ::Google::Cloud::Error.from_error(e)
@@ -718,6 +734,11 @@ module Google
718
734
  # default endpoint URL. The default value of nil uses the environment
719
735
  # universe (usually the default "googleapis.com" universe).
720
736
  # @return [::String,nil]
737
+ # @!attribute [rw] logger
738
+ # A custom logger to use for request/response debug logging, or the value
739
+ # `:default` (the default) to construct a default logger, or `nil` to
740
+ # explicitly disable logging.
741
+ # @return [::Logger,:default,nil]
721
742
  #
722
743
  class Configuration
723
744
  extend ::Gapic::Config
@@ -742,6 +763,7 @@ module Google
742
763
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
743
764
  config_attr :quota_project, nil, ::String, nil
744
765
  config_attr :universe_domain, nil, ::String, nil
766
+ config_attr :logger, :default, ::Logger, nil, :default
745
767
 
746
768
  # @private
747
769
  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
+ @regions_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
+ @regions_service_stub.logger
165
185
  end
166
186
 
167
187
  # Service calls
@@ -240,7 +260,6 @@ module Google
240
260
 
241
261
  @regions_service_stub.get_region request, options do |result, operation|
242
262
  yield result, operation if block_given?
243
- return result
244
263
  end
245
264
  rescue ::Gapic::Rest::Error => e
246
265
  raise ::Google::Cloud::Error.from_error(e)
@@ -326,7 +345,6 @@ module Google
326
345
 
327
346
  @regions_service_stub.create_region request, options do |result, operation|
328
347
  yield result, operation if block_given?
329
- return result
330
348
  end
331
349
  rescue ::Gapic::Rest::Error => e
332
350
  raise ::Google::Cloud::Error.from_error(e)
@@ -410,7 +428,6 @@ module Google
410
428
 
411
429
  @regions_service_stub.update_region request, options do |result, operation|
412
430
  yield result, operation if block_given?
413
- return result
414
431
  end
415
432
  rescue ::Gapic::Rest::Error => e
416
433
  raise ::Google::Cloud::Error.from_error(e)
@@ -491,7 +508,6 @@ module Google
491
508
 
492
509
  @regions_service_stub.delete_region request, options do |result, operation|
493
510
  yield result, operation if block_given?
494
- return result
495
511
  end
496
512
  rescue ::Gapic::Rest::Error => e
497
513
  raise ::Google::Cloud::Error.from_error(e)
@@ -587,7 +603,7 @@ module Google
587
603
  @regions_service_stub.list_regions request, options do |result, operation|
588
604
  result = ::Gapic::Rest::PagedEnumerable.new @regions_service_stub, :list_regions, "regions", request, result, options
589
605
  yield result, operation if block_given?
590
- return result
606
+ throw :response, result
591
607
  end
592
608
  rescue ::Gapic::Rest::Error => e
593
609
  raise ::Google::Cloud::Error.from_error(e)
@@ -667,6 +683,11 @@ module Google
667
683
  # default endpoint URL. The default value of nil uses the environment
668
684
  # universe (usually the default "googleapis.com" universe).
669
685
  # @return [::String,nil]
686
+ # @!attribute [rw] logger
687
+ # A custom logger to use for request/response debug logging, or the value
688
+ # `:default` (the default) to construct a default logger, or `nil` to
689
+ # explicitly disable logging.
690
+ # @return [::Logger,:default,nil]
670
691
  #
671
692
  class Configuration
672
693
  extend ::Gapic::Config
@@ -688,6 +709,7 @@ module Google
688
709
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
689
710
  config_attr :quota_project, nil, ::String, nil
690
711
  config_attr :universe_domain, nil, ::String, nil
712
+ config_attr :logger, :default, ::Logger, nil, :default
691
713
 
692
714
  # @private
693
715
  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_region 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_region",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Region.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: "create_region",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Region.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_region",
170
187
  options: options
171
188
  )
172
189
  operation = ::Gapic::Rest::TransportOperation.new response
173
190
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Region.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
  ##
@@ -202,16 +220,18 @@ module Google
202
220
 
203
221
  response = @client_stub.make_http_request(
204
222
  verb,
205
- uri: uri,
206
- body: body || "",
207
- params: query_string_params,
223
+ uri: uri,
224
+ body: body || "",
225
+ params: query_string_params,
226
+ method_name: "delete_region",
208
227
  options: options
209
228
  )
210
229
  operation = ::Gapic::Rest::TransportOperation.new response
211
230
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
212
-
213
- yield result, operation if block_given?
214
- result
231
+ catch :response do
232
+ yield result, operation if block_given?
233
+ result
234
+ end
215
235
  end
216
236
 
217
237
  ##
@@ -240,16 +260,18 @@ module Google
240
260
 
241
261
  response = @client_stub.make_http_request(
242
262
  verb,
243
- uri: uri,
244
- body: body || "",
245
- params: query_string_params,
263
+ uri: uri,
264
+ body: body || "",
265
+ params: query_string_params,
266
+ method_name: "list_regions",
246
267
  options: options
247
268
  )
248
269
  operation = ::Gapic::Rest::TransportOperation.new response
249
270
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ListRegionsResponse.decode_json response.body, ignore_unknown_fields: true
250
-
251
- yield result, operation if block_given?
252
- result
271
+ catch :response do
272
+ yield result, operation if block_given?
273
+ result
274
+ end
253
275
  end
254
276
 
255
277
  ##
@@ -159,8 +159,28 @@ module Google
159
159
  universe_domain: @config.universe_domain,
160
160
  channel_args: @config.channel_args,
161
161
  interceptors: @config.interceptors,
162
- channel_pool_config: @config.channel_pool
162
+ channel_pool_config: @config.channel_pool,
163
+ logger: @config.logger
163
164
  )
165
+
166
+ @shipping_settings_service_stub.stub_logger&.info do |entry|
167
+ entry.set_system_name
168
+ entry.set_service
169
+ entry.message = "Created client for #{entry.service}"
170
+ entry.set_credentials_fields credentials
171
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
172
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
173
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
174
+ end
175
+ end
176
+
177
+ ##
178
+ # The logger used for request/response debug logging.
179
+ #
180
+ # @return [Logger]
181
+ #
182
+ def logger
183
+ @shipping_settings_service_stub.logger
164
184
  end
165
185
 
166
186
  # Service calls
@@ -246,7 +266,6 @@ module Google
246
266
 
247
267
  @shipping_settings_service_stub.call_rpc :get_shipping_settings, request, options: options do |response, operation|
248
268
  yield response, operation if block_given?
249
- return response
250
269
  end
251
270
  rescue ::GRPC::BadStatus => e
252
271
  raise ::Google::Cloud::Error.from_error(e)
@@ -336,7 +355,6 @@ module Google
336
355
 
337
356
  @shipping_settings_service_stub.call_rpc :insert_shipping_settings, request, options: options do |response, operation|
338
357
  yield response, operation if block_given?
339
- return response
340
358
  end
341
359
  rescue ::GRPC::BadStatus => e
342
360
  raise ::Google::Cloud::Error.from_error(e)
@@ -425,6 +443,11 @@ module Google
425
443
  # default endpoint URL. The default value of nil uses the environment
426
444
  # universe (usually the default "googleapis.com" universe).
427
445
  # @return [::String,nil]
446
+ # @!attribute [rw] logger
447
+ # A custom logger to use for request/response debug logging, or the value
448
+ # `:default` (the default) to construct a default logger, or `nil` to
449
+ # explicitly disable logging.
450
+ # @return [::Logger,:default,nil]
428
451
  #
429
452
  class Configuration
430
453
  extend ::Gapic::Config
@@ -449,6 +472,7 @@ module Google
449
472
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
450
473
  config_attr :quota_project, nil, ::String, nil
451
474
  config_attr :universe_domain, nil, ::String, nil
475
+ config_attr :logger, :default, ::Logger, nil, :default
452
476
 
453
477
  # @private
454
478
  def initialize parent_config = nil
@@ -152,8 +152,28 @@ module Google
152
152
  endpoint: @config.endpoint,
153
153
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
154
154
  universe_domain: @config.universe_domain,
155
- credentials: credentials
155
+ credentials: credentials,
156
+ logger: @config.logger
156
157
  )
158
+
159
+ @shipping_settings_service_stub.logger(stub: true)&.info do |entry|
160
+ entry.set_system_name
161
+ entry.set_service
162
+ entry.message = "Created client for #{entry.service}"
163
+ entry.set_credentials_fields credentials
164
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
165
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
166
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
167
+ end
168
+ end
169
+
170
+ ##
171
+ # The logger used for request/response debug logging.
172
+ #
173
+ # @return [Logger]
174
+ #
175
+ def logger
176
+ @shipping_settings_service_stub.logger
157
177
  end
158
178
 
159
179
  # Service calls
@@ -232,7 +252,6 @@ module Google
232
252
 
233
253
  @shipping_settings_service_stub.get_shipping_settings request, options do |result, operation|
234
254
  yield result, operation if block_given?
235
- return result
236
255
  end
237
256
  rescue ::Gapic::Rest::Error => e
238
257
  raise ::Google::Cloud::Error.from_error(e)
@@ -315,7 +334,6 @@ module Google
315
334
 
316
335
  @shipping_settings_service_stub.insert_shipping_settings request, options do |result, operation|
317
336
  yield result, operation if block_given?
318
- return result
319
337
  end
320
338
  rescue ::Gapic::Rest::Error => e
321
339
  raise ::Google::Cloud::Error.from_error(e)
@@ -395,6 +413,11 @@ module Google
395
413
  # default endpoint URL. The default value of nil uses the environment
396
414
  # universe (usually the default "googleapis.com" universe).
397
415
  # @return [::String,nil]
416
+ # @!attribute [rw] logger
417
+ # A custom logger to use for request/response debug logging, or the value
418
+ # `:default` (the default) to construct a default logger, or `nil` to
419
+ # explicitly disable logging.
420
+ # @return [::Logger,:default,nil]
398
421
  #
399
422
  class Configuration
400
423
  extend ::Gapic::Config
@@ -416,6 +439,7 @@ module Google
416
439
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
417
440
  config_attr :quota_project, nil, ::String, nil
418
441
  config_attr :universe_domain, nil, ::String, nil
442
+ config_attr :logger, :default, ::Logger, nil, :default
419
443
 
420
444
  # @private
421
445
  def initialize parent_config = nil