google-cloud-recommendation_engine-v1beta1 0.6.1 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/AUTHENTICATION.md +72 -101
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/client.rb +42 -9
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/operations.rb +38 -7
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/rest/client.rb +141 -7
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/rest/operations.rb +108 -8
- data/lib/google/cloud/recommendation_engine/v1beta1/catalog_service/rest/service_stub.rb +14 -2
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/client.rb +41 -9
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/rest/client.rb +85 -7
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/rest/service_stub.rb +14 -2
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service/client.rb +41 -9
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service/rest/client.rb +53 -7
- data/lib/google/cloud/recommendation_engine/v1beta1/prediction_service/rest/service_stub.rb +14 -2
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/client.rb +42 -9
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/operations.rb +38 -7
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/rest/client.rb +132 -7
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/rest/operations.rb +108 -8
- data/lib/google/cloud/recommendation_engine/v1beta1/user_event_service/rest/service_stub.rb +14 -2
- data/lib/google/cloud/recommendation_engine/v1beta1/version.rb +1 -1
- data/proto_docs/google/api/client.rb +14 -0
- data/proto_docs/google/api/field_behavior.rb +14 -0
- metadata +5 -5
data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/rest/client.rb
CHANGED
@@ -36,6 +36,9 @@ module Google
|
|
36
36
|
# key. You can register up to 20 API keys per project.
|
37
37
|
#
|
38
38
|
class Client
|
39
|
+
# @private
|
40
|
+
DEFAULT_ENDPOINT_TEMPLATE = "recommendationengine.$UNIVERSE_DOMAIN$"
|
41
|
+
|
39
42
|
include Paths
|
40
43
|
|
41
44
|
# @private
|
@@ -111,6 +114,15 @@ module Google
|
|
111
114
|
@config
|
112
115
|
end
|
113
116
|
|
117
|
+
##
|
118
|
+
# The effective universe domain
|
119
|
+
#
|
120
|
+
# @return [String]
|
121
|
+
#
|
122
|
+
def universe_domain
|
123
|
+
@prediction_api_key_registry_stub.universe_domain
|
124
|
+
end
|
125
|
+
|
114
126
|
##
|
115
127
|
# Create a new PredictionApiKeyRegistry REST client object.
|
116
128
|
#
|
@@ -138,8 +150,9 @@ module Google
|
|
138
150
|
credentials = @config.credentials
|
139
151
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
140
152
|
# but only if the default endpoint does not have a region prefix.
|
141
|
-
enable_self_signed_jwt = @config.endpoint
|
142
|
-
|
153
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
154
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
155
|
+
!@config.endpoint.split(".").first.include?("-"))
|
143
156
|
credentials ||= Credentials.default scope: @config.scope,
|
144
157
|
enable_self_signed_jwt: enable_self_signed_jwt
|
145
158
|
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
@@ -149,7 +162,12 @@ module Google
|
|
149
162
|
@quota_project_id = @config.quota_project
|
150
163
|
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
151
164
|
|
152
|
-
@prediction_api_key_registry_stub = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Rest::ServiceStub.new
|
165
|
+
@prediction_api_key_registry_stub = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Rest::ServiceStub.new(
|
166
|
+
endpoint: @config.endpoint,
|
167
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
168
|
+
universe_domain: @config.universe_domain,
|
169
|
+
credentials: credentials
|
170
|
+
)
|
153
171
|
end
|
154
172
|
|
155
173
|
# Service calls
|
@@ -184,6 +202,22 @@ module Google
|
|
184
202
|
# @return [::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration]
|
185
203
|
#
|
186
204
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
205
|
+
#
|
206
|
+
# @example Basic example
|
207
|
+
# require "google/cloud/recommendation_engine/v1beta1"
|
208
|
+
#
|
209
|
+
# # Create a client object. The client can be reused for multiple calls.
|
210
|
+
# client = Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Rest::Client.new
|
211
|
+
#
|
212
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
213
|
+
# request = Google::Cloud::RecommendationEngine::V1beta1::CreatePredictionApiKeyRegistrationRequest.new
|
214
|
+
#
|
215
|
+
# # Call the create_prediction_api_key_registration method.
|
216
|
+
# result = client.create_prediction_api_key_registration request
|
217
|
+
#
|
218
|
+
# # The returned object is of type Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration.
|
219
|
+
# p result
|
220
|
+
#
|
187
221
|
def create_prediction_api_key_registration request, options = nil
|
188
222
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
189
223
|
|
@@ -252,6 +286,26 @@ module Google
|
|
252
286
|
# @return [::Gapic::Rest::PagedEnumerable<::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration>]
|
253
287
|
#
|
254
288
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
289
|
+
#
|
290
|
+
# @example Basic example
|
291
|
+
# require "google/cloud/recommendation_engine/v1beta1"
|
292
|
+
#
|
293
|
+
# # Create a client object. The client can be reused for multiple calls.
|
294
|
+
# client = Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Rest::Client.new
|
295
|
+
#
|
296
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
297
|
+
# request = Google::Cloud::RecommendationEngine::V1beta1::ListPredictionApiKeyRegistrationsRequest.new
|
298
|
+
#
|
299
|
+
# # Call the list_prediction_api_key_registrations method.
|
300
|
+
# result = client.list_prediction_api_key_registrations request
|
301
|
+
#
|
302
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
303
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
304
|
+
# result.each do |item|
|
305
|
+
# # Each element is of type ::Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistration.
|
306
|
+
# p item
|
307
|
+
# end
|
308
|
+
#
|
255
309
|
def list_prediction_api_key_registrations request, options = nil
|
256
310
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
257
311
|
|
@@ -316,6 +370,22 @@ module Google
|
|
316
370
|
# @return [::Google::Protobuf::Empty]
|
317
371
|
#
|
318
372
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
373
|
+
#
|
374
|
+
# @example Basic example
|
375
|
+
# require "google/cloud/recommendation_engine/v1beta1"
|
376
|
+
#
|
377
|
+
# # Create a client object. The client can be reused for multiple calls.
|
378
|
+
# client = Google::Cloud::RecommendationEngine::V1beta1::PredictionApiKeyRegistry::Rest::Client.new
|
379
|
+
#
|
380
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
381
|
+
# request = Google::Cloud::RecommendationEngine::V1beta1::DeletePredictionApiKeyRegistrationRequest.new
|
382
|
+
#
|
383
|
+
# # Call the delete_prediction_api_key_registration method.
|
384
|
+
# result = client.delete_prediction_api_key_registration request
|
385
|
+
#
|
386
|
+
# # The returned object is of type Google::Protobuf::Empty.
|
387
|
+
# p result
|
388
|
+
#
|
319
389
|
def delete_prediction_api_key_registration request, options = nil
|
320
390
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
321
391
|
|
@@ -381,9 +451,9 @@ module Google
|
|
381
451
|
# end
|
382
452
|
#
|
383
453
|
# @!attribute [rw] endpoint
|
384
|
-
#
|
385
|
-
#
|
386
|
-
# @return [::String]
|
454
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
455
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
456
|
+
# @return [::String,nil]
|
387
457
|
# @!attribute [rw] credentials
|
388
458
|
# Credentials to send with calls. You may provide any of the following types:
|
389
459
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -420,13 +490,20 @@ module Google
|
|
420
490
|
# @!attribute [rw] quota_project
|
421
491
|
# A separate project against which to charge quota.
|
422
492
|
# @return [::String]
|
493
|
+
# @!attribute [rw] universe_domain
|
494
|
+
# The universe domain within which to make requests. This determines the
|
495
|
+
# default endpoint URL. The default value of nil uses the environment
|
496
|
+
# universe (usually the default "googleapis.com" universe).
|
497
|
+
# @return [::String,nil]
|
423
498
|
#
|
424
499
|
class Configuration
|
425
500
|
extend ::Gapic::Config
|
426
501
|
|
502
|
+
# @private
|
503
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
427
504
|
DEFAULT_ENDPOINT = "recommendationengine.googleapis.com"
|
428
505
|
|
429
|
-
config_attr :endpoint,
|
506
|
+
config_attr :endpoint, nil, ::String, nil
|
430
507
|
config_attr :credentials, nil do |value|
|
431
508
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
432
509
|
allowed.any? { |klass| klass === value }
|
@@ -438,6 +515,7 @@ module Google
|
|
438
515
|
config_attr :metadata, nil, ::Hash, nil
|
439
516
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
440
517
|
config_attr :quota_project, nil, ::String, nil
|
518
|
+
config_attr :universe_domain, nil, ::String, nil
|
441
519
|
|
442
520
|
# @private
|
443
521
|
def initialize parent_config = nil
|
data/lib/google/cloud/recommendation_engine/v1beta1/prediction_api_key_registry/rest/service_stub.rb
CHANGED
@@ -30,16 +30,28 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
def initialize endpoint:, credentials:
|
33
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
|
34
34
|
# These require statements are intentionally placed here to initialize
|
35
35
|
# the REST modules only when it's required.
|
36
36
|
require "gapic/rest"
|
37
37
|
|
38
|
-
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
38
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
39
|
+
endpoint_template: endpoint_template,
|
40
|
+
universe_domain: universe_domain,
|
41
|
+
credentials: credentials,
|
39
42
|
numeric_enums: true,
|
40
43
|
raise_faraday_errors: false
|
41
44
|
end
|
42
45
|
|
46
|
+
##
|
47
|
+
# The effective universe domain
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
#
|
51
|
+
def universe_domain
|
52
|
+
@client_stub.universe_domain
|
53
|
+
end
|
54
|
+
|
43
55
|
##
|
44
56
|
# Baseline implementation for the create_prediction_api_key_registration REST call
|
45
57
|
#
|
@@ -30,6 +30,9 @@ module Google
|
|
30
30
|
# Service for making recommendation prediction.
|
31
31
|
#
|
32
32
|
class Client
|
33
|
+
# @private
|
34
|
+
DEFAULT_ENDPOINT_TEMPLATE = "recommendationengine.$UNIVERSE_DOMAIN$"
|
35
|
+
|
33
36
|
include Paths
|
34
37
|
|
35
38
|
# @private
|
@@ -95,6 +98,15 @@ module Google
|
|
95
98
|
@config
|
96
99
|
end
|
97
100
|
|
101
|
+
##
|
102
|
+
# The effective universe domain
|
103
|
+
#
|
104
|
+
# @return [String]
|
105
|
+
#
|
106
|
+
def universe_domain
|
107
|
+
@prediction_service_stub.universe_domain
|
108
|
+
end
|
109
|
+
|
98
110
|
##
|
99
111
|
# Create a new PredictionService client object.
|
100
112
|
#
|
@@ -128,8 +140,9 @@ module Google
|
|
128
140
|
credentials = @config.credentials
|
129
141
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
130
142
|
# but only if the default endpoint does not have a region prefix.
|
131
|
-
enable_self_signed_jwt = @config.endpoint
|
132
|
-
|
143
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
144
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
145
|
+
!@config.endpoint.split(".").first.include?("-"))
|
133
146
|
credentials ||= Credentials.default scope: @config.scope,
|
134
147
|
enable_self_signed_jwt: enable_self_signed_jwt
|
135
148
|
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
@@ -140,10 +153,13 @@ module Google
|
|
140
153
|
|
141
154
|
@prediction_service_stub = ::Gapic::ServiceStub.new(
|
142
155
|
::Google::Cloud::RecommendationEngine::V1beta1::PredictionService::Stub,
|
143
|
-
credentials:
|
144
|
-
endpoint:
|
156
|
+
credentials: credentials,
|
157
|
+
endpoint: @config.endpoint,
|
158
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
159
|
+
universe_domain: @config.universe_domain,
|
145
160
|
channel_args: @config.channel_args,
|
146
|
-
interceptors: @config.interceptors
|
161
|
+
interceptors: @config.interceptors,
|
162
|
+
channel_pool_config: @config.channel_pool
|
147
163
|
)
|
148
164
|
end
|
149
165
|
|
@@ -359,9 +375,9 @@ module Google
|
|
359
375
|
# end
|
360
376
|
#
|
361
377
|
# @!attribute [rw] endpoint
|
362
|
-
#
|
363
|
-
#
|
364
|
-
# @return [::String]
|
378
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
379
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
380
|
+
# @return [::String,nil]
|
365
381
|
# @!attribute [rw] credentials
|
366
382
|
# Credentials to send with calls. You may provide any of the following types:
|
367
383
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -407,13 +423,20 @@ module Google
|
|
407
423
|
# @!attribute [rw] quota_project
|
408
424
|
# A separate project against which to charge quota.
|
409
425
|
# @return [::String]
|
426
|
+
# @!attribute [rw] universe_domain
|
427
|
+
# The universe domain within which to make requests. This determines the
|
428
|
+
# default endpoint URL. The default value of nil uses the environment
|
429
|
+
# universe (usually the default "googleapis.com" universe).
|
430
|
+
# @return [::String,nil]
|
410
431
|
#
|
411
432
|
class Configuration
|
412
433
|
extend ::Gapic::Config
|
413
434
|
|
435
|
+
# @private
|
436
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
414
437
|
DEFAULT_ENDPOINT = "recommendationengine.googleapis.com"
|
415
438
|
|
416
|
-
config_attr :endpoint,
|
439
|
+
config_attr :endpoint, nil, ::String, nil
|
417
440
|
config_attr :credentials, nil do |value|
|
418
441
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
419
442
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -428,6 +451,7 @@ module Google
|
|
428
451
|
config_attr :metadata, nil, ::Hash, nil
|
429
452
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
430
453
|
config_attr :quota_project, nil, ::String, nil
|
454
|
+
config_attr :universe_domain, nil, ::String, nil
|
431
455
|
|
432
456
|
# @private
|
433
457
|
def initialize parent_config = nil
|
@@ -448,6 +472,14 @@ module Google
|
|
448
472
|
end
|
449
473
|
end
|
450
474
|
|
475
|
+
##
|
476
|
+
# Configuration for the channel pool
|
477
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
478
|
+
#
|
479
|
+
def channel_pool
|
480
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
481
|
+
end
|
482
|
+
|
451
483
|
##
|
452
484
|
# Configuration RPC class for the PredictionService API.
|
453
485
|
#
|
@@ -32,6 +32,9 @@ module Google
|
|
32
32
|
# Service for making recommendation prediction.
|
33
33
|
#
|
34
34
|
class Client
|
35
|
+
# @private
|
36
|
+
DEFAULT_ENDPOINT_TEMPLATE = "recommendationengine.$UNIVERSE_DOMAIN$"
|
37
|
+
|
35
38
|
include Paths
|
36
39
|
|
37
40
|
# @private
|
@@ -97,6 +100,15 @@ module Google
|
|
97
100
|
@config
|
98
101
|
end
|
99
102
|
|
103
|
+
##
|
104
|
+
# The effective universe domain
|
105
|
+
#
|
106
|
+
# @return [String]
|
107
|
+
#
|
108
|
+
def universe_domain
|
109
|
+
@prediction_service_stub.universe_domain
|
110
|
+
end
|
111
|
+
|
100
112
|
##
|
101
113
|
# Create a new PredictionService REST client object.
|
102
114
|
#
|
@@ -124,8 +136,9 @@ module Google
|
|
124
136
|
credentials = @config.credentials
|
125
137
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
126
138
|
# but only if the default endpoint does not have a region prefix.
|
127
|
-
enable_self_signed_jwt = @config.endpoint
|
128
|
-
|
139
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
140
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
141
|
+
!@config.endpoint.split(".").first.include?("-"))
|
129
142
|
credentials ||= Credentials.default scope: @config.scope,
|
130
143
|
enable_self_signed_jwt: enable_self_signed_jwt
|
131
144
|
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
@@ -135,7 +148,12 @@ module Google
|
|
135
148
|
@quota_project_id = @config.quota_project
|
136
149
|
@quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id
|
137
150
|
|
138
|
-
@prediction_service_stub = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionService::Rest::ServiceStub.new
|
151
|
+
@prediction_service_stub = ::Google::Cloud::RecommendationEngine::V1beta1::PredictionService::Rest::ServiceStub.new(
|
152
|
+
endpoint: @config.endpoint,
|
153
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
154
|
+
universe_domain: @config.universe_domain,
|
155
|
+
credentials: credentials
|
156
|
+
)
|
139
157
|
end
|
140
158
|
|
141
159
|
# Service calls
|
@@ -257,6 +275,26 @@ module Google
|
|
257
275
|
# @return [::Gapic::Rest::PagedEnumerable<::String, ::Google::Protobuf::Value>]
|
258
276
|
#
|
259
277
|
# @raise [::Google::Cloud::Error] if the REST call is aborted.
|
278
|
+
#
|
279
|
+
# @example Basic example
|
280
|
+
# require "google/cloud/recommendation_engine/v1beta1"
|
281
|
+
#
|
282
|
+
# # Create a client object. The client can be reused for multiple calls.
|
283
|
+
# client = Google::Cloud::RecommendationEngine::V1beta1::PredictionService::Rest::Client.new
|
284
|
+
#
|
285
|
+
# # Create a request. To set request fields, pass in keyword arguments.
|
286
|
+
# request = Google::Cloud::RecommendationEngine::V1beta1::PredictRequest.new
|
287
|
+
#
|
288
|
+
# # Call the predict method.
|
289
|
+
# result = client.predict request
|
290
|
+
#
|
291
|
+
# # The returned object is of type Gapic::PagedEnumerable. You can iterate
|
292
|
+
# # over elements, and API calls will be issued to fetch pages as needed.
|
293
|
+
# result.each do |item|
|
294
|
+
# # Each element is of type ::Google::Cloud::RecommendationEngine::V1beta1::PredictResponse::PredictionResult.
|
295
|
+
# p item
|
296
|
+
# end
|
297
|
+
#
|
260
298
|
def predict request, options = nil
|
261
299
|
raise ::ArgumentError, "request must be provided" if request.nil?
|
262
300
|
|
@@ -323,9 +361,9 @@ module Google
|
|
323
361
|
# end
|
324
362
|
#
|
325
363
|
# @!attribute [rw] endpoint
|
326
|
-
#
|
327
|
-
#
|
328
|
-
# @return [::String]
|
364
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
365
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
366
|
+
# @return [::String,nil]
|
329
367
|
# @!attribute [rw] credentials
|
330
368
|
# Credentials to send with calls. You may provide any of the following types:
|
331
369
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -362,13 +400,20 @@ module Google
|
|
362
400
|
# @!attribute [rw] quota_project
|
363
401
|
# A separate project against which to charge quota.
|
364
402
|
# @return [::String]
|
403
|
+
# @!attribute [rw] universe_domain
|
404
|
+
# The universe domain within which to make requests. This determines the
|
405
|
+
# default endpoint URL. The default value of nil uses the environment
|
406
|
+
# universe (usually the default "googleapis.com" universe).
|
407
|
+
# @return [::String,nil]
|
365
408
|
#
|
366
409
|
class Configuration
|
367
410
|
extend ::Gapic::Config
|
368
411
|
|
412
|
+
# @private
|
413
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
369
414
|
DEFAULT_ENDPOINT = "recommendationengine.googleapis.com"
|
370
415
|
|
371
|
-
config_attr :endpoint,
|
416
|
+
config_attr :endpoint, nil, ::String, nil
|
372
417
|
config_attr :credentials, nil do |value|
|
373
418
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
374
419
|
allowed.any? { |klass| klass === value }
|
@@ -380,6 +425,7 @@ module Google
|
|
380
425
|
config_attr :metadata, nil, ::Hash, nil
|
381
426
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
382
427
|
config_attr :quota_project, nil, ::String, nil
|
428
|
+
config_attr :universe_domain, nil, ::String, nil
|
383
429
|
|
384
430
|
# @private
|
385
431
|
def initialize parent_config = nil
|
@@ -30,16 +30,28 @@ module Google
|
|
30
30
|
# including transcoding, making the REST call, and deserialing the response.
|
31
31
|
#
|
32
32
|
class ServiceStub
|
33
|
-
def initialize endpoint:, credentials:
|
33
|
+
def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
|
34
34
|
# These require statements are intentionally placed here to initialize
|
35
35
|
# the REST modules only when it's required.
|
36
36
|
require "gapic/rest"
|
37
37
|
|
38
|
-
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
38
|
+
@client_stub = ::Gapic::Rest::ClientStub.new endpoint: endpoint,
|
39
|
+
endpoint_template: endpoint_template,
|
40
|
+
universe_domain: universe_domain,
|
41
|
+
credentials: credentials,
|
39
42
|
numeric_enums: true,
|
40
43
|
raise_faraday_errors: false
|
41
44
|
end
|
42
45
|
|
46
|
+
##
|
47
|
+
# The effective universe domain
|
48
|
+
#
|
49
|
+
# @return [String]
|
50
|
+
#
|
51
|
+
def universe_domain
|
52
|
+
@client_stub.universe_domain
|
53
|
+
end
|
54
|
+
|
43
55
|
##
|
44
56
|
# Baseline implementation for the predict REST call
|
45
57
|
#
|
@@ -30,6 +30,9 @@ module Google
|
|
30
30
|
# Service for ingesting end user actions on the customer website.
|
31
31
|
#
|
32
32
|
class Client
|
33
|
+
# @private
|
34
|
+
DEFAULT_ENDPOINT_TEMPLATE = "recommendationengine.$UNIVERSE_DOMAIN$"
|
35
|
+
|
33
36
|
include Paths
|
34
37
|
|
35
38
|
# @private
|
@@ -115,6 +118,15 @@ module Google
|
|
115
118
|
@config
|
116
119
|
end
|
117
120
|
|
121
|
+
##
|
122
|
+
# The effective universe domain
|
123
|
+
#
|
124
|
+
# @return [String]
|
125
|
+
#
|
126
|
+
def universe_domain
|
127
|
+
@user_event_service_stub.universe_domain
|
128
|
+
end
|
129
|
+
|
118
130
|
##
|
119
131
|
# Create a new UserEventService client object.
|
120
132
|
#
|
@@ -148,8 +160,9 @@ module Google
|
|
148
160
|
credentials = @config.credentials
|
149
161
|
# Use self-signed JWT if the endpoint is unchanged from default,
|
150
162
|
# but only if the default endpoint does not have a region prefix.
|
151
|
-
enable_self_signed_jwt = @config.endpoint
|
152
|
-
|
163
|
+
enable_self_signed_jwt = @config.endpoint.nil? ||
|
164
|
+
(@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
|
165
|
+
!@config.endpoint.split(".").first.include?("-"))
|
153
166
|
credentials ||= Credentials.default scope: @config.scope,
|
154
167
|
enable_self_signed_jwt: enable_self_signed_jwt
|
155
168
|
if credentials.is_a?(::String) || credentials.is_a?(::Hash)
|
@@ -162,14 +175,18 @@ module Google
|
|
162
175
|
config.credentials = credentials
|
163
176
|
config.quota_project = @quota_project_id
|
164
177
|
config.endpoint = @config.endpoint
|
178
|
+
config.universe_domain = @config.universe_domain
|
165
179
|
end
|
166
180
|
|
167
181
|
@user_event_service_stub = ::Gapic::ServiceStub.new(
|
168
182
|
::Google::Cloud::RecommendationEngine::V1beta1::UserEventService::Stub,
|
169
|
-
credentials:
|
170
|
-
endpoint:
|
183
|
+
credentials: credentials,
|
184
|
+
endpoint: @config.endpoint,
|
185
|
+
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
186
|
+
universe_domain: @config.universe_domain,
|
171
187
|
channel_args: @config.channel_args,
|
172
|
-
interceptors: @config.interceptors
|
188
|
+
interceptors: @config.interceptors,
|
189
|
+
channel_pool_config: @config.channel_pool
|
173
190
|
)
|
174
191
|
end
|
175
192
|
|
@@ -762,9 +779,9 @@ module Google
|
|
762
779
|
# end
|
763
780
|
#
|
764
781
|
# @!attribute [rw] endpoint
|
765
|
-
#
|
766
|
-
#
|
767
|
-
# @return [::String]
|
782
|
+
# A custom service endpoint, as a hostname or hostname:port. The default is
|
783
|
+
# nil, indicating to use the default endpoint in the current universe domain.
|
784
|
+
# @return [::String,nil]
|
768
785
|
# @!attribute [rw] credentials
|
769
786
|
# Credentials to send with calls. You may provide any of the following types:
|
770
787
|
# * (`String`) The path to a service account key file in JSON format
|
@@ -810,13 +827,20 @@ module Google
|
|
810
827
|
# @!attribute [rw] quota_project
|
811
828
|
# A separate project against which to charge quota.
|
812
829
|
# @return [::String]
|
830
|
+
# @!attribute [rw] universe_domain
|
831
|
+
# The universe domain within which to make requests. This determines the
|
832
|
+
# default endpoint URL. The default value of nil uses the environment
|
833
|
+
# universe (usually the default "googleapis.com" universe).
|
834
|
+
# @return [::String,nil]
|
813
835
|
#
|
814
836
|
class Configuration
|
815
837
|
extend ::Gapic::Config
|
816
838
|
|
839
|
+
# @private
|
840
|
+
# The endpoint specific to the default "googleapis.com" universe. Deprecated.
|
817
841
|
DEFAULT_ENDPOINT = "recommendationengine.googleapis.com"
|
818
842
|
|
819
|
-
config_attr :endpoint,
|
843
|
+
config_attr :endpoint, nil, ::String, nil
|
820
844
|
config_attr :credentials, nil do |value|
|
821
845
|
allowed = [::String, ::Hash, ::Proc, ::Symbol, ::Google::Auth::Credentials, ::Signet::OAuth2::Client, nil]
|
822
846
|
allowed += [::GRPC::Core::Channel, ::GRPC::Core::ChannelCredentials] if defined? ::GRPC
|
@@ -831,6 +855,7 @@ module Google
|
|
831
855
|
config_attr :metadata, nil, ::Hash, nil
|
832
856
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
833
857
|
config_attr :quota_project, nil, ::String, nil
|
858
|
+
config_attr :universe_domain, nil, ::String, nil
|
834
859
|
|
835
860
|
# @private
|
836
861
|
def initialize parent_config = nil
|
@@ -851,6 +876,14 @@ module Google
|
|
851
876
|
end
|
852
877
|
end
|
853
878
|
|
879
|
+
##
|
880
|
+
# Configuration for the channel pool
|
881
|
+
# @return [::Gapic::ServiceStub::ChannelPool::Configuration]
|
882
|
+
#
|
883
|
+
def channel_pool
|
884
|
+
@channel_pool ||= ::Gapic::ServiceStub::ChannelPool::Configuration.new
|
885
|
+
end
|
886
|
+
|
854
887
|
##
|
855
888
|
# Configuration RPC class for the UserEventService API.
|
856
889
|
#
|