Module: Google::Cloud::Retail

Defined in:
lib/google/cloud/retail.rb,
lib/google/cloud/retail/version.rb

Constant Summary collapse

VERSION =
"2.1.1"

Class Method Summary collapse

Class Method Details

.analytics_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for AnalyticsService.

By default, this returns an instance of Google::Cloud::Retail::V2::AnalyticsService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the AnalyticsService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the AnalyticsService service. You can determine whether the method will succeed by calling analytics_service_available?.

About AnalyticsService

Service for managing & accessing retail search business metric. Retail recommendation business metric is currently not available.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/google/cloud/retail.rb', line 76

def self.analytics_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:AnalyticsService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.analytics_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the AnalyticsService service is supported by the current client. If true, you can retrieve a client object by calling analytics_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the AnalyticsService service, or if the versioned client gem needs an update to support the AnalyticsService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# File 'lib/google/cloud/retail.rb', line 100

def self.analytics_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :AnalyticsService
  service_module = service_module.const_get :AnalyticsService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.catalog_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for CatalogService.

By default, this returns an instance of Google::Cloud::Retail::V2::CatalogService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the CatalogService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the CatalogService service. You can determine whether the method will succeed by calling catalog_service_available?.

About CatalogService

Service for managing catalog configuration.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



146
147
148
149
150
151
152
153
154
155
156
# File 'lib/google/cloud/retail.rb', line 146

def self.catalog_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:CatalogService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.catalog_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the CatalogService service is supported by the current client. If true, you can retrieve a client object by calling catalog_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the CatalogService service, or if the versioned client gem needs an update to support the CatalogService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# File 'lib/google/cloud/retail.rb', line 170

def self.catalog_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :CatalogService
  service_module = service_module.const_get :CatalogService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.completion_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for CompletionService.

By default, this returns an instance of Google::Cloud::Retail::V2::CompletionService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the CompletionService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the CompletionService service. You can determine whether the method will succeed by calling completion_service_available?.

About CompletionService

Autocomplete service for retail.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



219
220
221
222
223
224
225
226
227
228
229
# File 'lib/google/cloud/retail.rb', line 219

def self.completion_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:CompletionService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.completion_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the CompletionService service is supported by the current client. If true, you can retrieve a client object by calling completion_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the CompletionService service, or if the versioned client gem needs an update to support the CompletionService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/google/cloud/retail.rb', line 243

def self.completion_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :CompletionService
  service_module = service_module.const_get :CompletionService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.configure {|::Google::Cloud.configure.retail| ... } ⇒ ::Google::Cloud::Config

Configure the google-cloud-retail library.

The following configuration parameters are supported:

  • credentials (type: String, Hash, Google::Auth::Credentials) - The path to the keyfile as a String, the contents of the keyfile as a Hash, or a Google::Auth::Credentials object.
  • lib_name (type: String) - The library name as recorded in instrumentation and logging.
  • lib_version (type: String) - The library version as recorded in instrumentation and logging.
  • interceptors (type: Array<GRPC::ClientInterceptor>) - An array of interceptors that are run before calls are executed.
  • timeout (type: Numeric) - Default timeout in seconds.
  • metadata (type: Hash{Symbol=>String}) - Additional headers to be sent with the call.
  • retry_policy (type: Hash) - The retry policy. The value is a hash with the following keys:
    • :initial_delay (type: Numeric) - The initial delay in seconds.
    • :max_delay (type: Numeric) - The max delay in seconds.
    • :multiplier (type: Numeric) - The incremental backoff multiplier.
    • :retry_codes (type: Array<String>) - The error codes that should trigger a retry.

Yields:

Returns:

  • (::Google::Cloud::Config)

    The default configuration used by this library



939
940
941
942
943
# File 'lib/google/cloud/retail.rb', line 939

def self.configure
  yield ::Google::Cloud.configure.retail if block_given?

  ::Google::Cloud.configure.retail
end

.control_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for ControlService.

By default, this returns an instance of Google::Cloud::Retail::V2::ControlService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the ControlService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the ControlService service. You can determine whether the method will succeed by calling control_service_available?.

About ControlService

Service for modifying Control.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



289
290
291
292
293
294
295
296
297
298
299
# File 'lib/google/cloud/retail.rb', line 289

def self.control_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:ControlService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.control_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the ControlService service is supported by the current client. If true, you can retrieve a client object by calling control_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the ControlService service, or if the versioned client gem needs an update to support the ControlService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
# File 'lib/google/cloud/retail.rb', line 313

