google-shopping-css-v1 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6b746bf5a019a61dd551fc2cd593a1c574a148ecbfd870f346dad31250f80ad7
4
- data.tar.gz: bcdcd37bebf4616bfe69b8dc51cc0de71b4c02f68fe5d9f47ea679a2d45eebbd
3
+ metadata.gz: bda43fc2e371e0f840f6988583fd7deff5b61849f41b0a1152eeeb76654c6db7
4
+ data.tar.gz: fd2a8f220821a43de4173e85ec0328225a799199d61d6361f0a1c2311033e844
5
5
  SHA512:
6
- metadata.gz: e67711ee9ff45e23ac4800bd2f0e9a3abf66bf43392b81e8b840f2cc7fd984d1997b141a83b3878a465f81686da82d306092eb8dd95da3260136024680697993
7
- data.tar.gz: 952a4ac7432afe7038beee56152ea69ec515ea6b848eab098e46a6f6492965d23f2096a019836df11ef386b956f12361d540158188b95516f34e27dfa3e315ae
6
+ metadata.gz: 6cc8a73172ce899e45e87f626d8494bc707224084f26c819cc3cb4b70d7477c260f9ea5c92bf3e163f66c8119519a89de4212722277ef4cbb15e6a5e42f827fb
7
+ data.tar.gz: eced71ed2100ec0a6998ae9486ba5cc0d467ca49297dab3dbe7949b222bf2e1927e95bdc268307f070b8af0b12e4afd0384f45346c49a0e9ebcd409162329b51
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://developers.google.com/comparison-shopping-services/api)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/shopping/css/v1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Shopping::Css::V1::AccountsService::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -168,8 +168,28 @@ module Google
168
168
  universe_domain: @config.universe_domain,
169
169
  channel_args: @config.channel_args,
170
170
  interceptors: @config.interceptors,
171
- channel_pool_config: @config.channel_pool
171
+ channel_pool_config: @config.channel_pool,
172
+ logger: @config.logger
172
173
  )
174
+
175
+ @account_labels_service_stub.stub_logger&.info do |entry|
176
+ entry.set_system_name
177
+ entry.set_service
178
+ entry.message = "Created client for #{entry.service}"
179
+ entry.set_credentials_fields credentials
180
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
181
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
182
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
183
+ end
184
+ end
185
+
186
+ ##
187
+ # The logger used for request/response debug logging.
188
+ #
189
+ # @return [Logger]
190
+ #
191
+ def logger
192
+ @account_labels_service_stub.logger
173
193
  end
174
194
 
175
195
  # Service calls
@@ -271,7 +291,7 @@ module Google
271
291
  @account_labels_service_stub.call_rpc :list_account_labels, request, options: options do |response, operation|
272
292
  response = ::Gapic::PagedEnumerable.new @account_labels_service_stub, :list_account_labels, request, response, operation, options
273
293
  yield response, operation if block_given?
274
- return response
294
+ throw :response, response
275
295
  end
276
296
  rescue ::GRPC::BadStatus => e
277
297
  raise ::Google::Cloud::Error.from_error(e)
@@ -360,7 +380,6 @@ module Google
360
380
 
361
381
  @account_labels_service_stub.call_rpc :create_account_label, request, options: options do |response, operation|
362
382
  yield response, operation if block_given?
363
- return response
364
383
  end
365
384
  rescue ::GRPC::BadStatus => e
366
385
  raise ::Google::Cloud::Error.from_error(e)
@@ -446,7 +465,6 @@ module Google
446
465
 
447
466
  @account_labels_service_stub.call_rpc :update_account_label, request, options: options do |response, operation|
448
467
  yield response, operation if block_given?
449
- return response
450
468
  end
451
469
  rescue ::GRPC::BadStatus => e
452
470
  raise ::Google::Cloud::Error.from_error(e)
@@ -533,7 +551,6 @@ module Google
533
551
 
534
552
  @account_labels_service_stub.call_rpc :delete_account_label, request, options: options do |response, operation|
535
553
  yield response, operation if block_given?
536
- return response
537
554
  end
538
555
  rescue ::GRPC::BadStatus => e
