google-ads-ad_manager-v1 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +36 -0
- data/lib/google/ads/ad_manager/v1/ad_unit_service/rest/client.rb +29 -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 +28 -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 +28 -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 +28 -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 +28 -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 +28 -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 +27 -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 +28 -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 +28 -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 +29 -7
- data/lib/google/ads/ad_manager/v1/report_service/rest/operations.rb +43 -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 +28 -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 +28 -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 +27 -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/api/client.rb +25 -0
- data/proto_docs/google/longrunning/operations.rb +19 -14
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fe7d3ac168596923fe2115df67a0b60ac3ebdd50c1475ae9bfe54c2ce4d1933
|
4
|
+
data.tar.gz: 6fd0803d1766e722b5b1f050bac5918544ab88f6fff4d234b7c5d0c087029918
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80cc951e1c63ca69e02e285183fa6080803b5acd329a0a636bdf52a5e96c0702c35d3368582a98c18cd0911464da21110ca3e60dfd53665b543fe5c515351d3b
|
7
|
+
data.tar.gz: 8dda8bca40db772f50a99648b8d6cc4c9acaaad9ae309db76507e9e21ee06f8cc0ebe5715744f1d3a1095838649f797b7905d38c31330a9d0f1097a83fd9239e
|
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
|
|
@@ -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)
|
@@ -522,6 +541,11 @@ module Google
|
|
522
541
|
# default endpoint URL. The default value of nil uses the environment
|
523
542
|
# universe (usually the default "googleapis.com" universe).
|
524
543
|
# @return [::String,nil]
|
544
|
+
# @!attribute [rw] logger
|
545
|
+
# A custom logger to use for request/response debug logging, or the value
|
546
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
547
|
+
# explicitly disable logging.
|
548
|
+
# @return [::Logger,:default,nil]
|
525
549
|
#
|
526
550
|
class Configuration
|
527
551
|
extend ::Gapic::Config
|
@@ -543,6 +567,7 @@ module Google
|
|
543
567
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
544
568
|
config_attr :quota_project, nil, ::String, nil
|
545
569
|
config_attr :universe_domain, nil, ::String, nil
|
570
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
546
571
|
|
547
572
|
# @private
|
548
573
|
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)
|
@@ -416,6 +435,11 @@ module Google
|
|
416
435
|
# default endpoint URL. The default value of nil uses the environment
|
417
436
|
# universe (usually the default "googleapis.com" universe).
|
418
437
|
# @return [::String,nil]
|
438
|
+
# @!attribute [rw] logger
|
439
|
+
# A custom logger to use for request/response debug logging, or the value
|
440
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
441
|
+
# explicitly disable logging.
|
442
|
+
# @return [::Logger,:default,nil]
|
419
443
|
#
|
420
444
|
class Configuration
|
421
445
|
extend ::Gapic::Config
|
@@ -437,6 +461,7 @@ module Google
|
|
437
461
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
438
462
|
config_attr :quota_project, nil, ::String, nil
|
439
463
|
config_attr :universe_domain, nil, ::String, nil
|
464
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
440
465
|
|
441
466
|
# @private
|
442
467
|
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)
|
@@ -416,6 +435,11 @@ module Google
|
|
416
435
|
# default endpoint URL. The default value of nil uses the environment
|
417
436
|
# universe (usually the default "googleapis.com" universe).
|
418
437
|
# @return [::String,nil]
|
438
|
+
# @!attribute [rw] logger
|
439
|
+
# A custom logger to use for request/response debug logging, or the value
|
440
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
441
|
+
# explicitly disable logging.
|
442
|
+
# @return [::Logger,:default,nil]
|
419
443
|
#
|
420
444
|
class Configuration
|
421
445
|
extend ::Gapic::Config
|
@@ -437,6 +461,7 @@ module Google
|
|
437
461
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
438
462
|
config_attr :quota_project, nil, ::String, nil
|
439
463
|
config_attr :universe_domain, nil, ::String, nil
|
464
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
440
465
|
|
441
466
|
# @private
|
442
467
|
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
|
##
|
@@ -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_targeting_key_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_targeting_key_service_stub.logger
|
155
175
|
end
|
156
176
|
|
157
177
|
# Service calls
|
@@ -231,7 +251,6 @@ module Google
|
|
231
251
|
|
232
252
|
@custom_targeting_key_service_stub.get_custom_targeting_key request, options do |result, operation|
|
233
253
|
yield result, operation if block_given?
|
234
|
-
return result
|
235
254
|
end
|
236
255
|
rescue ::Gapic::Rest::Error => e
|
237
256
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -337,7 +356,7 @@ module Google
|
|
337
356
|
@custom_targeting_key_service_stub.list_custom_targeting_keys request, options do |result, operation|
|
338
357
|
result = ::Gapic::Rest::PagedEnumerable.new @custom_targeting_key_service_stub, :list_custom_targeting_keys, "custom_targeting_keys", request, result, options
|
339
358
|
yield result, operation if block_given?
|
340
|
-
|
359
|
+
throw :response, result
|
341
360
|
end
|
342
361
|
rescue ::Gapic::Rest::Error => e
|
343
362
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -417,6 +436,11 @@ module Google
|
|
417
436
|
# default endpoint URL. The default value of nil uses the environment
|
418
437
|
# universe (usually the default "googleapis.com" universe).
|
419
438
|
# @return [::String,nil]
|
439
|
+
# @!attribute [rw] logger
|
440
|
+
# A custom logger to use for request/response debug logging, or the value
|
441
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
442
|
+
# explicitly disable logging.
|
443
|
+
# @return [::Logger,:default,nil]
|
420
444
|
#
|
421
445
|
class Configuration
|
422
446
|
extend ::Gapic::Config
|
@@ -438,6 +462,7 @@ module Google
|
|
438
462
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
439
463
|
config_attr :quota_project, nil, ::String, nil
|
440
464
|
config_attr :universe_domain, nil, ::String, nil
|
465
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
441
466
|
|
442
467
|
# @private
|
443
468
|
def initialize parent_config = nil
|