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
+ @terms_of_service_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_service_stub.logger
168
188
  end
169
189
 
170
190
  # Service calls
@@ -250,7 +270,6 @@ module Google
250
270
 
251
271
  @terms_of_service_service_stub.call_rpc :get_terms_of_service, 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)
@@ -333,7 +352,6 @@ module Google
333
352
 
334
353
  @terms_of_service_service_stub.call_rpc :retrieve_latest_terms_of_service, request, options: options do |response, operation|
335
354
  yield response, operation if block_given?
336
- return response
337
355
  end
338
356
  rescue ::GRPC::BadStatus => e
339
357
  raise ::Google::Cloud::Error.from_error(e)
@@ -426,7 +444,6 @@ module Google
426
444
 
427
445
  @terms_of_service_service_stub.call_rpc :accept_terms_of_service, request, options: options do |response, operation|
428
446
  yield response, operation if block_given?
429
- return response
430
447
  end
431
448
  rescue ::GRPC::BadStatus => e
432
449
  raise ::Google::Cloud::Error.from_error(e)
@@ -476,6 +493,13 @@ module Google
476
493
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
477
494
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
478
495
  # * (`nil`) indicating no credentials
496
+ #
497
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
498
+ # external source for authentication to Google Cloud, you must validate it before
499
+ # providing it to a Google API client library. Providing an unvalidated credential
500
+ # configuration to Google APIs can compromise the security of your systems and data.
501
+ # For more information, refer to [Validate credential configurations from external
502
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
479
503
  # @return [::Object]
480
504
  # @!attribute [rw] scope
481
505
  # The OAuth scopes
@@ -515,6 +539,11 @@ module Google
515
539
  # default endpoint URL. The default value of nil uses the environment
516
540
  # universe (usually the default "googleapis.com" universe).
517
541
  # @return [::String,nil]
542
+ # @!attribute [rw] logger
543
+ # A custom logger to use for request/response debug logging, or the value
544
+ # `:default` (the default) to construct a default logger, or `nil` to
545
+ # explicitly disable logging.
546
+ # @return [::Logger,:default,nil]
518
547
  #
519
548
  class Configuration
520
549
  extend ::Gapic::Config
@@ -539,6 +568,7 @@ module Google
539
568
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
540
569
  config_attr :quota_project, nil, ::String, nil
541
570
  config_attr :universe_domain, nil, ::String, nil
571
+ config_attr :logger, :default, ::Logger, nil, :default
542
572
 
543
573
  # @private
544
574
  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_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_service_stub.logger
161
181
  end
162
182
 
163
183
  # Service calls
@@ -236,7 +256,6 @@ module Google
236
256
 
237
257
  @terms_of_service_service_stub.get_terms_of_service 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)
@@ -320,7 +339,6 @@ module Google
320
339
 
321
340
  @terms_of_service_service_stub.retrieve_latest_terms_of_service request, options do |result, operation|
322
341
  yield result, operation if block_given?
323
- return result
324
342
  end
325
343
  rescue ::Gapic::Rest::Error => e
326
344
  raise ::Google::Cloud::Error.from_error(e)
@@ -406,7 +424,6 @@ module Google
406
424
 
407
425
  @terms_of_service_service_stub.accept_terms_of_service request, options do |result, operation|
408
426
  yield result, operation if block_given?
409
- return result
410
427
  end
411
428
  rescue ::Gapic::Rest::Error => e
412
429
  raise ::Google::Cloud::Error.from_error(e)
@@ -454,6 +471,13 @@ module Google
454
471
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
455
472
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
456
473
  # * (`nil`) indicating no credentials
474
+ #
475
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
476
+ # external source for authentication to Google Cloud, you must validate it before
477
+ # providing it to a Google API client library. Providing an unvalidated credential
478
+ # configuration to Google APIs can compromise the security of your systems and data.
479
+ # For more information, refer to [Validate credential configurations from external
480
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
457
481
  # @return [::Object]
458
482
  # @!attribute [rw] scope
459
483
  # The OAuth scopes