539
556
  raise ::Google::Cloud::Error.from_error(e)
@@ -622,6 +639,11 @@ module Google
622
639
  # default endpoint URL. The default value of nil uses the environment
623
640
  # universe (usually the default "googleapis.com" universe).
624
641
  # @return [::String,nil]
642
+ # @!attribute [rw] logger
643
+ # A custom logger to use for request/response debug logging, or the value
644
+ # `:default` (the default) to construct a default logger, or `nil` to
645
+ # explicitly disable logging.
646
+ # @return [::Logger,:default,nil]
625
647
  #
626
648
  class Configuration
627
649
  extend ::Gapic::Config
@@ -646,6 +668,7 @@ module Google
646
668
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
647
669
  config_attr :quota_project, nil, ::String, nil
648
670
  config_attr :universe_domain, nil, ::String, nil
671
+ config_attr :logger, :default, ::Logger, nil, :default
649
672
 
650
673
  # @private
651
674
  def initialize parent_config = nil
@@ -161,8 +161,28 @@ module Google
161
161
  endpoint: @config.endpoint,
162
162
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
163
  universe_domain: @config.universe_domain,
164
- credentials: credentials
164
+ credentials: credentials,
165
+ logger: @config.logger
165
166
  )
167
+
168
+ @account_labels_service_stub.logger(stub: true)&.info do |entry|
169
+ entry.set_system_name
170
+ entry.set_service
171
+ entry.message = "Created client for #{entry.service}"
172
+ entry.set_credentials_fields credentials
173
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
174
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
175
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
176
+ end
177
+ end
178
+
179
+ ##
180
+ # The logger used for request/response debug logging.
181
+ #
182
+ # @return [Logger]
183
+ #
184
+ def logger
185
+ @account_labels_service_stub.logger
166
186
  end
167
187
 
168
188
  # Service calls
@@ -257,7 +277,7 @@ module Google
257
277
  @account_labels_service_stub.list_account_labels request, options do |result, operation|
258
278
  result = ::Gapic::Rest::PagedEnumerable.new @account_labels_service_stub, :list_account_labels, "account_labels", request, result, options
259
279
  yield result, operation if block_given?
260
- return result
280
+ throw :response, result
261
281
  end
262
282
  rescue ::Gapic::Rest::Error => e
263
283
  raise ::Google::Cloud::Error.from_error(e)
@@ -339,7 +359,6 @@ module Google
339
359
 
340
360
  @account_labels_service_stub.create_account_label request, options do |result, operation|
341
361
  yield result, operation if block_given?
342
- return result
343
362
  end
344
363
  rescue ::Gapic::Rest::Error => e
345
364
  raise ::Google::Cloud::Error.from_error(e)
@@ -418,7 +437,6 @@ module Google
418
437
 
419
438
  @account_labels_service_stub.update_account_label request, options do |result, operation|
420
439
  yield result, operation if block_given?
421
- return result
422
440
  end
423
441
  rescue ::Gapic::Rest::Error => e
424
442
  raise ::Google::Cloud::Error.from_error(e)
@@ -498,7 +516,6 @@ module Google
498
516
 
499
517
  @account_labels_service_stub.delete_account_label request, options do |result, operation|
500
518
  yield result, operation if block_given?
501
- return result
502
519
  end
503
520
  rescue ::Gapic::Rest::Error => e
504
521
  raise ::Google::Cloud::Error.from_error(e)
@@ -578,6 +595,11 @@ module Google
578
595
  # default endpoint URL. The default value of nil uses the environment
579
596
  # universe (usually the default "googleapis.com" universe).
580
597
  # @return [::String,nil]
598
+ # @!attribute [rw] logger
599
+ # A custom logger to use for request/response debug logging, or the value
600
+ # `:default` (the default) to construct a default logger, or `nil` to
601
+ # explicitly disable logging.
602
+ # @return [::Logger,:default,nil]
581
603
  #
582
604
  class Configuration
583
605
  extend ::Gapic::Config
@@ -599,6 +621,7 @@ module Google
599
621
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
600
622
  config_attr :quota_project, nil, ::String, nil
