Go to file
Bob Aman 0c6551cf13 Resolved deprecation issues with RDoc task. 2011-11-16 15:11:10 +03:00
bin Attempting to fix some Windows issues and update deprecated library calls. 2011-11-16 11:44:44 +03:00
examples Fixed references in the build files to the new README files. 2011-10-11 14:55:19 +03:00
lib/google Attempting to fix some Windows issues and update deprecated library calls. 2011-11-16 11:44:44 +03:00
spec Added code to include userIp and key parameters. 2011-09-22 13:49:58 +03:00
tasks Resolved deprecation issues with RDoc task. 2011-11-16 15:11:10 +03:00
.gitignore Added task for wiki autogeneration. 2011-10-15 11:22:59 +03:00
CHANGELOG Fixed issue with version and moved version back to 0.3.0. 2011-10-15 11:22:50 +03:00
LICENSE Basic project skeleton. 2010-07-28 19:30:56 +00:00
README.md Updated READMEs to use Markdown format. 2011-10-06 11:49:11 +03:00
Rakefile Updated deprecated gem package task. 2011-11-16 14:56:10 +03:00

README.md

APIClient

Homepage
http://code.google.com/p/google-api-ruby-client
Author
Bob Aman
Copyright
Copyright © 2011 Google, Inc.
License
Apache 2.0

Description

The Google API Ruby Client makes it trivial to discover and access supported APIs.

Example Usage

# Initialize the client
require 'google/api_client'
require 'signet/oauth_1/client'
client = Google::APIClient.new(
  :service => 'buzz',
  # Buzz has API-specific endpoints
  :authorization => Signet::OAuth1::Client.new(
    :temporary_credential_uri =>
      'https://www.google.com/accounts/OAuthGetRequestToken',
    :authorization_uri =>
      'https://www.google.com/buzz/api/auth/OAuthAuthorizeToken',
    :token_credential_uri =>
      'https://www.google.com/accounts/OAuthGetAccessToken',
    :client_credential_key => 'anonymous',
    :client_credential_secret => 'anonymous'
  )
)
client.authorization.fetch_temporary_credential!(
  :additional_parameters => {
    'scope' => 'https://www.googleapis.com/auth/buzz'
  }
)
redirect_uri = client.authorization.authorization_uri(
  :additional_parameters => {
    'domain' => client.authorization.client_credential_key,
    'scope' => 'https://www.googleapis.com/auth/buzz'
  }
)
# Redirect user here
client.authorization.fetch_token_credential!(:verifier => '12345')

# Discover available methods
method_names = client.discovered_api('buzz').to_h.keys

# Make an API call
response = client.execute(
  'chili.activities.list',
  {'scope' => '@self', 'userId' => '@me', 'alt' => 'json'}
)
status, headers, body = response

Install

Be sure http://rubygems.org/ is in your gem sources.

For normal client usage, this is sufficient:

$ sudo gem install google-api-client

The command line interface, the example applications, and the test suite require additional dependencies. These may be obtained with:

$ sudo gem install google-api-client --development --force --no-rdoc --no-ri