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
@@ -163,8 +163,28 @@ module Google
163
163
  universe_domain: @config.universe_domain,
164
164
  channel_args: @config.channel_args,
165
165
  interceptors: @config.interceptors,
166
- channel_pool_config: @config.channel_pool
166
+ channel_pool_config: @config.channel_pool,
167
+ logger: @config.logger
167
168
  )
169
+
170
+ @accounts_service_stub.stub_logger&.info do |entry|
171
+ entry.set_system_name
172
+ entry.set_service
173
+ entry.message = "Created client for #{entry.service}"
174
+ entry.set_credentials_fields credentials
175
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
176
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
177
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
178
+ end
179
+ end
180
+
181
+ ##
182
+ # The logger used for request/response debug logging.
183
+ #
184
+ # @return [Logger]
185
+ #
186
+ def logger
187
+ @accounts_service_stub.logger
168
188
  end
169
189
 
170
190
  # Service calls
@@ -252,7 +272,6 @@ module Google
252
272
 
253
273
  @accounts_service_stub.call_rpc :get_account, request, options: options do |response, operation|
254
274
  yield response, operation if block_given?
255
- return response
256
275
  end
257
276
  rescue ::GRPC::BadStatus => e
258
277
  raise ::Google::Cloud::Error.from_error(e)
@@ -343,7 +362,6 @@ module Google
343
362
 
344
363
  @accounts_service_stub.call_rpc :create_and_configure_account, request, options: options do |response, operation|
345
364
  yield response, operation if block_given?
346
- return response
347
365
  end
348
366
  rescue ::GRPC::BadStatus => e
349
367
  raise ::Google::Cloud::Error.from_error(e)
@@ -438,7 +456,6 @@ module Google
438
456
 
439
457
  @accounts_service_stub.call_rpc :delete_account, request, options: options do |response, operation|
440
458
  yield response, operation if block_given?
441
- return response
442
459
  end
443
460
  rescue ::GRPC::BadStatus => e
444
461
  raise ::Google::Cloud::Error.from_error(e)
@@ -527,7 +544,6 @@ module Google
527
544
 
528
545
  @accounts_service_stub.call_rpc :update_account, request, options: options do |response, operation|
529
546
  yield response, operation if block_given?
530
- return response
531
547
  end
532
548
  rescue ::GRPC::BadStatus => e
533
549
  raise ::Google::Cloud::Error.from_error(e)
@@ -628,7 +644,7 @@ module Google
628
644
  @accounts_service_stub.call_rpc :list_accounts, request, options: options do |response, operation|
629
645
  response = ::Gapic::PagedEnumerable.new @accounts_service_stub, :list_accounts, request, response, operation, options
630
646
  yield response, operation if block_given?
631
- return response
647
+ throw :response, response
632
648
  end
633
649
  rescue ::GRPC::BadStatus => e
634
650
  raise ::Google::Cloud::Error.from_error(e)
@@ -734,7 +750,7 @@ module Google
734
750
  @accounts_service_stub.call_rpc :list_sub_accounts, request, options: options do |response, operation|
735
751
  response = ::Gapic::PagedEnumerable.new @accounts_service_stub, :list_sub_accounts, request, response, operation, options
736
752
  yield response, operation if block_given?
737
- return response
753
+ throw :response, response
738
754
  end
739
755
  rescue ::GRPC::BadStatus => e
740
756
  raise ::Google::Cloud::Error.from_error(e)
@@ -784,6 +800,13 @@ module Google
784
800
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
785
801
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
786
802
  # * (`nil`) indicating no credentials
803
+ #
804
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
805
+ # external source for authentication to Google Cloud, you must validate it before
806
+ # providing it to a Google API client library. Providing an unvalidated credential
807
+ # configuration to Google APIs can compromise the security of your systems and data.
808
+ # For more information, refer to [Validate credential configurations from external
809
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
787
810
  # @return [::Object]
788
811
  # @!attribute [rw] scope
789
812
  # The OAuth scopes
@@ -823,6 +846,11 @@ module Google
823
846
  # default endpoint URL. The default value of nil uses the environment
824
847
  # universe (usually the default "googleapis.com" universe).
825
848
  # @return [::String,nil]
849
+ # @!attribute [rw] logger
850
+ # A custom logger to use for request/response debug logging, or the value
851
+ # `:default` (the default) to construct a default logger, or `nil` to
852
+ # explicitly disable logging.
853
+ # @return [::Logger,:default,nil]
826
854
  #
