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
@@ -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
+ @homepage_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
+ @homepage_service_stub.logger
161
181
  end
162
182
 
163
183
  # Service calls
@@ -236,7 +256,6 @@ module Google
236
256
 
237
257
  @homepage_service_stub.get_homepage request, options do |result, operation|
238
258
  yield result, operation if block_given?
239
- return result
240
259
  end
241
260
  rescue ::Gapic::Rest::Error => e
242
261
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +336,6 @@ module Google
317
336
 
318
337
  @homepage_service_stub.update_homepage request, options do |result, operation|
319
338
  yield result, operation if block_given?
320
- return result
321
339
  end
322
340
  rescue ::Gapic::Rest::Error => e
323
341
  raise ::Google::Cloud::Error.from_error(e)
@@ -410,7 +428,6 @@ module Google
410
428
 
411
429
  @homepage_service_stub.claim_homepage 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)
@@ -490,7 +507,6 @@ module Google
490
507
 
491
508
  @homepage_service_stub.unclaim_homepage request, options do |result, operation|
492
509
  yield result, operation if block_given?
493
- return result
494
510
  end
495
511
  rescue ::Gapic::Rest::Error => e
496
512
  raise ::Google::Cloud::Error.from_error(e)
@@ -570,6 +586,11 @@ module Google
570
586
  # default endpoint URL. The default value of nil uses the environment
571
587
  # universe (usually the default "googleapis.com" universe).
572
588
  # @return [::String,nil]
589
+ # @!attribute [rw] logger
590
+ # A custom logger to use for request/response debug logging, or the value
591
+ # `:default` (the default) to construct a default logger, or `nil` to
592
+ # explicitly disable logging.
593
+ # @return [::Logger,:default,nil]
573
594
  #
574
595
  class Configuration
575
596
  extend ::Gapic::Config
@@ -591,6 +612,7 @@ module Google
591
612
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
592
613
  config_attr :quota_project, nil, ::String, nil
593
614
  config_attr :universe_domain, nil, ::String, nil
615
+ config_attr :logger, :default, ::Logger, nil, :default
594
616
 
595
617
  # @private
596
618
  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_homepage 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_homepage",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Homepage.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: "update_homepage",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Homepage.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: "claim_homepage",
170
187
  options: options
171
188
  )
172
189
  operation = ::Gapic::Rest::TransportOperation.new response
173
190
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Homepage.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: "unclaim_homepage",
208
227
  options: options
209
228
  )
210
229
  operation = ::Gapic::Rest::TransportOperation.new response
211
230
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Homepage.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
+ @online_return_policy_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
+ @online_return_policy_service_stub.logger
172
192
  end
173
193
 
174
194
  # Service calls
@@ -254,7 +274,6 @@ module Google
254
274
 
255
275
  @online_return_policy_service_stub.call_rpc :get_online_return_policy, 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)
@@ -361,7 +380,7 @@ module Google
361
380
  @online_return_policy_service_stub.call_rpc :list_online_return_policies, request, options: options do |response, operation|
362
381
  response = ::Gapic::PagedEnumerable.new @online_return_policy_service_stub, :list_online_return_policies, request, response, operation, options
363
382
  yield response, operation if block_given?
364
- return response
383
+ throw :response, response
365
384
  end
366
385
  rescue ::GRPC::BadStatus => e
367
386
  raise ::Google::Cloud::Error.from_error(e)
@@ -450,6 +469,11 @@ module Google
450
469
  # default endpoint URL. The default value of nil uses the environment
451
470
  # universe (usually the default "googleapis.com" universe).
452
471
  # @return [::String,nil]
472
+ # @!attribute [rw] logger
473
+ # A custom logger to use for request/response debug logging, or the value
474
+ # `:default` (the default) to construct a default logger, or `nil` to
475
+ # explicitly disable logging.
476
+ # @return [::Logger,:default,nil]
453
477
  #
454
478
  class Configuration
455
479
  extend ::Gapic::Config
@@ -474,6 +498,7 @@ module Google
474
498
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
475
499
  config_attr :quota_project, nil, ::String, nil
476
500
  config_attr :universe_domain, nil, ::String, nil
501
+ config_attr :logger, :default, ::Logger, nil, :default
477
502
 
478
503
  # @private
479
504
  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
