google-ads-ad_manager-v1 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +37 -1
- data/lib/google/ads/ad_manager/v1/ad_unit_service/rest/client.rb +36 -4
- data/lib/google/ads/ad_manager/v1/ad_unit_service/rest/service_stub.rb +38 -20
- data/lib/google/ads/ad_manager/v1/company_service/rest/client.rb +35 -3
- data/lib/google/ads/ad_manager/v1/company_service/rest/service_stub.rb +30 -14
- data/lib/google/ads/ad_manager/v1/custom_field_service/rest/client.rb +35 -3
- data/lib/google/ads/ad_manager/v1/custom_field_service/rest/service_stub.rb +30 -14
- data/lib/google/ads/ad_manager/v1/custom_targeting_key_service/rest/client.rb +35 -3
- data/lib/google/ads/ad_manager/v1/custom_targeting_key_service/rest/service_stub.rb +30 -14
- data/lib/google/ads/ad_manager/v1/custom_targeting_value_service/rest/client.rb +35 -3
- data/lib/google/ads/ad_manager/v1/custom_targeting_value_service/rest/service_stub.rb +30 -14
- data/lib/google/ads/ad_manager/v1/entity_signals_mapping_service/rest/client.rb +35 -7
- data/lib/google/ads/ad_manager/v1/entity_signals_mapping_service/rest/service_stub.rb +62 -38
- data/lib/google/ads/ad_manager/v1/network_service/rest/client.rb +34 -3
- data/lib/google/ads/ad_manager/v1/network_service/rest/service_stub.rb +30 -14
- data/lib/google/ads/ad_manager/v1/order_service/rest/client.rb +35 -3
- data/lib/google/ads/ad_manager/v1/order_service/rest/service_stub.rb +30 -14
- data/lib/google/ads/ad_manager/v1/placement_service/rest/client.rb +35 -3
- data/lib/google/ads/ad_manager/v1/placement_service/rest/service_stub.rb +30 -14
- data/lib/google/ads/ad_manager/v1/report_service/rest/client.rb +36 -7
- data/lib/google/ads/ad_manager/v1/report_service/rest/operations.rb +50 -38
- data/lib/google/ads/ad_manager/v1/report_service/rest/service_stub.rb +62 -38
- data/lib/google/ads/ad_manager/v1/role_service/rest/client.rb +35 -3
- data/lib/google/ads/ad_manager/v1/role_service/rest/service_stub.rb +30 -14
- data/lib/google/ads/ad_manager/v1/taxonomy_category_service/rest/client.rb +35 -3
- data/lib/google/ads/ad_manager/v1/taxonomy_category_service/rest/service_stub.rb +30 -14
- data/lib/google/ads/ad_manager/v1/user_service/rest/client.rb +34 -2
- data/lib/google/ads/ad_manager/v1/user_service/rest/service_stub.rb +22 -8
- data/lib/google/ads/ad_manager/v1/version.rb +1 -1
- data/proto_docs/google/ads/admanager/v1/custom_field_value.rb +8 -0
- data/proto_docs/google/ads/admanager/v1/entity_signals_mapping_messages.rb +6 -0
- data/proto_docs/google/ads/admanager/v1/report_service.rb +34 -0
- data/proto_docs/google/api/client.rb +25 -0
- data/proto_docs/google/longrunning/operations.rb +23 -14
- metadata +6 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b50ffe84865aac9bed36e06d8389862229ecea586d29db6c842b9c1c42d51cb
|
4
|
+
data.tar.gz: aecc2ab99408e964bfd5566f5280d2bb8b5054641eaf6bc1372ba19d2ee216ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8bfef74a4bb63e634b6fb57abfbbad1a9055312897537d0e017a2db17f9859019bf451de84e94ebd8437fe5d3d3cfc4c851aecfe21d5bae2c7423fe25cb0fe47
|
7
|
+
data.tar.gz: 95d497f906f568685e8b1f37e3c04855a16baa38ab312b1f1a7b113613a590b22b18eaedf9ce028ef06627abe56ef88125f2b05c1960eba238ea601ccd20c716
|
data/README.md
CHANGED
@@ -43,6 +43,42 @@ for class and method documentation.
|
|
43
43
|
See also the [Product Documentation](https://developers.google.com/ad-manager/api/beta)
|
44
44
|
for general usage information.
|
45
45
|
|
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:
|
73
|
+
|
74
|
+
```ruby
|
75
|
+
require "google/ads/ad_manager/v1"
|
76
|
+
require "logger"
|
77
|
+
|
78
|
+
client = ::Google::Ads::AdManager::V1::AdUnitService::Rest::Client.new do |config|
|
79
|
+
config.logger = Logger.new "my-app.log"
|
80
|
+
end
|
81
|
+
```
|
46
82
|
|
47
83
|
## Google Cloud Samples
|
48
84
|
|
@@ -50,7 +86,7 @@ To browse ready to use code samples check [Google Cloud Samples](https://cloud.g
|
|
50
86
|
|
51
87
|
## Supported Ruby Versions
|
52
88
|
|
53
|
-
This library is supported on Ruby
|
89
|
+
This library is supported on Ruby 3.0+.
|
54
90
|
|
55
91
|
Google provides official support for Ruby versions that are actively supported
|
56
92
|
by Ruby Core—that is, Ruby versions that are either in normal maintenance or
|
@@ -150,8 +150,28 @@ module Google
|
|
150
150
|
endpoint: @config.endpoint,
|
151
151
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
152
152
|
universe_domain: @config.universe_domain,
|
153
|
-
credentials: credentials
|
153
|
+
credentials: credentials,
|
154
|
+
logger: @config.logger
|
154
155
|
)
|
156
|
+
|
157
|
+
@ad_unit_service_stub.logger(stub: true)&.info do |entry|
|
158
|
+
entry.set_system_name
|
159
|
+
entry.set_service
|
160
|
+
entry.message = "Created client for #{entry.service}"
|
161
|
+
entry.set_credentials_fields credentials
|
162
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
163
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
164
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
##
|
169
|
+
# The logger used for request/response debug logging.
|
170
|
+
#
|
171
|
+
# @return [Logger]
|
172
|
+
#
|
173
|
+
def logger
|
174
|
+
@ad_unit_service_stub.logger
|
155
175
|
end
|
156
176
|
|
157
177
|
# Service calls
|
@@ -230,7 +250,6 @@ module Google
|
|
230
250
|
|
231
251
|
@ad_unit_service_stub.get_ad_unit request, options do |result, operation|
|
232
252
|
yield result, operation if block_given?
|
233
|
-
return result
|
234
253
|
end
|
235
254
|
rescue ::Gapic::Rest::Error => e
|
236
255
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -336,7 +355,7 @@ module Google
|
|
336
355
|
@ad_unit_service_stub.list_ad_units request, options do |result, operation|
|
337
356
|
result = ::Gapic::Rest::PagedEnumerable.new @ad_unit_service_stub, :list_ad_units, "ad_units", request, result, options
|
338
357
|
yield result, operation if block_given?
|
339
|
-
|
358
|
+
throw :response, result
|
340
359
|
end
|
341
360
|
rescue ::Gapic::Rest::Error => e
|
342
361
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -442,7 +461,7 @@ module Google
|
|
442
461
|
@ad_unit_service_stub.list_ad_unit_sizes request, options do |result, operation|
|
443
462
|
result = ::Gapic::Rest::PagedEnumerable.new @ad_unit_service_stub, :list_ad_unit_sizes, "ad_unit_sizes", request, result, options
|
444
463
|
yield result, operation if block_given?
|
445
|
-
|
464
|
+
throw :response, result
|
446
465
|
end
|
447
466
|
rescue ::Gapic::Rest::Error => e
|
448
467
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -490,6 +509,13 @@ module Google
|
|
490
509
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
491
510
|
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
492
511
|
# * (`nil`) indicating no credentials
|
512
|
+
#
|
513
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
514
|
+
# external source for authentication to Google Cloud, you must validate it before
|
515
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
516
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
517
|
+
# For more information, refer to [Validate credential configurations from external
|
518
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
493
519
|
# @return [::Object]
|
494
520
|
# @!attribute [rw] scope
|
495
521
|
# The OAuth scopes
|
@@ -522,6 +548,11 @@ module Google
|
|
522
548
|
# default endpoint URL. The default value of nil uses the environment
|
523
549
|
# universe (usually the default "googleapis.com" universe).
|
524
550
|
# @return [::String,nil]
|
551
|
+
# @!attribute [rw] logger
|
552
|
+
# A custom logger to use for request/response debug logging, or the value
|
553
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
554
|
+
# explicitly disable logging.
|
555
|
+
# @return [::Logger,:default,nil]
|
525
556
|
#
|
526
557
|
class Configuration
|
527
558
|
extend ::Gapic::Config
|
@@ -543,6 +574,7 @@ module Google
|
|
543
574
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
544
575
|
config_attr :quota_project, nil, ::String, nil
|
545
576
|
config_attr :universe_domain, nil, ::String, nil
|
577
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
546
578
|
|
547
579
|
# @private
|
548
580
|
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
|
-
|
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
|
-
|
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_ad_unit 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:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "get_ad_unit",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Ads::AdManager::V1::AdUnit.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
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:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "list_ad_units",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Ads::AdManager::V1::ListAdUnitsResponse.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
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:
|
167
|
-
body:
|
168
|
-
params:
|
182
|
+
uri: uri,
|
183
|
+
body: body || "",
|
184
|
+
params: query_string_params,
|
185
|
+
method_name: "list_ad_unit_sizes",
|
169
186
|
options: options
|
170
187
|
)
|
171
188
|
operation = ::Gapic::Rest::TransportOperation.new response
|
172
189
|
result = ::Google::Ads::AdManager::V1::ListAdUnitSizesResponse.decode_json response.body, ignore_unknown_fields: true
|
173
|
-
|
174
|
-
|
175
|
-
|
190
|
+
catch :response do
|
191
|
+
yield result, operation if block_given?
|
192
|
+
result
|
193
|
+
end
|
176
194
|
end
|
177
195
|
|
178
196
|
##
|
@@ -150,8 +150,28 @@ module Google
|
|
150
150
|
endpoint: @config.endpoint,
|
151
151
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
152
152
|
universe_domain: @config.universe_domain,
|
153
|
-
credentials: credentials
|
153
|
+
credentials: credentials,
|
154
|
+
logger: @config.logger
|
154
155
|
)
|
156
|
+
|
157
|
+
@company_service_stub.logger(stub: true)&.info do |entry|
|
158
|
+
entry.set_system_name
|
159
|
+
entry.set_service
|
160
|
+
entry.message = "Created client for #{entry.service}"
|
161
|
+
entry.set_credentials_fields credentials
|
162
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
163
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
164
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
##
|
169
|
+
# The logger used for request/response debug logging.
|
170
|
+
#
|
171
|
+
# @return [Logger]
|
172
|
+
#
|
173
|
+
def logger
|
174
|
+
@company_service_stub.logger
|
155
175
|
end
|
156
176
|
|
157
177
|
# Service calls
|
@@ -230,7 +250,6 @@ module Google
|
|
230
250
|
|
231
251
|
@company_service_stub.get_company request, options do |result, operation|
|
232
252
|
yield result, operation if block_given?
|
233
|
-
return result
|
234
253
|
end
|
235
254
|
rescue ::Gapic::Rest::Error => e
|
236
255
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -336,7 +355,7 @@ module Google
|
|
336
355
|
@company_service_stub.list_companies request, options do |result, operation|
|
337
356
|
result = ::Gapic::Rest::PagedEnumerable.new @company_service_stub, :list_companies, "companies", request, result, options
|
338
357
|
yield result, operation if block_given?
|
339
|
-
|
358
|
+
throw :response, result
|
340
359
|
end
|
341
360
|
rescue ::Gapic::Rest::Error => e
|
342
361
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -384,6 +403,13 @@ module Google
|
|
384
403
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
385
404
|
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
386
405
|
# * (`nil`) indicating no credentials
|
406
|
+
#
|
407
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
408
|
+
# external source for authentication to Google Cloud, you must validate it before
|
409
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
410
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
411
|
+
# For more information, refer to [Validate credential configurations from external
|
412
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
387
413
|
# @return [::Object]
|
388
414
|
# @!attribute [rw] scope
|
389
415
|
# The OAuth scopes
|
@@ -416,6 +442,11 @@ module Google
|
|
416
442
|
# default endpoint URL. The default value of nil uses the environment
|
417
443
|
# universe (usually the default "googleapis.com" universe).
|
418
444
|
# @return [::String,nil]
|
445
|
+
# @!attribute [rw] logger
|
446
|
+
# A custom logger to use for request/response debug logging, or the value
|
447
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
448
|
+
# explicitly disable logging.
|
449
|
+
# @return [::Logger,:default,nil]
|
419
450
|
#
|
420
451
|
class Configuration
|
421
452
|
extend ::Gapic::Config
|
@@ -437,6 +468,7 @@ module Google
|
|
437
468
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
438
469
|
config_attr :quota_project, nil, ::String, nil
|
439
470
|
config_attr :universe_domain, nil, ::String, nil
|
471
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
440
472
|
|
441
473
|
# @private
|
442
474
|
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
|
-
|
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
|
-
|
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_company 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:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "get_company",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Ads::AdManager::V1::Company.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
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:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "list_companies",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Ads::AdManager::V1::ListCompaniesResponse.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|
@@ -150,8 +150,28 @@ module Google
|
|
150
150
|
endpoint: @config.endpoint,
|
151
151
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
152
152
|
universe_domain: @config.universe_domain,
|
153
|
-
credentials: credentials
|
153
|
+
credentials: credentials,
|
154
|
+
logger: @config.logger
|
154
155
|
)
|
156
|
+
|
157
|
+
@custom_field_service_stub.logger(stub: true)&.info do |entry|
|
158
|
+
entry.set_system_name
|
159
|
+
entry.set_service
|
160
|
+
entry.message = "Created client for #{entry.service}"
|
161
|
+
entry.set_credentials_fields credentials
|
162
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
163
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
164
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
##
|
169
|
+
# The logger used for request/response debug logging.
|
170
|
+
#
|
171
|
+
# @return [Logger]
|
172
|
+
#
|
173
|
+
def logger
|
174
|
+
@custom_field_service_stub.logger
|
155
175
|
end
|
156
176
|
|
157
177
|
# Service calls
|
@@ -230,7 +250,6 @@ module Google
|
|
230
250
|
|
231
251
|
@custom_field_service_stub.get_custom_field request, options do |result, operation|
|
232
252
|
yield result, operation if block_given?
|
233
|
-
return result
|
234
253
|
end
|
235
254
|
rescue ::Gapic::Rest::Error => e
|
236
255
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -336,7 +355,7 @@ module Google
|
|
336
355
|
@custom_field_service_stub.list_custom_fields request, options do |result, operation|
|
337
356
|
result = ::Gapic::Rest::PagedEnumerable.new @custom_field_service_stub, :list_custom_fields, "custom_fields", request, result, options
|
338
357
|
yield result, operation if block_given?
|
339
|
-
|
358
|
+
throw :response, result
|
340
359
|
end
|
341
360
|
rescue ::Gapic::Rest::Error => e
|
342
361
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -384,6 +403,13 @@ module Google
|
|
384
403
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
385
404
|
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
386
405
|
# * (`nil`) indicating no credentials
|
406
|
+
#
|
407
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
408
|
+
# external source for authentication to Google Cloud, you must validate it before
|
409
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
410
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
411
|
+
# For more information, refer to [Validate credential configurations from external
|
412
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
387
413
|
# @return [::Object]
|
388
414
|
# @!attribute [rw] scope
|
389
415
|
# The OAuth scopes
|
@@ -416,6 +442,11 @@ module Google
|
|
416
442
|
# default endpoint URL. The default value of nil uses the environment
|
417
443
|
# universe (usually the default "googleapis.com" universe).
|
418
444
|
# @return [::String,nil]
|
445
|
+
# @!attribute [rw] logger
|
446
|
+
# A custom logger to use for request/response debug logging, or the value
|
447
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
448
|
+
# explicitly disable logging.
|
449
|
+
# @return [::Logger,:default,nil]
|
419
450
|
#
|
420
451
|
class Configuration
|
421
452
|
extend ::Gapic::Config
|
@@ -437,6 +468,7 @@ module Google
|
|
437
468
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
438
469
|
config_attr :quota_project, nil, ::String, nil
|
439
470
|
config_attr :universe_domain, nil, ::String, nil
|
471
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
440
472
|
|
441
473
|
# @private
|
442
474
|
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
|
-
|
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
|
-
|
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_custom_field 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:
|
91
|
-
body:
|
92
|
-
params:
|
102
|
+
uri: uri,
|
103
|
+
body: body || "",
|
104
|
+
params: query_string_params,
|
105
|
+
method_name: "get_custom_field",
|
93
106
|
options: options
|
94
107
|
)
|
95
108
|
operation = ::Gapic::Rest::TransportOperation.new response
|
96
109
|
result = ::Google::Ads::AdManager::V1::CustomField.decode_json response.body, ignore_unknown_fields: true
|
97
|
-
|
98
|
-
|
99
|
-
|
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:
|
129
|
-
body:
|
130
|
-
params:
|
142
|
+
uri: uri,
|
143
|
+
body: body || "",
|
144
|
+
params: query_string_params,
|
145
|
+
method_name: "list_custom_fields",
|
131
146
|
options: options
|
132
147
|
)
|
133
148
|
operation = ::Gapic::Rest::TransportOperation.new response
|
134
149
|
result = ::Google::Ads::AdManager::V1::ListCustomFieldsResponse.decode_json response.body, ignore_unknown_fields: true
|
135
|
-
|
136
|
-
|
137
|
-
|
150
|
+
catch :response do
|
151
|
+
yield result, operation if block_given?
|
152
|
+
result
|
153
|
+
end
|
138
154
|
end
|
139
155
|
|
140
156
|
##
|