827
855
  class Configuration
828
856
  extend ::Gapic::Config
@@ -847,6 +875,7 @@ module Google
847
875
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
848
876
  config_attr :quota_project, nil, ::String, nil
849
877
  config_attr :universe_domain, nil, ::String, nil
878
+ config_attr :logger, :default, ::Logger, nil, :default
850
879
 
851
880
  # @private
852
881
  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
+ @accounts_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
+ @accounts_service_stub.logger
161
181
  end
162
182
 
163
183
  # Service calls
@@ -238,7 +258,6 @@ module Google
238
258
 
239
259
  @accounts_service_stub.get_account request, options do |result, operation|
240
260
  yield result, operation if block_given?
241
- return result
242
261
  end
243
262
  rescue ::Gapic::Rest::Error => e
244
263
  raise ::Google::Cloud::Error.from_error(e)
@@ -330,7 +349,6 @@ module Google
330
349
 
331
350
  @accounts_service_stub.create_and_configure_account request, options do |result, operation|
332
351
  yield result, operation if block_given?
333
- return result
334
352
  end
335
353
  rescue ::Gapic::Rest::Error => e
336
354
  raise ::Google::Cloud::Error.from_error(e)
@@ -418,7 +436,6 @@ module Google
418
436
 
419
437
  @accounts_service_stub.delete_account request, options do |result, operation|
420
438
  yield result, operation if block_given?
421
- return result
422
439
  end
423
440
  rescue ::Gapic::Rest::Error => e
424
441
  raise ::Google::Cloud::Error.from_error(e)
@@ -500,7 +517,6 @@ module Google
500
517
 
501
518
  @accounts_service_stub.update_account request, options do |result, operation|
502
519
  yield result, operation if block_given?
503
- return result
504
520
  end
505
521
  rescue ::Gapic::Rest::Error => e
506
522
  raise ::Google::Cloud::Error.from_error(e)
@@ -602,7 +618,7 @@ module Google
602
618
  @accounts_service_stub.list_accounts request, options do |result, operation|
603
619
  result = ::Gapic::Rest::PagedEnumerable.new @accounts_service_stub, :list_accounts, "accounts", request, result, options
604
620
  yield result, operation if block_given?
605
- return result
621
+ throw :response, result
606
622
  end
607
623
  rescue ::Gapic::Rest::Error => e
608
624
  raise ::Google::Cloud::Error.from_error(e)
@@ -701,7 +717,7 @@ module Google
701
717
  @accounts_service_stub.list_sub_accounts request, options do |result, operation|
702
718
  result = ::Gapic::Rest::PagedEnumerable.new @accounts_service_stub, :list_sub_accounts, "accounts", request, result, options
703
719
  yield result, operation if block_given?
704
- return result
720
+ throw :response, result
705
721
  end
706
722
  rescue ::Gapic::Rest::Error => e
707
723
  raise ::Google::Cloud::Error.from_error(e)
@@ -749,6 +765,13 @@ module Google
749
765
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
750
766
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
751
767
  # * (`nil`) indicating no credentials
768
+ #
769
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
770
+ # external source for authentication to Google Cloud, you must validate it before
771
+ # providing it to a Google API client library. Providing an unvalidated credential
772
+ # configuration to Google APIs can compromise the security of your systems and data.
773
+ # For more information, refer to [Validate credential configurations from external
774
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
752
775
  # @return [::Object]
753
776
  # @!attribute [rw] scope
754
777
  # The OAuth scopes
@@ -781,6 +804,11 @@ module Google
781
804
  # default endpoint URL. The default value of nil uses the environment
782
805
  # universe (usually the default "googleapis.com" universe).
783
806
  # @return [::String,nil]
807
+ # @!attribute [rw] logger
808
+ # A custom logger to use for request/response debug logging, or the value
809
+ # `:default` (the default) to construct a default logger, or `nil` to
810
+ # explicitly disable logging.
811
+ # @return [::Logger,:default,nil]
784
812
  #
785
813
  class Configuration
786
814
  extend ::Gapic::Config
@@ -802,6 +830,7 @@ module Google
802
830
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
803
831
  config_attr :quota_project, nil, ::String, nil
804
832
  config_attr :universe_domain, nil, ::String, nil
