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

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +31 -21
  3. data/lib/google/shopping/merchant/accounts/v1beta/account_issue_service/client.rb +35 -2
  4. data/lib/google/shopping/merchant/accounts/v1beta/account_issue_service/rest/client.rb +35 -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 +35 -4
  7. data/lib/google/shopping/merchant/accounts/v1beta/account_tax_service/rest/client.rb +35 -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 +36 -7
  10. data/lib/google/shopping/merchant/accounts/v1beta/accounts_service/rest/client.rb +36 -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 +34 -3
  13. data/lib/google/shopping/merchant/accounts/v1beta/autofeed_settings_service/rest/client.rb +34 -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 +34 -3
  16. data/lib/google/shopping/merchant/accounts/v1beta/business_identity_service/rest/client.rb +34 -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 +34 -3
  19. data/lib/google/shopping/merchant/accounts/v1beta/business_info_service/rest/client.rb +34 -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 +34 -3
  22. data/lib/google/shopping/merchant/accounts/v1beta/email_preferences_service/rest/client.rb +34 -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 +34 -5
  25. data/lib/google/shopping/merchant/accounts/v1beta/homepage_service/rest/client.rb +34 -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 +35 -3
  28. data/lib/google/shopping/merchant/accounts/v1beta/online_return_policy_service/rest/client.rb +35 -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 +35 -5
  31. data/lib/google/shopping/merchant/accounts/v1beta/programs_service/rest/client.rb +35 -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 +35 -6
  34. data/lib/google/shopping/merchant/accounts/v1beta/regions_service/rest/client.rb +35 -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 +34 -3
  37. data/lib/google/shopping/merchant/accounts/v1beta/shipping_settings_service/rest/client.rb +34 -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 +34 -3
  40. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_agreement_state_service/rest/client.rb +34 -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 +34 -4
  43. data/lib/google/shopping/merchant/accounts/v1beta/terms_of_service_service/rest/client.rb +34 -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 +35 -6
  46. data/lib/google/shopping/merchant/accounts/v1beta/user_service/rest/client.rb +35 -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. data/proto_docs/google/shopping/merchant/accounts/v1beta/online_return_policy.rb +4 -0
  51. data/proto_docs/google/shopping/merchant/accounts/v1beta/tax_rule.rb +8 -0
  52. data/proto_docs/google/type/datetime.rb +4 -0
  53. data/proto_docs/google/type/phone_number.rb +4 -0
  54. metadata +6 -9
@@ -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)
@@ -386,6 +404,13 @@ module Google
386
404
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
387
405
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
388
406
  # * (`nil`) indicating no credentials
407
+ #
408
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
409
+ # external source for authentication to Google Cloud, you must validate it before
410
+ # providing it to a Google API client library. Providing an unvalidated credential
411
+ # configuration to Google APIs can compromise the security of your systems and data.
412
+ # For more information, refer to [Validate credential configurations from external
413
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
389
414
  # @return [::Object]
390
415
  # @!attribute [rw] scope
391
416
  # The OAuth scopes
@@ -425,6 +450,11 @@ module Google
425
450
  # default endpoint URL. The default value of nil uses the environment
426
451
  # universe (usually the default "googleapis.com" universe).
427
452
  # @return [::String,nil]
453
+ # @!attribute [rw] logger
454
+ # A custom logger to use for request/response debug logging, or the value
455
+ # `:default` (the default) to construct a default logger, or `nil` to
456
+ # explicitly disable logging.
457
+ # @return [::Logger,:default,nil]
428
458
  #
429
459
  class Configuration
430
460
  extend ::Gapic::Config
@@ -449,6 +479,7 @@ module Google
449
479
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
450
480
  config_attr :quota_project, nil, ::String, nil
451
481
  config_attr :universe_domain, nil, ::String, nil
482
+ config_attr :logger, :default, ::Logger, nil, :default
452
483
 
453
484
  # @private
454
485
  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)
@@ -363,6 +381,13 @@ module Google
363
381
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
364
382
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
365
383
  # * (`nil`) indicating no credentials
384
+ #
385
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
386
+ # external source for authentication to Google Cloud, you must validate it before
387
+ # providing it to a Google API client library. Providing an unvalidated credential
388
+ # configuration to Google APIs can compromise the security of your systems and data.
389
+ # For more information, refer to [Validate credential configurations from external
390
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
366
391
  # @return [::Object]
367
392
  # @!attribute [rw] scope
368
393
  # The OAuth scopes
@@ -395,6 +420,11 @@ module Google
395
420
  # default endpoint URL. The default value of nil uses the environment
396
421
  # universe (usually the default "googleapis.com" universe).
397
422
  # @return [::String,nil]
423
+ # @!attribute [rw] logger
424
+ # A custom logger to use for request/response debug logging, or the value
425
+ # `:default` (the default) to construct a default logger, or `nil` to
426
+ # explicitly disable logging.
427
+ # @return [::Logger,:default,nil]
398
428
  #
399
429
  class Configuration
400
430
  extend ::Gapic::Config