@@ -486,6 +510,11 @@ module Google
486
510
  # default endpoint URL. The default value of nil uses the environment
487
511
  # universe (usually the default "googleapis.com" universe).
488
512
  # @return [::String,nil]
513
+ # @!attribute [rw] logger
514
+ # A custom logger to use for request/response debug logging, or the value
515
+ # `:default` (the default) to construct a default logger, or `nil` to
516
+ # explicitly disable logging.
517
+ # @return [::Logger,:default,nil]
489
518
  #
490
519
  class Configuration
491
520
  extend ::Gapic::Config
@@ -507,6 +536,7 @@ module Google
507
536
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
508
537
  config_attr :quota_project, nil, ::String, nil
509
538
  config_attr :universe_domain, nil, ::String, nil
539
+ config_attr :logger, :default, ::Logger, nil, :default
510
540
 
511
541
  # @private
512
542
  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 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",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::TermsOfService.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_latest_terms_of_service",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::TermsOfService.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: "accept_terms_of_service",
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
  ##
@@ -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
+ @user_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
+ @user_service_stub.logger
168
188
  end
169
189
 
170
190
  # Service calls
@@ -254,7 +274,6 @@ module Google
254
274
 
255
275
  @user_service_stub.call_rpc :get_user, 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)
@@ -347,7 +366,6 @@ module Google
347
366
 
348
367
  @user_service_stub.call_rpc :create_user, request, options: options do |response, operation|
349
368
  yield response, operation if block_given?
350
- return response
351
369
  end
352
370
  rescue ::GRPC::BadStatus => e
353
371
  raise ::Google::Cloud::Error.from_error(e)
@@ -438,7 +456,6 @@ module Google
438
456
 
439
457
  @user_service_stub.call_rpc :delete_user, 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)
@@ -530,7 +547,6 @@ module Google
530
547
 
531
548
  @user_service_stub.call_rpc :update_user, request, options: options do |response, operation|
532
549
  yield response, operation if block_given?
533
- return response
534
550
  end
535
551
  rescue ::GRPC::BadStatus => e
536
552
  raise ::Google::Cloud::Error.from_error(e)
@@ -632,7 +648,7 @@ module Google
632
648
  @user_service_stub.call_rpc :list_users, request, options: options do |response, operation|
633
649
  response = ::Gapic::PagedEnumerable.new @user_service_stub, :list_users, request, response, operation, options
634
650
  yield response, operation if block_given?
635
- return response
651
+ throw :response, response
636
652
  end
637
653
  rescue ::GRPC::BadStatus => e
638
654
  raise ::Google::Cloud::Error.from_error(e)
@@ -682,6 +698,13 @@ module Google
682
698
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
683
699
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
684
700
  # * (`nil`) indicating no credentials
701
+ #
702
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
703
+ # external source for authentication to Google Cloud, you must validate it before
704
+ # providing it to a Google API client library. Providing an unvalidated credential
705
+ # configuration to Google APIs can compromise the security of your systems and data.
706
+ # For more information, refer to [Validate credential configurations from external
707
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
685
708
  # @return [::Object]
686
709
  # @!attribute [rw] scope
687
710
  # The OAuth scopes
@@ -721,6 +744,11 @@ module Google
721
744
  # default endpoint URL. The default value of nil uses the environment
722
745
  # universe (usually the default "googleapis.com" universe).
723
746
  # @return [::String,nil]
747
+ # @!attribute [rw] logger
748
+ # A custom logger to use for request/response debug logging, or the value
749
+ # `:default` (the default) to construct a default logger, or `nil` to
750
+ # explicitly disable logging.
751
+ # @return [::Logger,:default,nil]
724
752
  #
725
753
  class Configuration
726
754
  extend ::Gapic::Config
@@ -745,6 +773,7 @@ module Google
745
773
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
746
774
  config_attr :quota_project, nil, ::String, nil
747
775
  config_attr :universe_domain, nil, ::String, nil
776
+ config_attr :logger, :default, ::Logger, nil, :default
748
777
 
749
778
  # @private
750
779
  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
+ @user_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
+ @user_service_stub.logger
161
181
  end
