Ruby Client for the Cloud IoT V1 API

Registers and manages IoT (Internet of Things) devices that connect to the Google Cloud Platform.

Registers and manages IoT (Internet of Things) devices that connect to the Google Cloud Platform.

https://github.com/googleapis/google-cloud-ruby

This gem is aversioned client. It provides basic client classes for aspecific version of the Cloud IoT V1 API. Most users should consider usingthe main client gem,google-cloud-iot.See the section below titledWhich client should I use? for more information.

Installation

$ gem install google-cloud-iot-v1

Before You Begin

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 API.
  4. Set up authentication.

Quick Start

require"google/cloud/iot/v1"client=::Google::Cloud::Iot::V1::DeviceManager::Client.newrequest=::Google::Cloud::Iot::V1::CreateDeviceRegistryRequest.new# (request fields as keyword arguments...)response=client.create_device_registryrequest

View theClient Library Documentationfor class and method documentation.

See also theProduct Documentationfor general usage information.

Enabling Logging

To enable logging for this library, set the logger for the underlyinggRPC library.The logger that you set may be a Ruby stdlibLogger as shown below,or aGoogle::Cloud::Logging::Loggerthat will write logs toCloud Logging. Seegrpc/logconfig.rband the gRPCspec_helper.rb for additional information.

Configuring a Ruby stdlib logger:

require"logger"moduleMyLoggerLOGGER=Logger.new$stderr,level:Logger::WARNdefloggerLOGGERendend# Define a gRPC module-level logger method before grpc/logconfig.rb loads.moduleGRPCextendMyLoggerend

Google Cloud Samples

To browse ready to use code samples checkGoogle Cloud Samples.

Supported Ruby Versions

This library is supported on Ruby 2.6+.

Google provides official support for Ruby versions that are actively supportedby Ruby Core—that is, Ruby versions that are either in normal maintenance orin security maintenance, and not end of life. Older versions of Rubymaystill work, but are unsupported and not recommended. Seehttps://www.ruby-lang.org/en/downloads/branches/ for details about the Rubysupport schedule.

Which client should I use?

Most modern Ruby client libraries for Google APIs come in two flavors: the mainclient library with a name such asgoogle-cloud-iot,and lower-levelversioned client libraries with names such asgoogle-cloud-iot-v1.In most cases, you should install the main client.

What's the difference between the main client and a versioned client?

Aversioned client provides a basic set of data types and client classes forasingle version of a specific service. (That is, for a service with multipleversions, there might be a separate versioned client for each service version.)Most versioned clients are written and maintained by a code generator.

Themain client is designed to provide you with therecommended clientinterfaces for the service. There will be only one main client for any givenservice, even a service with multiple versions. The main client includesfactory methods for constructing the client objects we recommend for mostusers. In some cases, those will be classes provided by an underlying versionedclient; in other cases, they will be handwritten higher-level client objectswith additional capabilities, convenience methods, or best practices built in.Generally, the main client will default to a recommended service version,although in some cases you can override this if you need to talk to a specificservice version.

Why would I want to use the main client?

We recommend that most users install the main client gem for a service. You canidentify this gem as the onewithout a version in its name, e.g.google-cloud-iot.The main client is recommended because it will embody the best practices foraccessing the service, and may also provide more convenient interfaces ortighter integration into frameworks and third-party libraries. In addition, thedocumentation and samples published by Google will generally demonstrate use ofthe main client.

Why would I want to use a versioned client?

You can use a versioned client if you are content with a possibly lower-levelclass interface, you explicitly want to avoid features provided by the mainclient, or you want to access a specific service version not be covered by themain client. You can identify versioned client gems because the service versionis part of the name, e.g.google-cloud-iot-v1.

What about the google-apis-

Client library gems with names that begin withgoogle-apis- are based on anolder code generation technology. They talk to a REST/JSON backend (whereasmost modern clients talk to agRPC backend) and they maynot offer the same performance, features, and ease of use provided by moremodern clients.

Thegoogle-apis- clients have wide coverage across Google services, so youmight need to use one if there is no modern client available for the service.However, if a modern client is available, we generally recommend it over theoldergoogle-apis- clients.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.