

API keys do not require use of a separate library.

Most auth functionality is provided in two separate Ruby gems, which simple REST clients bring in as dependencies. In the present document, we will discuss a few basic cases to get started. Detailed documentation, including examples of several common authentication flows, is provided in the separate Auth Guide. Google simple REST clients support several different types of authentication, including OAuth 2.0, service accounts, API keys, and default credentials. id, download_dest: '/tmp/myfile.txt' ) AuthorizationĪll API calls need to be authenticated, to ensure authorized access to data, and for proper accounting for quota and billing. insert_file ( metadata, upload_source: 'test.txt', content_type: 'text/plain' ) # Download a file drive. new ( title: 'My document' ) metadata = drive. title end # Upload a file metadata = Google:: Apis:: DriveV2:: File.

list_files ( q: "title contains 'finances'" ) files. # See Googleauth or Signet libraries # Search for files in Drive (first page only) files = drive. Require 'google/apis/drive_v2' drive = Google:: Apis:: DriveV2:: DriveService. ( ) in the console.Īdd the client to your application's Gemfile. Most APIs need to be enabled for your project.If you have never created a Google APIs Console project, read about Managing Projects and create a project in the Google API Console.If you don't already have a Google account, sign up.There are a few setup steps you need to complete before you can use this library: All simple REST clients follow the same usage patterns, and you should be able to adapt the provided examples to the client you are using. In particular, you may find that the examples in this document are for a different client. Note: this is a "general" document, and not specific to this particular service client. It covers important library concepts, shows examples for various use cases, and gives links to more information. This document provides all the basic information you need to start using the simple REST clients for Google APIs.