601
623
  config_attr :universe_domain, nil, ::String, nil
624
+ config_attr :logger, :default, ::Logger, nil, :default
602
625
 
603
626
  # @private
604
627
  def initialize parent_config = nil
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the list_account_labels REST call
66
78
  #
@@ -87,16 +99,18 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "list_account_labels",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Shopping::Css::V1::ListAccountLabelsResponse.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "create_account_label",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Shopping::Css::V1::AccountLabel.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -163,16 +179,18 @@ module Google
163
179
 
164
180
  response = @client_stub.make_http_request(
165
181
  verb,
166
- uri: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "update_account_label",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Shopping::Css::V1::AccountLabel.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
176
194
  end
177
195
 
178
196
  ##
@@ -201,16 +219,18 @@ module Google
201
219
 
202
220
  response = @client_stub.make_http_request(
203
221
  verb,
204
- uri: uri,
205
- body: body || "",
206
- params: query_string_params,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "delete_account_label",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
211
-
212
- yield result, operation if block_given?
213
- result
230
+ catch :response do
231
+ yield result, operation if block_given?
232
+ result
233
+ end
214
234
  end
215
235
 
216
236
  ##
@@ -169,8 +169,28 @@ module Google
169
169
  universe_domain: @config.universe_domain,
170
170
  channel_args: @config.channel_args,
171
171
  interceptors: @config.interceptors,
172
- channel_pool_config: @config.channel_pool
172
+ channel_pool_config: @config.channel_pool,
173
+ logger: @config.logger
173
174
  )
175
+
176
+ @accounts_service_stub.stub_logger&.info do |entry|
177
+ entry.set_system_name
178
+ entry.set_service
179
+ entry.message = "Created client for #{entry.service}"
180
+ entry.set_credentials_fields credentials
181
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
182
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
183
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
184
+ end
185
+ end
186
+
187
+ ##
188
+ # The logger used for request/response debug logging.
189
+ #
190
+ # @return [Logger]
191
+ #
192
+ def logger
193
+ @accounts_service_stub.logger
174
194
  end
175
195
 
176
196
  # Service calls
@@ -278,7 +298,7 @@ module Google
278
298
  @accounts_service_stub.call_rpc :list_child_accounts, request, options: options do |response, operation|
279
299
  response = ::Gapic::PagedEnumerable.new @accounts_service_stub, :list_child_accounts, request, response, operation, options
280
300
  yield response, operation if block_given?
281
- return response
301
+ throw :response, response
282
302
  end
283
303
  rescue ::GRPC::BadStatus => e
284
304
  raise ::Google::Cloud::Error.from_error(e)
@@ -369,7 +389,6 @@ module Google
369
389
 
370
390
  @accounts_service_stub.call_rpc :get_account, request, options: options do |response, operation|
371
391
  yield response, operation if block_given?
372
- return response
373
392
  end
374
393
  rescue ::GRPC::BadStatus => e
375
394
  raise ::Google::Cloud::Error.from_error(e)
@@ -463,7 +482,6 @@ module Google
463
482
 
464
483
  @accounts_service_stub.call_rpc :update_labels, request, options: options do |response, operation|
465
484
  yield response, operation if block_given?
466
- return response
467
485
  end
468
486
  rescue ::GRPC::BadStatus => e
469
487
  raise ::Google::Cloud::Error.from_error(e)
@@ -552,6 +570,11 @@ module Google
552
570
  # default endpoint URL. The default value of nil uses the environment
553
571
  # universe (usually the default "googleapis.com" universe).
554
572
  # @return [::String,nil]
573
+ # @!attribute [rw] logger
574
+ # A custom logger to use for request/response debug logging, or the value
575
+ # `:default` (the default) to construct a default logger, or `nil` to
576
+ # explicitly disable logging.
577
+ # @return [::Logger,:default,nil]
555
578
  #
556
579
  class Configuration
557
580
  extend ::Gapic::Config
@@ -576,6 +599,7 @@ module Google
576
599
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
577
600
  config_attr :quota_project, nil, ::String, nil
578
601
  config_attr :universe_domain, nil, ::String, nil
602
+ config_attr :logger, :default, ::Logger, nil, :default
579
603
 
580
604
  # @private
581
605
  def initialize parent_config = nil
@@ -162,8 +162,28 @@ module Google
162
162
  endpoint: @config.endpoint,
163
163
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
164
164
  universe_domain: @config.universe_domain,
165
- credentials: credentials
165
+ credentials: credentials,
166
+ logger: @config.logger
166
167
  )
