Syntax change to satisfy pull request
[arvados.git] / README.md
1 # APIClient
2
3 <dl>
4   <dt>Homepage</dt><dd><a href="http://code.google.com/p/google-api-ruby-client">http://code.google.com/p/google-api-ruby-client</a></dd>
5   <dt>Author</dt><dd><a href="mailto:bobaman@google.com">Bob Aman</a></dd>
6   <dt>Copyright</dt><dd>Copyright © 2011 Google, Inc.</dd>
7   <dt>License</dt><dd>Apache 2.0</dd>
8 </dl>
9
10 [![Build Status](https://secure.travis-ci.org/google/google-api-ruby-client.png)](http://travis-ci.org/google/google-api-ruby-client)
11 [![Dependency Status](https://gemnasium.com/google/google-api-ruby-client.png)](https://gemnasium.com/google/google-api-ruby-client)
12
13 # Description
14
15 The Google API Ruby Client makes it trivial to discover and access supported
16 APIs.
17
18 # Example Usage
19
20     # Initialize the client
21     require 'google/api_client'
22     require 'signet/oauth_1/client'
23     client = Google::APIClient.new(
24       :service => 'buzz',
25       # Buzz has API-specific endpoints
26       :authorization => Signet::OAuth1::Client.new(
27         :temporary_credential_uri =>
28           'https://www.google.com/accounts/OAuthGetRequestToken',
29         :authorization_uri =>
30           'https://www.google.com/buzz/api/auth/OAuthAuthorizeToken',
31         :token_credential_uri =>
32           'https://www.google.com/accounts/OAuthGetAccessToken',
33         :client_credential_key => 'anonymous',
34         :client_credential_secret => 'anonymous'
35       )
36     )
37     client.authorization.fetch_temporary_credential!(
38       :additional_parameters => {
39         'scope' => 'https://www.googleapis.com/auth/buzz'
40       }
41     )
42     redirect_uri = client.authorization.authorization_uri(
43       :additional_parameters => {
44         'domain' => client.authorization.client_credential_key,
45         'scope' => 'https://www.googleapis.com/auth/buzz'
46       }
47     )
48     # Redirect user here
49     client.authorization.fetch_token_credential!(:verifier => '12345')
50     
51     # Discover available methods
52     method_names = client.discovered_api('plus').to_h.keys
53     
54     # Make an API call
55     result = client.execute(
56       'plus.activities.list',
57       {'collection' => 'public', 'userId' => 'me'}
58     )
59
60 # Install
61
62 Be sure `http://rubygems.org/` is in your gem sources.
63
64 For normal client usage, this is sufficient:
65
66     $ sudo gem install google-api-client
67
68 The command line interface, the example applications, and the test suite
69 require additional dependencies. These may be obtained with:
70
71     $ sudo gem install google-api-client --development --force --no-rdoc --no-ri