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_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)
@@ -575,6 +591,13 @@ module Google
575
591
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
576
592
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
577
593
  # * (`nil`) indicating no credentials
594
+ #
595
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
596
+ # external source for authentication to Google Cloud, you must validate it before
597
+ # providing it to a Google API client library. Providing an unvalidated credential
598
+ # configuration to Google APIs can compromise the security of your systems and data.
599
+ # For more information, refer to [Validate credential configurations from external
600
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
578
601
  # @return [::Object]
579
602
  # @!attribute [rw] scope
580
603
  # The OAuth scopes
@@ -614,6 +637,11 @@ module Google
614
637
  # default endpoint URL. The default value of nil uses the environment
615
638
  # universe (usually the default "googleapis.com" universe).
616
639
  # @return [::String,nil]
640
+ # @!attribute [rw] logger
641
+ # A custom logger to use for request/response debug logging, or the value
642
+ # `:default` (the default) to construct a default logger, or `nil` to
643
+ # explicitly disable logging.
644
+ # @return [::Logger,:default,nil]
617
645
  #
618
646
  class Configuration
619
647
  extend ::Gapic::Config
@@ -638,6 +666,7 @@ module Google
638
666
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
639
667
  config_attr :quota_project, nil, ::String, nil
640
668
  config_attr :universe_domain, nil, ::String, nil
669
+ config_attr :logger, :default, ::Logger, nil, :default
641
670
 
642
671
  # @private
643
672
  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)
@@ -538,6 +554,13 @@ module Google
538
554
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
539
555
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
540
556
  # * (`nil`) indicating no credentials
557
+ #
558
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
559
+ # external source for authentication to Google Cloud, you must validate it before
560
+ # providing it to a Google API client library. Providing an unvalidated credential
561
+ # configuration to Google APIs can compromise the security of your systems and data.
562
+ # For more information, refer to [Validate credential configurations from external
563
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
541
564
  # @return [::Object]
542
565
  # @!attribute [rw] scope
543
566
  # The OAuth scopes
@@ -570,6 +593,11 @@ module Google
570
593
  # default endpoint URL. The default value of nil uses the environment
571
594
  # universe (usually the default "googleapis.com" universe).
572
595
  # @return [::String,nil]
596
+ # @!attribute [rw] logger
597
+ # A custom logger to use for request/response debug logging, or the value
598
+ # `:default` (the default) to construct a default logger, or `nil` to
599
+ # explicitly disable logging.
600
+ # @return [::Logger,:default,nil]
573
601
  #
574
602
  class Configuration
575
603
  extend ::Gapic::Config
@@ -591,6 +619,7 @@ module Google
591
619
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
592
620
  config_attr :quota_project, nil, ::String, nil
593
621
  config_attr :universe_domain, nil, ::String, nil
622
+ config_attr :logger, :default, ::Logger, nil, :default
594
623
 
595
624
  # @private
596
625
  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)
@@ -411,6 +430,13 @@ module Google
411
430
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
412
431
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
413
432
  # * (`nil`) indicating no credentials
433
+ #
434
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
435
+ # external source for authentication to Google Cloud, you must validate it before
436
+ # providing it to a Google API client library. Providing an unvalidated credential
437
+ # configuration to Google APIs can compromise the security of your systems and data.
438
+ # For more information, refer to [Validate credential configurations from external
439
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
414
440
  # @return [::Object]
415
441
  # @!attribute [rw] scope
416
442
  # The OAuth scopes
@@ -450,6 +476,11 @@ module Google
450
476
  # default endpoint URL. The default value of nil uses the environment
451
477
  # universe (usually the default "googleapis.com" universe).
452
478
  # @return [::String,nil]
479
+ # @!attribute [rw] logger
480
+ # A custom logger to use for request/response debug logging, or the value
481
+ # `:default` (the default) to construct a default logger, or `nil` to
482
+ # explicitly disable logging.
483
+ # @return [::Logger,:default,nil]
453
484
  #
454
485
  class Configuration
455
486
  extend ::Gapic::Config
@@ -474,6 +505,7 @@ module Google
474
505
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
475
506
  config_attr :quota_project, nil, ::String, nil
476
507
  config_attr :universe_domain, nil, ::String, nil
508
+ config_attr :logger, :default, ::Logger, nil, :default
477
509
 
478
510
  # @private
479
511
  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)
@@ -388,6 +407,13 @@ module Google
388
407
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
389
408
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
390
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).
391
417
  # @return [::Object]
392
418
  # @!attribute [rw] scope
393
419
  # The OAuth scopes
@@ -420,6 +446,11 @@ module Google
420
446
  # default endpoint URL. The default value of nil uses the environment
421
447
  # universe (usually the default "googleapis.com" universe).
422
448
  # @return [::String,nil]
449
+ # @!attribute [rw] logger
450
+ # A custom logger to use for request/response debug logging, or the value
451
+ # `:default` (the default) to construct a default logger, or `nil` to
452
+ # explicitly disable logging.
453
+ # @return [::Logger,:default,nil]
423
454
  #
424
455
  class Configuration
425
456
  extend ::Gapic::Config
@@ -441,6 +472,7 @@ module Google
441
472
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
442
473
  config_attr :quota_project, nil, ::String, nil
443
474
  config_attr :universe_domain, nil, ::String, nil
475
+ config_attr :logger, :default, ::Logger, nil, :default
444
476
 
445
477
  # @private
446
478
  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
  ##