168
+
169
+ @accounts_service_stub.logger(stub: true)&.info do |entry|
170
+ entry.set_system_name
171
+ entry.set_service
172
+ entry.message = "Created client for #{entry.service}"
173
+ entry.set_credentials_fields credentials
174
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
175
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
176
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
177
+ end
178
+ end
179
+
180
+ ##
181
+ # The logger used for request/response debug logging.
182
+ #
183
+ # @return [Logger]
184
+ #
185
+ def logger
186
+ @accounts_service_stub.logger
167
187
  end
168
188
 
169
189
  # Service calls
@@ -264,7 +284,7 @@ module Google
264
284
  @accounts_service_stub.list_child_accounts request, options do |result, operation|
265
285
  result = ::Gapic::Rest::PagedEnumerable.new @accounts_service_stub, :list_child_accounts, "accounts", request, result, options
266
286
  yield result, operation if block_given?
267
- return result
287
+ throw :response, result
268
288
  end
269
289
  rescue ::Gapic::Rest::Error => e
270
290
  raise ::Google::Cloud::Error.from_error(e)
@@ -348,7 +368,6 @@ module Google
348
368
 
349
369
  @accounts_service_stub.get_account request, options do |result, operation|
350
370
  yield result, operation if block_given?
351
- return result
352
371
  end
353
372
  rescue ::Gapic::Rest::Error => e
354
373
  raise ::Google::Cloud::Error.from_error(e)
@@ -435,7 +454,6 @@ module Google
435
454
 
436
455
  @accounts_service_stub.update_labels request, options do |result, operation|
437
456
  yield result, operation if block_given?
438
- return result
439
457
  end
440
458
  rescue ::Gapic::Rest::Error => e
441
459
  raise ::Google::Cloud::Error.from_error(e)
@@ -515,6 +533,11 @@ module Google
515
533
  # default endpoint URL. The default value of nil uses the environment
516
534
  # universe (usually the default "googleapis.com" universe).
517
535
  # @return [::String,nil]
536
+ # @!attribute [rw] logger
537
+ # A custom logger to use for request/response debug logging, or the value
538
+ # `:default` (the default) to construct a default logger, or `nil` to
539
+ # explicitly disable logging.
540
+ # @return [::Logger,:default,nil]
518
541
  #
519
542
  class Configuration
520
543
  extend ::Gapic::Config
@@ -536,6 +559,7 @@ module Google
536
559
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
537
560
  config_attr :quota_project, nil, ::String, nil
538
561
  config_attr :universe_domain, nil, ::String, nil
562
+ config_attr :logger, :default, ::Logger, nil, :default
539
563
 
540
564
  # @private
541
565
  def initialize parent_config = nil
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the list_child_accounts REST call
66
78
  #
@@ -87,16 +99,18 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "list_child_accounts",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Shopping::Css::V1::ListChildAccountsResponse.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "get_account",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Shopping::Css::V1::Account.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -163,16 +179,18 @@ module Google
163
179
 
164
180
  response = @client_stub.make_http_request(
165
181
  verb,
166
- uri: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "update_labels",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Shopping::Css::V1::Account.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
176
194
  end
177
195
 
178
196
  ##
@@ -162,8 +162,28 @@ module Google
162
162
  universe_domain: @config.universe_domain,
163
163
  channel_args: @config.channel_args,
164
164
  interceptors: @config.interceptors,
165
- channel_pool_config: @config.channel_pool
165
+ channel_pool_config: @config.channel_pool,
166
+ logger: @config.logger
166
167
  )