833
+ config_attr :logger, :default, ::Logger, nil, :default
805
834
 
806
835
  # @private
807
836
  def initialize parent_config = nil
@@ -31,7 +31,8 @@ module Google
31
31
  # including transcoding, making the REST call, and deserialing the response.
32
32
  #
33
33
  class ServiceStub
34
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
34
+ # @private
35
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
35
36
  # These require statements are intentionally placed here to initialize
36
37
  # the REST modules only when it's required.
37
38
  require "gapic/rest"
@@ -41,7 +42,9 @@ module Google
41
42
  universe_domain: universe_domain,
42
43
  credentials: credentials,
43
44
  numeric_enums: true,
44
- raise_faraday_errors: false
45
+ service_name: self.class,
46
+ raise_faraday_errors: false,
47
+ logger: logger
45
48
  end
46
49
 
47
50
  ##
@@ -62,6 +65,15 @@ module Google
62
65
  @client_stub.endpoint
63
66
  end
64
67
 
68
+ ##
69
+ # The logger used for request/response debug logging.
70
+ #
71
+ # @return [Logger]
72
+ #
73
+ def logger stub: false
74
+ stub ? @client_stub.stub_logger : @client_stub.logger
75
+ end
76
+
65
77
  ##
66
78
  # Baseline implementation for the get_account REST call
67
79
  #
@@ -88,16 +100,18 @@ module Google
88
100
 
89
101
  response = @client_stub.make_http_request(
90
102
  verb,
91
- uri: uri,
92
- body: body || "",
93
- params: query_string_params,
103
+ uri: uri,
104
+ body: body || "",
105
+ params: query_string_params,
106
+ method_name: "get_account",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Account.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_and_configure_account",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Account.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: "delete_account",
170
187
  options: options
171
188
  )
172
189
  operation = ::Gapic::Rest::TransportOperation.new response
173
190
  result = ::Google::Protobuf::Empty.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: "update_account",
208
227
  options: options
209
228
  )
210
229
  operation = ::Gapic::Rest::TransportOperation.new response
211
230
  result = ::Google::Shopping::Merchant::Accounts::V1beta::Account.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_accounts",
246
267
  options: options
247
268
  )
248
269
  operation = ::Gapic::Rest::TransportOperation.new response
249
270
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ListAccountsResponse.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
  ##
@@ -278,16 +300,18 @@ module Google
278
300
 
279
301
  response = @client_stub.make_http_request(
280
302
  verb,
281
- uri: uri,
282
- body: body || "",
283
- params: query_string_params,
303
+ uri: uri,
304
+ body: body || "",
305
+ params: query_string_params,
306
+ method_name: "list_sub_accounts",
284
307
  options: options
285
308
  )
286
309
  operation = ::Gapic::Rest::TransportOperation.new response
287
310
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ListSubAccountsResponse.decode_json response.body, ignore_unknown_fields: true
288
-
289
- yield result, operation if block_given?
290
- result
311
+ catch :response do
312
+ yield result, operation if block_given?
313
+ result
314
+ end
291
315
  end
292
316
 
293
317
  ##
@@ -164,8 +164,28 @@ module Google
164
164
  universe_domain: @config.universe_domain,
165
165
  channel_args: @config.channel_args,
166
166
  interceptors: @config.interceptors,
167
- channel_pool_config: @config.channel_pool
167
+ channel_pool_config: @config.channel_pool,
168
+ logger: @config.logger
168
169
  )
170
+
171
+ @autofeed_settings_service_stub.stub_logger&.info do |entry|
172
+ entry.set_system_name
173
+ entry.set_service
174
+ entry.message = "Created client for #{entry.service}"
175
+ entry.set_credentials_fields credentials
176
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
177
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
178
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
179
+ end
180
+ end
181
+
182
+ ##
183
+ # The logger used for request/response debug logging.
184
+ #
185
+ # @return [Logger]
186
+ #
187
+ def logger
188
+ @autofeed_settings_service_stub.logger
169
189
  end
170
190
 
171
191
  # Service calls
@@ -251,7 +271,6 @@ module Google
251
271
 
252
272
  @autofeed_settings_service_stub.call_rpc :get_autofeed_settings, 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)
@@ -339,7 +358,6 @@ module Google
339
358
 
340
359
  @autofeed_settings_service_stub.call_rpc :update_autofeed_settings, request, options: options do |response, operation|
