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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) 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_pb.rb +1 -1
  10. data/lib/google/shopping/merchant/accounts/v1beta/accounts_service/client.rb +38 -9
  11. data/lib/google/shopping/merchant/accounts/v1beta/accounts_service/rest/client.rb +38 -9
  12. data/lib/google/shopping/merchant/accounts/v1beta/accounts_service/rest/service_stub.rb +62 -38
  13. data/lib/google/shopping/merchant/accounts/v1beta/accounts_services_pb.rb +5 -1
  14. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/client.rb +27 -3
  15. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/rest/client.rb +27 -3
  16. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/rest/service_stub.rb +30 -14
  17. data/lib/google/shopping/merchant/accounts/v1beta/business_identity_service/client.rb +27 -3
  18. data/lib/google/shopping/merchant/accounts/v1beta/business_identity_service/rest/client.rb +27 -3
  19. data/lib/google/shopping/merchant/accounts/v1beta/business_identity_service/rest/service_stub.rb +30 -14
  20. data/lib/google/shopping/merchant/accounts/v1beta/business_info_service/client.rb +27 -3
  21. data/lib/google/shopping/merchant/accounts/v1beta/business_info_service/rest/client.rb +27 -3
  22. data/lib/google/shopping/merchant/accounts/v1beta/business_info_service/rest/service_stub.rb +30 -14
  23. data/lib/google/shopping/merchant/accounts/v1beta/email_preferences_service/client.rb +27 -3
  24. data/lib/google/shopping/merchant/accounts/v1beta/email_preferences_service/rest/client.rb +27 -3
  25. data/lib/google/shopping/merchant/accounts/v1beta/email_preferences_service/rest/service_stub.rb +30 -14
  26. data/lib/google/shopping/merchant/accounts/v1beta/homepage_service/client.rb +27 -5
  27. data/lib/google/shopping/merchant/accounts/v1beta/homepage_service/rest/client.rb +27 -5
  28. data/lib/google/shopping/merchant/accounts/v1beta/homepage_service/rest/service_stub.rb +46 -26
  29. data/lib/google/shopping/merchant/accounts/v1beta/online_return_policy_service/client.rb +28 -3
  30. data/lib/google/shopping/merchant/accounts/v1beta/online_return_policy_service/rest/client.rb +28 -3
  31. data/lib/google/shopping/merchant/accounts/v1beta/online_return_policy_service/rest/service_stub.rb +30 -14
  32. data/lib/google/shopping/merchant/accounts/v1beta/programs_service/client.rb +28 -5
  33. data/lib/google/shopping/merchant/accounts/v1beta/programs_service/rest/client.rb +28 -5
  34. data/lib/google/shopping/merchant/accounts/v1beta/programs_service/rest/service_stub.rb +46 -26
  35. data/lib/google/shopping/merchant/accounts/v1beta/regions_service/client.rb +28 -6
  36. data/lib/google/shopping/merchant/accounts/v1beta/regions_service/rest/client.rb +28 -6
  37. data/lib/google/shopping/merchant/accounts/v1beta/regions_service/rest/service_stub.rb +54 -32
  38. data/lib/google/shopping/merchant/accounts/v1beta/shipping_settings_service/client.rb +27 -3
  39. data/lib/google/shopping/merchant/accounts/v1beta/shipping_settings_service/rest/client.rb +27 -3
  40. data/lib/google/shopping/merchant/accounts/v1beta/shipping_settings_service/rest/service_stub.rb +30 -14
  41. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_agreement_state_service/client.rb +27 -3
  42. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_agreement_state_service/rest/client.rb +27 -3
  43. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_agreement_state_service/rest/service_stub.rb +30 -14
  44. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_service/client.rb +27 -4
  45. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_service/rest/client.rb +27 -4
  46. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_service/rest/service_stub.rb +38 -20
  47. data/lib/google/shopping/merchant/accounts/v1beta/user_service/client.rb +28 -6
  48. data/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/client.rb +28 -6
  49. data/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/service_stub.rb +54 -32
  50. data/lib/google/shopping/merchant/accounts/v1beta/version.rb +1 -1
  51. data/proto_docs/google/api/client.rb +39 -0
  52. data/proto_docs/google/shopping/merchant/accounts/v1beta/accounts.rb +4 -0
  53. 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_email_preferences 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_email_preferences",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::EmailPreferences.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_email_preferences",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::EmailPreferences.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
  ##
@@ -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
+ @homepage_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
+ @homepage_service_stub.logger
168
188
  end
169
189
 
170
190
  # Service calls
@@ -250,7 +270,6 @@ module Google
250
270
 
251
271
  @homepage_service_stub.call_rpc :get_homepage, request, options: options do |response, operation|
252
272
  yield response, operation if block_given?
253
- return response
254
273
  end
255
274
  rescue ::GRPC::BadStatus => e
256
275
  raise ::Google::Cloud::Error.from_error(e)
@@ -338,7 +357,6 @@ module Google
338
357
 
339
358
  @homepage_service_stub.call_rpc :update_homepage, request, options: options do |response, operation|
340
359
  yield response, operation if block_given?
341
- return response
342
360
  end
343
361
  rescue ::GRPC::BadStatus => e
344
362
  raise ::Google::Cloud::Error.from_error(e)
@@ -438,7 +456,6 @@ module Google
438
456
 
439
457
  @homepage_service_stub.call_rpc :claim_homepage, 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)
@@ -525,7 +542,6 @@ module Google
525
542
 
526
543
  @homepage_service_stub.call_rpc :unclaim_homepage, request, options: options do |response, operation|
527
544
  yield response, operation if block_given?
528
- return response
529
545
  end
530
546
  rescue ::GRPC::BadStatus => e
531
547
  raise ::Google::Cloud::Error.from_error(e)
@@ -614,6 +630,11 @@ module Google
614
630
  # default endpoint URL. The default value of nil uses the environment
615
631
  # universe (usually the default "googleapis.com" universe).
616
632
  # @return [::String,nil]
633
+ # @!attribute [rw] logger
634
+ # A custom logger to use for request/response debug logging, or the value
635
+ # `:default` (the default) to construct a default logger, or `nil` to
636
+ # explicitly disable logging.
637
+ # @return [::Logger,:default,nil]
617
638
  #
618
639
  class Configuration
619
640
  extend ::Gapic::Config
@@ -638,6 +659,7 @@ module Google
638
659
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
639
660
  config_attr :quota_project, nil, ::String, nil
640
661
  config_attr :universe_domain, nil, ::String, nil
662
+ config_attr :logger, :default, ::Logger, nil, :default
641
663
 
642
664
  # @private
643
665
  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
+ @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
  ##