This sample project has been deprecated. It is no longer being actively maintained and is probably out of date.
In other words, if you decide to clone this repository, you're on your own.
This project shows you how to implement a simple piece of Glassware that demos the major functionality of the Google Mirror API.
- Ruby 1.9 or higher
- To use subscriptions, you also need an Internet accessible hosting environment with a valid SSL certificate signed by a trusted certificate authority.
Note: You can start developing with a localhost instance of your HTTP server, but you must have an Internet accessible host to use the subscription features of the API.
Enter your client ID, secret, and an OAuth2 redirect URL in client_secrets.json
:
{
"web": {
"client_id": "1234.apps.googleusercontent.com",
"client_secret": "ITS_A_SECRET_TO_EVERYBODY",
"redirect_uris": [
"http://example.com/oauth2callback"
],
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token"
}
}
This example uses Bundler to manage gem dependencies. Before running the script for the first time, run the following command from a terminal in the directory containing the Quick Start files to install the required gems:
$ bundle install
Before deploying to your production server, you can run the Quick Start project as a local development server for testing. This application is written using the Sinatra micro-framework, and you can launch it as a standard Ruby script from the terminal:
-
From a terminal in the directory containing your Quick Start files, run:
$ ruby mirror_quick_start.rb
-
Start using the Quick Start on your default browser at http://localhost:4567.
To deploy the Quick Start to your host server, copy the Ruby Quick Start directory to your web server and configure it as a Rack application per your server's instructions. Phusion Passenger along with Apache httpd or nginx work great. For detailed instructions on deploying a Sinatra application to either of these servers, please refer to the Phusion Passenger users guide for Apache or nginx.