168
+
169
+ @css_product_inputs_service_stub.stub_logger&.info do |entry|
170
+ entry.set_system_name
171
+ entry.set_service
172
+ entry.message = "Created client for #{entry.service}"
173
+ entry.set_credentials_fields credentials
174
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
175
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
176
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
177
+ end
178
+ end
179
+
180
+ ##
181
+ # The logger used for request/response debug logging.
182
+ #
183
+ # @return [Logger]
184
+ #
185
+ def logger
186
+ @css_product_inputs_service_stub.logger
167
187
  end
168
188
 
169
189
  # Service calls
@@ -262,7 +282,6 @@ module Google
262
282
 
263
283
  @css_product_inputs_service_stub.call_rpc :insert_css_product_input, request, options: options do |response, operation|
264
284
  yield response, operation if block_given?
265
- return response
266
285
  end
267
286
  rescue ::GRPC::BadStatus => e
268
287
  raise ::Google::Cloud::Error.from_error(e)
@@ -357,7 +376,6 @@ module Google
357
376
 
358
377
  @css_product_inputs_service_stub.call_rpc :delete_css_product_input, request, options: options do |response, operation|
359
378
  yield response, operation if block_given?
360
- return response
361
379
  end
362
380
  rescue ::GRPC::BadStatus => e
363
381
  raise ::Google::Cloud::Error.from_error(e)
@@ -446,6 +464,11 @@ module Google
446
464
  # default endpoint URL. The default value of nil uses the environment
447
465
  # universe (usually the default "googleapis.com" universe).
448
466
  # @return [::String,nil]
467
+ # @!attribute [rw] logger
468
+ # A custom logger to use for request/response debug logging, or the value
469
+ # `:default` (the default) to construct a default logger, or `nil` to
470
+ # explicitly disable logging.
471
+ # @return [::Logger,:default,nil]
449
472
  #
450
473
  class Configuration
451
474
  extend ::Gapic::Config
@@ -470,6 +493,7 @@ module Google
470
493
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
471
494
  config_attr :quota_project, nil, ::String, nil
472
495
  config_attr :universe_domain, nil, ::String, nil
496
+ config_attr :logger, :default, ::Logger, nil, :default
473
497
 
474
498
  # @private
475
499
  def initialize parent_config = nil
@@ -155,8 +155,28 @@ module Google
155
155
  endpoint: @config.endpoint,
156
156
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
157
157
  universe_domain: @config.universe_domain,
158
- credentials: credentials
158
+ credentials: credentials,
159
+ logger: @config.logger
159
160
  )
161
+
162
+ @css_product_inputs_service_stub.logger(stub: true)&.info do |entry|
163
+ entry.set_system_name
164
+ entry.set_service
165
+ entry.message = "Created client for #{entry.service}"
166
+ entry.set_credentials_fields credentials
167
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
168
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
169
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
170
+ end
171
+ end
172
+
173
+ ##
174
+ # The logger used for request/response debug logging.
175
+ #
176
+ # @return [Logger]
177
+ #
178
+ def logger
179
+ @css_product_inputs_service_stub.logger
160
180
  end
161
181
 
162
182
  # Service calls
@@ -248,7 +268,6 @@ module Google
248
268
 
249
269
  @css_product_inputs_service_stub.insert_css_product_input request, options do |result, operation|
250
270
  yield result, operation if block_given?
251
- return result
252
271
  end
253
272
  rescue ::Gapic::Rest::Error => e
254
273
  raise ::Google::Cloud::Error.from_error(e)
@@ -336,7 +355,6 @@ module Google
336
355
 
337
356
  @css_product_inputs_service_stub.delete_css_product_input request, options do |result, operation|
338
357
  yield result, operation if block_given?
339
- return result
340
358
  end
341
359
  rescue ::Gapic::Rest::Error => e
342
360
  raise ::Google::Cloud::Error.from_error(e)
@@ -416,6 +434,11 @@ module Google
416
434
  # default endpoint URL. The default value of nil uses the environment
417
435
  # universe (usually the default "googleapis.com" universe).
418
436
  # @return [::String,nil]
437
+ # @!attribute [rw] logger
438
+ # A custom logger to use for request/response debug logging, or the value
439
+ # `:default` (the default) to construct a default logger, or `nil` to
440
+ # explicitly disable logging.
441
+ # @return [::Logger,:default,nil]
419
442
  #