def self.control_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :ControlService
  service_module = service_module.const_get :ControlService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.conversational_search_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for ConversationalSearchService.

By default, this returns an instance of Google::Cloud::Retail::V2::ConversationalSearchService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the ConversationalSearchService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the ConversationalSearchService service. You can determine whether the method will succeed by calling conversational_search_service_available?.

About ConversationalSearchService

Service for retail conversational search.

This feature is only available for users who have Retail Conversational Search enabled. Enable Retail Conversational Search on Cloud Console before using this feature.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



436
437
438
439
440
441
442
443
444
445
446
# File 'lib/google/cloud/retail.rb', line 436

def self.conversational_search_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:ConversationalSearchService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.conversational_search_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the ConversationalSearchService service is supported by the current client. If true, you can retrieve a client object by calling conversational_search_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the ConversationalSearchService service, or if the versioned client gem needs an update to support the ConversationalSearchService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
# File 'lib/google/cloud/retail.rb', line 460

def self.conversational_search_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :ConversationalSearchService
  service_module = service_module.const_get :ConversationalSearchService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.generative_question_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for GenerativeQuestionService.

By default, this returns an instance of Google::Cloud::Retail::V2::GenerativeQuestionService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the GenerativeQuestionService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the GenerativeQuestionService service. You can determine whether the method will succeed by calling generative_question_service_available?.

About GenerativeQuestionService

Service for managing LLM generated questions in search serving.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



506
507
508
509
510
511
512
513
514
515
516
# File 'lib/google/cloud/retail.rb', line 506

def self.generative_question_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:GenerativeQuestionService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.generative_question_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the GenerativeQuestionService service is supported by the current client. If true, you can retrieve a client object by calling generative_question_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the GenerativeQuestionService service, or if the versioned client gem needs an update to support the GenerativeQuestionService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
# File 'lib/google/cloud/retail.rb', line 530

def self.generative_question_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :GenerativeQuestionService
  service_module = service_module.const_get :GenerativeQuestionService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.model_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for ModelService.

By default, this returns an instance of Google::Cloud::Retail::V2::ModelService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the ModelService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the ModelService service. You can determine whether the method will succeed by calling model_service_available?.

About ModelService

Service for performing CRUD operations on models. Recommendation models contain all the metadata necessary to generate a set of models for the Predict() API. A model is queried indirectly via a ServingConfig, which associates a model with a given Placement (e.g. Frequently Bought Together on Home Page).

This service allows you to do the following:

  • Initiate training of a model.
  • Pause training of an existing model.
  • List all the available models along with their metadata.
  • Control their tuning schedule.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



587
588
589
590
591
592
593
594
595
596
597
# File 'lib/google/cloud/retail.rb', line 587

def self.model_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:ModelService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.model_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the ModelService service is supported by the current client. If true, you can retrieve a client object by calling model_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the ModelService service, or if the versioned client gem needs an update to support the ModelService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
# File 'lib/google/cloud/retail.rb', line 611

def self.model_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :ModelService
  service_module = service_module.const_get :ModelService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.prediction_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for PredictionService.

By default, this returns an instance of Google::Cloud::Retail::V2::PredictionService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the PredictionService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the PredictionService service. You can determine whether the method will succeed by calling prediction_service_available?.

About PredictionService

Service for making recommendation prediction.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



657
658
659
660
661
662
663
664
665
666
667
# File 'lib/google/cloud/retail.rb', line 657

def self.prediction_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:PredictionService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.prediction_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the PredictionService service is supported by the current client. If true, you can retrieve a client object by calling prediction_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the PredictionService service, or if the versioned client gem needs an update to support the PredictionService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
# File 'lib/google/cloud/retail.rb', line 681

def self.prediction_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :PredictionService
  service_module = service_module.const_get :PredictionService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.product_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for ProductService.

By default, this returns an instance of Google::Cloud::Retail::V2::ProductService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the ProductService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the ProductService service. You can determine whether the method will succeed by calling product_service_available?.

About ProductService

Service for ingesting Product information of the customer's website.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



728
729
730
731
732
733
734
735
736
737
738
# File 'lib/google/cloud/retail.rb', line 728

