Overhauled the prediction sample and updated to v1.4.
[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 # Description
11
12 The Google API Ruby Client makes it trivial to discover and access supported
13 APIs.
14
15 # Example Usage
16
17     # Initialize the client
18     require 'google/api_client'
19     require 'signet/oauth_1/client'
20     client = Google::APIClient.new(
21       :service => 'buzz',
22       # Buzz has API-specific endpoints
23       :authorization => Signet::OAuth1::Client.new(
24         :temporary_credential_uri =>
25           'https://www.google.com/accounts/OAuthGetRequestToken',
26         :authorization_uri =>
27           'https://www.google.com/buzz/api/auth/OAuthAuthorizeToken',
28         :token_credential_uri =>
29           'https://www.google.com/accounts/OAuthGetAccessToken',
30         :client_credential_key => 'anonymous',
31         :client_credential_secret => 'anonymous'
32       )
33     )
34     client.authorization.fetch_temporary_credential!(
35       :additional_parameters => {
36         'scope' => 'https://www.googleapis.com/auth/buzz'
37       }
38     )
39     redirect_uri = client.authorization.authorization_uri(
40       :additional_parameters => {
41         'domain' => client.authorization.client_credential_key,
42         'scope' => 'https://www.googleapis.com/auth/buzz'
43       }
44     )
45     # Redirect user here
46     client.authorization.fetch_token_credential!(:verifier => '12345')
47     
48     # Discover available methods
49     method_names = client.discovered_api('buzz').to_h.keys
50     
51     # Make an API call
52     response = client.execute(
53       'chili.activities.list',
54       {'scope' => '@self', 'userId' => '@me', 'alt' => 'json'}
55     )
56     status, headers, body = response
57
58 # Install
59
60 Be sure `http://rubygems.org/` is in your gem sources.
61
62 For normal client usage, this is sufficient:
63
64     $ sudo gem install google-api-client
65
66 The command line interface, the example applications, and the test suite
67 require additional dependencies. These may be obtained with:
68
69     $ sudo gem install google-api-client --development --force --no-rdoc --no-ri