420
443
  class Configuration
421
444
  extend ::Gapic::Config
@@ -437,6 +460,7 @@ module Google
437
460
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
438
461
  config_attr :quota_project, nil, ::String, nil
439
462
  config_attr :universe_domain, nil, ::String, nil
463
+ config_attr :logger, :default, ::Logger, nil, :default
440
464
 
441
465
  # @private
442
466
  def initialize parent_config = nil
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the insert_css_product_input REST call
66
78
  #
@@ -87,16 +99,18 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "insert_css_product_input",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Shopping::Css::V1::CssProductInput.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "delete_css_product_input",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -168,8 +168,28 @@ module Google
168
168
  universe_domain: @config.universe_domain,
169
169
  channel_args: @config.channel_args,
170
170
  interceptors: @config.interceptors,
171
- channel_pool_config: @config.channel_pool
171
+ channel_pool_config: @config.channel_pool,
172
+ logger: @config.logger
172
173
  )
174
+
175
+ @css_products_service_stub.stub_logger&.info do |entry|
176
+ entry.set_system_name
177
+ entry.set_service
178
+ entry.message = "Created client for #{entry.service}"
179
+ entry.set_credentials_fields credentials
180
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
181
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
182
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
183
+ end
184
+ end
185
+
186
+ ##
187
+ # The logger used for request/response debug logging.
188
+ #
189
+ # @return [Logger]
190
+ #
191
+ def logger
192
+ @css_products_service_stub.logger
173
193
  end
174
194
 
175
195
  # Service calls
@@ -256,7 +276,6 @@ module Google
256
276
 
257
277
  @css_products_service_stub.call_rpc :get_css_product, request, options: options do |response, operation|
258
278
  yield response, operation if block_given?
259
- return response
260
279
  end
261
280
  rescue ::GRPC::BadStatus => e
262
281
  raise ::Google::Cloud::Error.from_error(e)
@@ -365,7 +384,7 @@ module Google
365
384
  @css_products_service_stub.call_rpc :list_css_products, request, options: options do |response, operation|
366
385
  response = ::Gapic::PagedEnumerable.new @css_products_service_stub, :list_css_products, request, response, operation, options
367
386
  yield response, operation if block_given?
368
- return response
387
+ throw :response, response
369
388
  end
370
389
  rescue ::GRPC::BadStatus => e
371
390
  raise ::Google::Cloud::Error.from_error(e)
@@ -454,6 +473,11 @@ module Google
454
473
  # default endpoint URL. The default value of nil uses the environment
455
474
  # universe (usually the default "googleapis.com" universe).
456
475
  # @return [::String,nil]
476
+ # @!attribute [rw] logger
477
+ # A custom logger to use for request/response debug logging, or the value
478
+ # `:default` (the default) to construct a default logger, or `nil` to
479
+ # explicitly disable logging.
480
+ # @return [::Logger,:default,nil]
457
481
  #
458
482
  class Configuration
459
483
  extend ::Gapic::Config
@@ -478,6 +502,7 @@ module Google
478
502
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
479
503
  config_attr :quota_project, nil, ::String, nil
480
504
  config_attr :universe_domain, nil, ::String, nil
505
+ config_attr :logger, :default, ::Logger, nil, :default
481
506
 
482
507
  # @private
483
508
  def initialize parent_config = nil
@@ -161,8 +161,28 @@ module Google
161
161
  endpoint: @config.endpoint,
162
162
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
163
163
  universe_domain: @config.universe_domain,
164
- credentials: credentials
164
+ credentials: credentials,
165
+ logger: @config.logger
165
166
  )
167
+
168
+ @css_products_service_stub.logger(stub: true)&.info do |entry|
169
+ entry.set_system_name
170
+ entry.set_service
171
+ entry.message = "Created client for #{entry.service}"
172
+ entry.set_credentials_fields credentials
173
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
174
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
175
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
176
+ end
177
+ end
178
+
179
+ ##
180
+ # The logger used for request/response debug logging.
181
+ #
182
+ # @return [Logger]
183
+ #
184
+ def logger
185
+ @css_products_service_stub.logger
166
186
  end
