Module: Google::Cloud::VideoIntelligence::V1p1beta1

Defined in:
lib/google/cloud/video_intelligence/v1p1beta1.rb,
lib/google/cloud/video_intelligence/v1p1beta1/credentials.rb,
lib/google/cloud/video_intelligence/v1p1beta1/video_intelligence_service_client.rb

Overview

Ruby Client for Cloud Video Intelligence API (Beta)

Cloud Video Intelligence API: Cloud Video Intelligence API.

Quick Start

In order to use this library, you first need to go through the following steps:

  1. Select or create a Cloud Platform project.
  2. Enable billing for your project.
  3. Enable the Cloud Video Intelligence API.
  4. Setup Authentication.

Installation

$ gem install google-cloud-video_intelligence

Preview

VideoIntelligenceServiceClient

require "google/cloud/video_intelligence"

video_intelligence_service_client = Google::Cloud::VideoIntelligence.new(version: :v1p1beta1)
input_uri = "gs://demomaker/cat.mp4"
features_element = :LABEL_DETECTION
features = [features_element]

# Register a callback during the method call.
operation = video_intelligence_service_client.annotate_video(input_uri: input_uri, features: features) do |op|
  raise op.results.message if op.error?
  op_results = op.results
  # Process the results.

  metadata = op.metadata
  # Process the metadata.
end

# Or use the return value to register a callback.
operation.on_done do |op|
  raise op.results.message if op.error?
  op_results = op.results
  # Process the results.

  metadata = op.metadata
  # Process the metadata.
end

# Manually reload the operation.
operation.reload!

# Or block until the operation completes, triggering callbacks on
# completion.
operation.wait_until_done!

Next Steps

Enabling Logging

To enable logging for this library, set the logger for the underlying gRPC library. The logger that you set may be a Ruby stdlib Logger as shown below, or a Google::Cloud::Logging::Logger that will write logs to Stackdriver Logging. See grpc/logconfig.rb and the gRPC spec_helper.rb for additional information.

Configuring a Ruby stdlib logger:

require "logger"

module MyLogger
  LOGGER = Logger.new $stderr, level: Logger::WARN
  def logger
    LOGGER
  end
end

# Define a gRPC module-level logger method before grpc/logconfig.rb loads.
module GRPC
  extend MyLogger
end

Defined Under Namespace

Classes: Credentials, VideoIntelligenceServiceClient

Class Method Summary collapse

Class Method Details

.new(credentials: nil, scopes: nil, client_config: nil, timeout: nil, metadata: nil, exception_transformer: nil, lib_name: nil, lib_version: nil) ⇒ Object

Service that implements Google Cloud Video Intelligence API.



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/google/cloud/video_intelligence/v1p1beta1.rb', line 153

def self.new \
    credentials: nil,
    scopes: nil,
    client_config: nil,
    timeout: nil,
    metadata: nil,
    exception_transformer: nil,
    lib_name: nil,
    lib_version: nil
  kwargs = {
    credentials: credentials,
    scopes: scopes,
    client_config: client_config,
    timeout: timeout,
    metadata: ,
    exception_transformer: exception_transformer,
    lib_name: lib_name,
    lib_version: lib_version
  }.select { |_, v| v != nil }
  Google::Cloud::VideoIntelligence::V1p1beta1::VideoIntelligenceServiceClient.new(**kwargs)
end