@@ -416,6 +446,7 @@ module Google
416
446
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
417
447
  config_attr :quota_project, nil, ::String, nil
418
448
  config_attr :universe_domain, nil, ::String, nil
449
+ config_attr :logger, :default, ::Logger, nil, :default
419
450
 
420
451
  # @private
421
452
  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_shipping_settings 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_shipping_settings",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ShippingSettings.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: "insert_shipping_settings",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ShippingSettings.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
+ @terms_of_service_agreement_state_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
+ @terms_of_service_agreement_state_service_stub.logger
168
188
  end
169
189
 
170
190
  # Service calls
@@ -251,7 +271,6 @@ module Google
251
271
 
252
272
  @terms_of_service_agreement_state_service_stub.call_rpc :get_terms_of_service_agreement_state, request, options: options do |response, operation|
253
273
  yield response, operation if block_given?
254
- return response
255
274
  end
256
275
  rescue ::GRPC::BadStatus => e
257
276
  raise ::Google::Cloud::Error.from_error(e)
@@ -338,7 +357,6 @@ module Google
338
357
 
339
358
  @terms_of_service_agreement_state_service_stub.call_rpc :retrieve_for_application_terms_of_service_agreement_state, 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)
@@ -388,6 +406,13 @@ module Google
388
406
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
389
407
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
390
408
  # * (`nil`) indicating no credentials
409
+ #
410
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
411
+ # external source for authentication to Google Cloud, you must validate it before
412
+ # providing it to a Google API client library. Providing an unvalidated credential
413
+ # configuration to Google APIs can compromise the security of your systems and data.
414
+ # For more information, refer to [Validate credential configurations from external
415
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
391
416
  # @return [::Object]
392
417
  # @!attribute [rw] scope
393
418
  # The OAuth scopes
@@ -427,6 +452,11 @@ module Google
427
452
  # default endpoint URL. The default value of nil uses the environment
428
453
  # universe (usually the default "googleapis.com" universe).
429
454
  # @return [::String,nil]
455
+ # @!attribute [rw] logger
456
+ # A custom logger to use for request/response debug logging, or the value
457
+ # `:default` (the default) to construct a default logger, or `nil` to
458
+ # explicitly disable logging.
459
+ # @return [::Logger,:default,nil]
430
460
  #
431
461
  class Configuration
432
462
  extend ::Gapic::Config
@@ -451,6 +481,7 @@ module Google
451
481
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
452
482
  config_attr :quota_project, nil, ::String, nil
453
483
  config_attr :universe_domain, nil, ::String, nil
484
+ config_attr :logger, :default, ::Logger, nil, :default
454
485
 
455
486
  # @private
456
487
  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
+ @terms_of_service_agreement_state_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
+ @terms_of_service_agreement_state_service_stub.logger
161
181
  end
162
182
 
163
183
  # Service calls
@@ -237,7 +257,6 @@ module Google
237
257
 
238
258
  @terms_of_service_agreement_state_service_stub.get_terms_of_service_agreement_state request, options do |result, operation|
239
259
  yield result, operation if block_given?
240
- return result
241
260
  end
242
261
  rescue ::Gapic::Rest::Error => e
243
262
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +336,6 @@ module Google
317
336
 
318
337
  @terms_of_service_agreement_state_service_stub.retrieve_for_application_terms_of_service_agreement_state 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)
@@ -365,6 +383,13 @@ module Google
365
383
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
366
384
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
367
385
  # * (`nil`) indicating no credentials
386
+ #
387
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
388
+ # external source for authentication to Google Cloud, you must validate it before
389
+ # providing it to a Google API client library. Providing an unvalidated credential
390
+ # configuration to Google APIs can compromise the security of your systems and data.
391
+ # For more information, refer to [Validate credential configurations from external
392
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
368
393
  # @return [::Object]
369
394
  # @!attribute [rw] scope
370
395
  # The OAuth scopes
@@ -397,6 +422,11 @@ module Google
397
422
  # default endpoint URL. The default value of nil uses the environment
398
423
  # universe (usually the default "googleapis.com" universe).
399
424
  # @return [::String,nil]
425
+ # @!attribute [rw] logger
426
+ # A custom logger to use for request/response debug logging, or the value
427
+ # `:default` (the default) to construct a default logger, or `nil` to
428
+ # explicitly disable logging.
429
+ # @return [::Logger,:default,nil]
400
430
  #
401
431
  class Configuration
402
432
  extend ::Gapic::Config
@@ -418,6 +448,7 @@ module Google
418
448
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
419
449
  config_attr :quota_project, nil, ::String, nil
420
450
  config_attr :universe_domain, nil, ::String, nil
451
+ config_attr :logger, :default, ::Logger, nil, :default
421
452
 
422
453
  # @private
423
454
  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_terms_of_service_agreement_state 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_terms_of_service_agreement_state",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::TermsOfServiceAgreementState.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: "retrieve_for_application_terms_of_service_agreement_state",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::TermsOfServiceAgreementState.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
  ##