+ @online_return_policy_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
+ @online_return_policy_service_stub.logger
165
185
  end
166
186
 
167
187
  # Service calls
@@ -240,7 +260,6 @@ module Google
240
260
 
241
261
  @online_return_policy_service_stub.get_online_return_policy 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)
@@ -340,7 +359,7 @@ module Google
340
359
  @online_return_policy_service_stub.list_online_return_policies request, options do |result, operation|
341
360
  result = ::Gapic::Rest::PagedEnumerable.new @online_return_policy_service_stub, :list_online_return_policies, "online_return_policies", request, result, options
342
361
  yield result, operation if block_given?
343
- return result
362
+ throw :response, result
344
363
  end
345
364
  rescue ::Gapic::Rest::Error => e
346
365
  raise ::Google::Cloud::Error.from_error(e)
@@ -420,6 +439,11 @@ module Google
420
439
  # default endpoint URL. The default value of nil uses the environment
421
440
  # universe (usually the default "googleapis.com" universe).
422
441
  # @return [::String,nil]
442
+ # @!attribute [rw] logger
443
+ # A custom logger to use for request/response debug logging, or the value
444
+ # `:default` (the default) to construct a default logger, or `nil` to
445
+ # explicitly disable logging.
446
+ # @return [::Logger,:default,nil]
423
447
  #
424
448
  class Configuration
425
449
  extend ::Gapic::Config
@@ -441,6 +465,7 @@ module Google
441
465
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
442
466
  config_attr :quota_project, nil, ::String, nil
443
467
  config_attr :universe_domain, nil, ::String, nil
468
+ config_attr :logger, :default, ::Logger, nil, :default
444
469
 
445
470
  # @private
446
471
  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_online_return_policy 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_online_return_policy",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::OnlineReturnPolicy.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_online_return_policies",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ListOnlineReturnPoliciesResponse.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
  ##
@@ -173,8 +173,28 @@ module Google
173
173
  universe_domain: @config.universe_domain,
174
174
  channel_args: @config.channel_args,
175
175
  interceptors: @config.interceptors,
176
- channel_pool_config: @config.channel_pool
176
+ channel_pool_config: @config.channel_pool,
177
+ logger: @config.logger
177
178
  )
179
+
180
+ @programs_service_stub.stub_logger&.info do |entry|
181
+ entry.set_system_name
182
+ entry.set_service
183
+ entry.message = "Created client for #{entry.service}"
184
+ entry.set_credentials_fields credentials
185
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
186
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
187
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
188
+ end
189
+ end
190
+
191
+ ##
192
+ # The logger used for request/response debug logging.
193
+ #
194
+ # @return [Logger]
195
+ #
196
+ def logger
197
+ @programs_service_stub.logger
178
198
  end
179
199
 
180
200
  # Service calls
@@ -260,7 +280,6 @@ module Google
260
280
 
261
281
  @programs_service_stub.call_rpc :get_program, request, options: options do |response, operation|
262
282
  yield response, operation if block_given?
263
- return response
264
283
  end
265
284
  rescue ::GRPC::BadStatus => e
266
285
  raise ::Google::Cloud::Error.from_error(e)
@@ -359,7 +378,7 @@ module Google
359
378
  @programs_service_stub.call_rpc :list_programs, request, options: options do |response, operation|
360
379
  response = ::Gapic::PagedEnumerable.new @programs_service_stub, :list_programs, request, response, operation, options
361
380
  yield response, operation if block_given?
362
- return response
381
+ throw :response, response
363
382
  end
364
383
  rescue ::GRPC::BadStatus => e
365
384
  raise ::Google::Cloud::Error.from_error(e)
@@ -447,7 +466,6 @@ module Google
447
466
 
448
467
  @programs_service_stub.call_rpc :enable_program, request, options: options do |response, operation|
449
468
  yield response, operation if block_given?
450
- return response
451
469
  end
452
470
  rescue ::GRPC::BadStatus => e
453
471
  raise ::Google::Cloud::Error.from_error(e)
@@ -535,7 +553,6 @@ module Google
535
553
 
536
554
  @programs_service_stub.call_rpc :disable_program, request, options: options do |response, operation|
537
555
  yield response, operation if block_given?
538
- return response
539
556
  end
540
557
  rescue ::GRPC::BadStatus => e