162
182
 
163
183
  # Service calls
@@ -240,7 +260,6 @@ module Google
240
260
 
241
261
  @user_service_stub.get_user 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)
@@ -326,7 +345,6 @@ module Google
326
345
 
327
346
  @user_service_stub.create_user request, options do |result, operation|
328
347
  yield result, operation if block_given?
329
- return result
330
348
  end
331
349
  rescue ::Gapic::Rest::Error => e
332
350
  raise ::Google::Cloud::Error.from_error(e)
@@ -410,7 +428,6 @@ module Google
410
428
 
411
429
  @user_service_stub.delete_user 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)
@@ -495,7 +512,6 @@ module Google
495
512
 
496
513
  @user_service_stub.update_user request, options do |result, operation|
497
514
  yield result, operation if block_given?
498
- return result
499
515
  end
500
516
  rescue ::Gapic::Rest::Error => e
501
517
  raise ::Google::Cloud::Error.from_error(e)
@@ -590,7 +606,7 @@ module Google
590
606
  @user_service_stub.list_users request, options do |result, operation|
591
607
  result = ::Gapic::Rest::PagedEnumerable.new @user_service_stub, :list_users, "users", request, result, options
592
608
  yield result, operation if block_given?
593
- return result
609
+ throw :response, result
594
610
  end
595
611
  rescue ::Gapic::Rest::Error => e
596
612
  raise ::Google::Cloud::Error.from_error(e)
@@ -638,6 +654,13 @@ module Google
638
654
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
639
655
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
640
656
  # * (`nil`) indicating no credentials
657
+ #
658
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
659
+ # external source for authentication to Google Cloud, you must validate it before
660
+ # providing it to a Google API client library. Providing an unvalidated credential
661
+ # configuration to Google APIs can compromise the security of your systems and data.
662
+ # For more information, refer to [Validate credential configurations from external
663
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
641
664
  # @return [::Object]
642
665
  # @!attribute [rw] scope
643
666
  # The OAuth scopes
@@ -670,6 +693,11 @@ module Google
670
693
  # default endpoint URL. The default value of nil uses the environment
671
694
  # universe (usually the default "googleapis.com" universe).
672
695
  # @return [::String,nil]
696
+ # @!attribute [rw] logger
697
+ # A custom logger to use for request/response debug logging, or the value
698
+ # `:default` (the default) to construct a default logger, or `nil` to
699
+ # explicitly disable logging.
700
+ # @return [::Logger,:default,nil]
673
701
  #
674
702
  class Configuration
675
703
  extend ::Gapic::Config
@@ -691,6 +719,7 @@ module Google
691
719
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
692
720
  config_attr :quota_project, nil, ::String, nil
693
721
  config_attr :universe_domain, nil, ::String, nil
722
+ config_attr :logger, :default, ::Logger, nil, :default
694
723
 
695
724
  # @private
696
725
  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_user 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_user",
94
107
  options: options
95
108
  )
96
109
  operation = ::Gapic::Rest::TransportOperation.new response
97
110
  result = ::Google::Shopping::Merchant::Accounts::V1beta::User.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_user",
132
147
  options: options
133
148
  )
134
149
  operation = ::Gapic::Rest::TransportOperation.new response
135
150
  result = ::Google::Shopping::Merchant::Accounts::V1beta::User.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_user",
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_user",
208
227
  options: options
209
228
  )
210
229
  operation = ::Gapic::Rest::TransportOperation.new response
211
230
  result = ::Google::Shopping::Merchant::Accounts::V1beta::User.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_users",
246
267
  options: options
247
268
  )
248
269
  operation = ::Gapic::Rest::TransportOperation.new response
249
270
  result = ::Google::Shopping::Merchant::Accounts::V1beta::ListUsersResponse.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
  ##
@@ -22,7 +22,7 @@ module Google
22
22
  module Merchant
23
23
  module Accounts
24
24
  module V1beta
25
- VERSION = "0.3.0"
25
+ VERSION = "0.5.0"
26
26
  end
27
27
  end
28
28
  end