167
187
 
168
188
  # Service calls
@@ -242,7 +262,6 @@ module Google
242
262
 
243
263
  @css_products_service_stub.get_css_product request, options do |result, operation|
244
264
  yield result, operation if block_given?
245
- return result
246
265
  end
247
266
  rescue ::Gapic::Rest::Error => e
248
267
  raise ::Google::Cloud::Error.from_error(e)
@@ -344,7 +363,7 @@ module Google
344
363
  @css_products_service_stub.list_css_products request, options do |result, operation|
345
364
  result = ::Gapic::Rest::PagedEnumerable.new @css_products_service_stub, :list_css_products, "css_products", request, result, options
346
365
  yield result, operation if block_given?
347
- return result
366
+ throw :response, result
348
367
  end
349
368
  rescue ::Gapic::Rest::Error => e
350
369
  raise ::Google::Cloud::Error.from_error(e)
@@ -424,6 +443,11 @@ module Google
424
443
  # default endpoint URL. The default value of nil uses the environment
425
444
  # universe (usually the default "googleapis.com" universe).
426
445
  # @return [::String,nil]
446
+ # @!attribute [rw] logger
447
+ # A custom logger to use for request/response debug logging, or the value
448
+ # `:default` (the default) to construct a default logger, or `nil` to
449
+ # explicitly disable logging.
450
+ # @return [::Logger,:default,nil]
427
451
  #
428
452
  class Configuration
429
453
  extend ::Gapic::Config
@@ -445,6 +469,7 @@ module Google
445
469
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
446
470
  config_attr :quota_project, nil, ::String, nil
447
471
  config_attr :universe_domain, nil, ::String, nil
472
+ config_attr :logger, :default, ::Logger, nil, :default
448
473
 
449
474
  # @private
450
475
  def initialize parent_config = nil
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the get_css_product REST call
66
78
  #
@@ -87,16 +99,18 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "get_css_product",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Shopping::Css::V1::CssProduct.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "list_css_products",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Shopping::Css::V1::ListCssProductsResponse.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -21,7 +21,7 @@ module Google
21
21
  module Shopping
22
22
  module Css
23
23
  module V1
24
- VERSION = "0.2.1"
24
+ VERSION = "0.3.0"
25
25
  end
26
26
  end
27
27
  end
@@ -306,9 +306,28 @@ module Google
306
306
  # @!attribute [rw] common
307
307
  # @return [::Google::Api::CommonLanguageSettings]
308
308
  # Some settings.
309
+ # @!attribute [rw] renamed_services
310
+ # @return [::Google::Protobuf::Map{::String => ::String}]
311
+ # Map of service names to renamed services. Keys are the package relative
312
+ # service names and values are the name to be used for the service client
313
+ # and call options.
314
+ #
315
+ # publishing:
316
+ # go_settings:
317
+ # renamed_services:
318
+ # Publisher: TopicAdmin
309
319
  class GoSettings
310
320
  include ::Google::Protobuf::MessageExts
311
321
  extend ::Google::Protobuf::MessageExts::ClassMethods
322
+
323
+ # @!attribute [rw] key
324
+ # @return [::String]
325
+ # @!attribute [rw] value
326
+ # @return [::String]
327
+ class RenamedServicesEntry
328
+ include ::Google::Protobuf::MessageExts
329
+ extend ::Google::Protobuf::MessageExts::ClassMethods
330
+ end
312
331
  end
313
332
 
314
333
  # Describes the generator configuration for a method.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-shopping-css-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Google LLC
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-04 00:00:00.000000000 Z
11
+ date: 2024-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gapic-common
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 0.21.1
19
+ version: 0.24.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.a
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 0.21.1
29
+ version: 0.24.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.a
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  requirements: []
154
- rubygems_version: 3.5.22
154
+ rubygems_version: 3.5.23
155
155
  signing_key:
156
156
  specification_version: 4
157
157
  summary: Programmatically manage your Comparison Shopping Service (CSS) account data