Simple REST client for version V3 of the Traffic Director API
This is a simple client library for version V3 of the Traffic Director API. It provides:
- A client object that connects to the HTTP/JSON REST endpoint for the service.
- Ruby objects for data structures related to the service.
- Integration with the googleauth gem for authentication using OAuth, API keys, and service accounts.
- Control of retry, pagination, and timeouts.
Note that although this client library is supported and will continue to be updated to track changes to the service, it is otherwise considered complete and not under active development. Many Google services, especially Google Cloud Platform services, may provide a more modern client that is under more active development and improvement. See the section below titled Which client should I use? for more information.
Getting started
Before you begin
There are a few setup steps you need to complete before you can use this library:
- If you don't already have a Google account, sign up.
- If you have never created a Google APIs Console project, read about Managing Projects and create a project in the Google API Console.
- Most APIs need to be enabled for your project. Enable it in the console.
Installation
Add this line to your application's Gemfile:
gem 'google-apis-trafficdirector_v3', '~> 0.1'
And then execute:
$ bundle
Or install it yourself as:
$ gem install google-apis-trafficdirector_v3
Creating a client object
Once the gem is installed, you can load the client code and instantiate a client.
# Load the client
require "google/apis/trafficdirector_v3"
# Create a client object
client = Google::Apis::TrafficdirectorV3::TrafficDirectorServiceService.new
# Authenticate calls
client.authorization = # ... use the googleauth gem to create credentials
See the class reference docs for information on the methods you can call from a client.
Documentation
More detailed descriptions of the Google simple REST clients are available in two documents.
- The Usage Guide discusses how to make API calls, how to use the provided data structures, and how to work the various features of the client library, including media upload and download, error handling, retries, pagination, and logging.
- The Auth Guide discusses authentication in the client libraries, including API keys, OAuth 2.0, service accounts, and environment variables.
(Note: the above documents are written for the simple REST clients in general, and their examples may not reflect the Trafficdirector service in particular.)
For reference information on specific calls in the Traffic Director API, see the class reference docs.
Which client should I use?
Google provides two types of Ruby API client libraries: simple REST clients and modern clients.
This library, google-apis-trafficdirector_v3
, is a simple REST client. You can identify these clients by their gem names, which are always in the form google-apis-<servicename>_<serviceversion>
. The simple REST clients connect to HTTP/JSON REST endpoints and are automatically generated from service discovery documents. They support most API functionality, but their class interfaces are sometimes awkward.
Modern clients are produced by a modern code generator, sometimes combined with hand-crafted functionality. Most modern clients connect to high-performance gRPC endpoints, although a few are backed by REST services. Modern clients are available for many Google services, especially Google Cloud Platform services, but do not yet support all the services covered by the simple clients.
Gem names for modern clients are often of the form google-cloud-<service_name>
. (For example, google-cloud-pubsub.) Note that most modern clients also have corresponding "versioned" gems with names like google-cloud-<service_name>-<version>
. (For example, google-cloud-pubsub-v1.) The "versioned" gems can be used directly, but often provide lower-level interfaces. In most cases, the main gem is recommended.
For most users, we recommend the modern client, if one is available. Compared with simple clients, modern clients are generally much easier to use and more Ruby-like, support more advanced features such as streaming and long-running operations, and often provide much better performance. You may consider using a simple client instead, if a modern client is not yet available for the service you want to use, or if you are not able to use gRPC on your infrastructure.
The product documentation may provide guidance regarding the preferred client library to use.
Supported Ruby versions
This library is supported on Ruby 2.7+.
Google provides official support for Ruby versions that are actively supported by Ruby Core -- that is, Ruby versions that are either in normal maintenance or in security maintenance, and not end of life. Older versions of Ruby may still work, but are unsupported and not recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby support schedule.
License
This library is licensed under Apache 2.0. Full license text is available in the LICENSE.
Support
Please report bugs at the project on Github. Don't hesitate to ask questions about the client or APIs on StackOverflow.