541
558
  raise ::Google::Cloud::Error.from_error(e)
@@ -624,6 +641,11 @@ module Google
624
641
  # default endpoint URL. The default value of nil uses the environment
625
642
  # universe (usually the default "googleapis.com" universe).
626
643
  # @return [::String,nil]
644
+ # @!attribute [rw] logger
645
+ # A custom logger to use for request/response debug logging, or the value
646
+ # `:default` (the default) to construct a default logger, or `nil` to
647
+ # explicitly disable logging.
648
+ # @return [::Logger,:default,nil]
627
649
  #
628
650
  class Configuration
629
651
  extend ::Gapic::Config
@@ -648,6 +670,7 @@ module Google
648
670
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
649
671
  config_attr :quota_project, nil, ::String, nil
650
672
  config_attr :universe_domain, nil, ::String, nil
673
+ config_attr :logger, :default, ::Logger, nil, :default
651
674
 
652
675
  # @private
653
676
  def initialize parent_config = nil
@@ -166,8 +166,28 @@ module Google
166
166
  endpoint: @config.endpoint,
167
167
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
168
168
  universe_domain: @config.universe_domain,
169
- credentials: credentials
169
+ credentials: credentials,
170
+ logger: @config.logger
170
171
  )
172
+
173
+ @programs_service_stub.logger(stub: true)&.info do |entry|
174
+ entry.set_system_name
175
+ entry.set_service
176
+ entry.message = "Created client for #{entry.service}"
177
+ entry.set_credentials_fields credentials
178
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
179
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
180
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
181
+ end
182
+ end
183
+
184
+ ##
185
+ # The logger used for request/response debug logging.
186
+ #
187
+ # @return [Logger]
188
+ #
189
+ def logger
190
+ @programs_service_stub.logger
171
191
  end
172
192
 
173
193
  # Service calls
@@ -246,7 +266,6 @@ module Google
246
266
 
247
267
  @programs_service_stub.get_program request, options do |result, operation|
248
268
  yield result, operation if block_given?
249
- return result
250
269
  end
251
270
  rescue ::Gapic::Rest::Error => e
252
271
  raise ::Google::Cloud::Error.from_error(e)
@@ -338,7 +357,7 @@ module Google
338
357
  @programs_service_stub.list_programs request, options do |result, operation|
339
358
  result = ::Gapic::Rest::PagedEnumerable.new @programs_service_stub, :list_programs, "programs", request, result, options
340
359
  yield result, operation if block_given?
341
- return result
360
+ throw :response, result
342
361
  end
343
362
  rescue ::Gapic::Rest::Error => e
344
363
  raise ::Google::Cloud::Error.from_error(e)
@@ -419,7 +438,6 @@ module Google
419
438
 
420
439
  @programs_service_stub.enable_program request, options do |result, operation|
421
440
  yield result, operation if block_given?
422
- return result
423
441
  end
424
442
  rescue ::Gapic::Rest::Error => e
425
443
  raise ::Google::Cloud::Error.from_error(e)
@@ -500,7 +518,6 @@ module Google
500
518
 
501
519
  @programs_service_stub.disable_program request, options do |result, operation|
502
520
  yield result, operation if block_given?
503
- return result
504
521
  end
505
522
  rescue ::Gapic::Rest::Error => e
506
523
  raise ::Google::Cloud::Error.from_error(e)
@@ -580,6 +597,11 @@ module Google
580
597
  # default endpoint URL. The default value of nil uses the environment
581
598
  # universe (usually the default "googleapis.com" universe).
582
599
  # @return [::String,nil]
600
+ # @!attribute [rw] logger
601
+ # A custom logger to use for request/response debug logging, or the value
602
+ # `:default` (the default) to construct a default logger, or `nil` to
603
+ # explicitly disable logging.
604
+ # @return [::Logger,:default,nil]
583
605
  #
584
606
  class Configuration
585
607
  extend ::Gapic::Config
@@ -601,6 +623,7 @@ module Google
601
623
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
602
624
  config_attr :quota_project, nil, ::String, nil
603
625
  config_attr :universe_domain, nil, ::String, nil
626
+ config_attr :logger, :default, ::Logger, nil, :default
604
627
 
605
628
  # @private
606
629
  def initialize parent_config = nil