341
360
  yield response, operation if block_given?
342
- return response
343
361
  end
344
362
  rescue ::GRPC::BadStatus => e
345
363
  raise ::Google::Cloud::Error.from_error(e)
@@ -389,6 +407,13 @@ module Google
389
407
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
390
408
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
391
409
  # * (`nil`) indicating no credentials
410
+ #
411
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
412
+ # external source for authentication to Google Cloud, you must validate it before
413
+ # providing it to a Google API client library. Providing an unvalidated credential
414
+ # configuration to Google APIs can compromise the security of your systems and data.
415
+ # For more information, refer to [Validate credential configurations from external
416
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
392
417
  # @return [::Object]
393
418
  # @!attribute [rw] scope
394
419
  # The OAuth scopes
@@ -428,6 +453,11 @@ module Google
428
453
  # default endpoint URL. The default value of nil uses the environment
429
454
  # universe (usually the default "googleapis.com" universe).
430
455
  # @return [::String,nil]
456
+ # @!attribute [rw] logger
457
+ # A custom logger to use for request/response debug logging, or the value
458
+ # `:default` (the default) to construct a default logger, or `nil` to
459
+ # explicitly disable logging.
460
+ # @return [::Logger,:default,nil]
431
461
  #
432
462
  class Configuration
433
463
  extend ::Gapic::Config
@@ -452,6 +482,7 @@ module Google
452
482
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
453
483
  config_attr :quota_project, nil, ::String, nil
454
484
  config_attr :universe_domain, nil, ::String, nil
485
+ config_attr :logger, :default, ::Logger, nil, :default
455
486
 
456
487
  # @private
457
488
  def initialize parent_config = nil
@@ -157,8 +157,28 @@ module Google
157
157
  endpoint: @config.endpoint,
158
158
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
159
159
  universe_domain: @config.universe_domain,
160
- credentials: credentials
160
+ credentials: credentials,
161
+ logger: @config.logger
161
162
  )
163
+
164
+ @autofeed_settings_service_stub.logger(stub: true)&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+ end
174
+
175
+ ##
176
+ # The logger used for request/response debug logging.
177
+ #
178
+ # @return [Logger]
179
+ #
180
+ def logger
181
+ @autofeed_settings_service_stub.logger
162
182
  end
163
183
 
164
184
  # Service calls
@@ -237,7 +257,6 @@ module Google
237
257
 
238
258
  @autofeed_settings_service_stub.get_autofeed_settings 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)
@@ -318,7 +337,6 @@ module Google
318
337
 
319
338
  @autofeed_settings_service_stub.update_autofeed_settings request, options do |result, operation|
320
339
  yield result, operation if block_given?
321
- return result
322
340
  end
323
341
  rescue ::Gapic::Rest::Error => e
324
342
  raise ::Google::Cloud::Error.from_error(e)
@@ -366,6 +384,13 @@ module Google
366
384
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
367
385
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
368
386
  # * (`nil`) indicating no credentials
387
+ #
388
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
389
+ # external source for authentication to Google Cloud, you must validate it before
390
+ # providing it to a Google API client library. Providing an unvalidated credential
391
+ # configuration to Google APIs can compromise the security of your systems and data.
392
+ # For more information, refer to [Validate credential configurations from external
393
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
369
394
  # @return [::Object]
370
395
  # @!attribute [rw] scope
371
396
  # The OAuth scopes
@@ -398,6 +423,11 @@ module Google
398
423
  # default endpoint URL. The default value of nil uses the environment
399
424
  # universe (usually the default "googleapis.com" universe).
400
425
  # @return [::String,nil]
426
+ # @!attribute [rw] logger
427
+ # A custom logger to use for request/response debug logging, or the value
428
+ # `:default` (the default) to construct a default logger, or `nil` to
429
+ # explicitly disable logging.
430
+ # @return [::Logger,:default,nil]
401
431
  #
402
432
  class Configuration
403
433
  extend ::Gapic::Config
@@ -419,6 +449,7 @@ module Google
419
449
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
420
450
  config_attr :quota_project, nil, ::String, nil
421
451
  config_attr :universe_domain, nil, ::String, nil
452
+ config_attr :logger, :default, ::Logger, nil, :default
422
453
 
423
454
  # @private
424
455
  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_autofeed_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_autofeed_settings",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings.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_autofeed_settings",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::AutofeedSettings.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
  ##