def self.product_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:ProductService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.product_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the ProductService service is supported by the current client. If true, you can retrieve a client object by calling product_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the ProductService service, or if the versioned client gem needs an update to support the ProductService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
# File 'lib/google/cloud/retail.rb', line 752

def self.product_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :ProductService
  service_module = service_module.const_get :ProductService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.search_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for SearchService.

By default, this returns an instance of Google::Cloud::Retail::V2::SearchService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the SearchService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the SearchService service. You can determine whether the method will succeed by calling search_service_available?.

About SearchService

Service for search.

This feature is only available for users who have Retail Search enabled. Enable Retail Search on Cloud Console before using this feature.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



362
363
364
365
366
367
368
369
370
371
372
# File 'lib/google/cloud/retail.rb', line 362

def self.search_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:SearchService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.search_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the SearchService service is supported by the current client. If true, you can retrieve a client object by calling search_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the SearchService service, or if the versioned client gem needs an update to support the SearchService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
# File 'lib/google/cloud/retail.rb', line 386

def self.search_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :SearchService
  service_module = service_module.const_get :SearchService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.serving_config_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for ServingConfigService.

By default, this returns an instance of Google::Cloud::Retail::V2::ServingConfigService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the ServingConfigService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the ServingConfigService service. You can determine whether the method will succeed by calling serving_config_service_available?.

About ServingConfigService

Service for modifying ServingConfig.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



798
799
800
801
802
803
804
805
806
807
808
# File 'lib/google/cloud/retail.rb', line 798

def self.serving_config_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:ServingConfigService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.serving_config_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the ServingConfigService service is supported by the current client. If true, you can retrieve a client object by calling serving_config_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the ServingConfigService service, or if the versioned client gem needs an update to support the ServingConfigService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
# File 'lib/google/cloud/retail.rb', line 822

def self.serving_config_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :ServingConfigService
  service_module = service_module.const_get :ServingConfigService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end

.user_event_service(version: :v2, transport: :grpc, &block) ⇒ ::Object

Create a new client object for UserEventService.

By default, this returns an instance of Google::Cloud::Retail::V2::UserEventService::Client for a gRPC client for version V2 of the API. However, you can specify a different API version by passing it in the version parameter. If the UserEventService service is supported by that API version, and the corresponding gem is available, the appropriate versioned client will be returned. You can also specify a different transport by passing :rest or :grpc in the transport parameter.

Raises an exception if the currently installed versioned client gem for the given API version does not support the given transport of the UserEventService service. You can determine whether the method will succeed by calling user_event_service_available?.

About UserEventService

Service for ingesting end user actions on the customer website.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (::Object)

    A client object for the specified version.



868
869
870
871
872
873
874
875
876
877
878
# File 'lib/google/cloud/retail.rb', line 868

def self.user_event_service version: :v2, transport: :grpc, &block
  require "google/cloud/retail/#{version.to_s.downcase}"

  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  service_module = Google::Cloud::Retail.const_get(package_name).const_get(:UserEventService)
  service_module = service_module.const_get(:Rest) if transport == :rest
  service_module.const_get(:Client).new(&block)
end

.user_event_service_available?(version: :v2, transport: :grpc) ⇒ boolean

Determines whether the UserEventService service is supported by the current client. If true, you can retrieve a client object by calling user_event_service. If false, that method will raise an exception. This could happen if the given API version does not exist or does not support the UserEventService service, or if the versioned client gem needs an update to support the UserEventService service.

Parameters:

  • version (::String, ::Symbol) (defaults to: :v2)

    The API version to connect to. Optional. Defaults to :v2.

  • transport (:grpc, :rest) (defaults to: :grpc)

    The transport to use. Defaults to :grpc.

Returns:

  • (boolean)

    Whether the service is available.



892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
# File 'lib/google/cloud/retail.rb', line 892

def self.user_event_service_available? version: :v2, transport: :grpc
  require "google/cloud/retail/#{version.to_s.downcase}"
  package_name = Google::Cloud::Retail
                 .constants
                 .select { |sym| sym.to_s.downcase == version.to_s.downcase.tr("_", "") }
                 .first
  return false unless package_name
  service_module = Google::Cloud::Retail.const_get package_name
  return false unless service_module.const_defined? :UserEventService
  service_module = service_module.const_get :UserEventService
  if transport == :rest
    return false unless service_module.const_defined? :Rest
    service_module = service_module.const_get :Rest
  end
  service_module.const_defined? :Client
rescue ::LoadError
  false
end