Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 69 lines (55 sloc) 2.211 kb
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
1 # APIClient
d371bc3 Basic project skeleton.
bobaman@google.com authored
2
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
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>
d371bc3 Basic project skeleton.
bobaman@google.com authored
9
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
10 # Description
d371bc3 Basic project skeleton.
bobaman@google.com authored
11
e26ebaf Finished documentation.
Bob Aman authored
12 The Google API Ruby Client makes it trivial to discover and access supported
13 APIs.
d371bc3 Basic project skeleton.
bobaman@google.com authored
14
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
15 # Example Usage
d371bc3 Basic project skeleton.
bobaman@google.com authored
16
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
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 )
de394a5 Updated example.
Bob Aman authored
33 )
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
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
06cdb76 Updated to replace httpadapter with faraday.
Bob Aman authored
49 method_names = client.discovered_api('plus').to_h.keys
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
50
51 # Make an API call
06cdb76 Updated to replace httpadapter with faraday.
Bob Aman authored
52 result = client.execute(
53 'plus.activities.list',
54 {'collection' => 'public', 'userId' => 'me'}
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
55 )
d371bc3 Basic project skeleton.
bobaman@google.com authored
56
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
57 # Install
d371bc3 Basic project skeleton.
bobaman@google.com authored
58
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
59 Be sure `http://rubygems.org/` is in your gem sources.
d371bc3 Basic project skeleton.
bobaman@google.com authored
60
c3ad4f3 Updating README with installation instructions.
Bob Aman authored
61 For normal client usage, this is sufficient:
62
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
63 $ sudo gem install google-api-client
c3ad4f3 Updating README with installation instructions.
Bob Aman authored
64
65 The command line interface, the example applications, and the test suite
66 require additional dependencies. These may be obtained with:
d371bc3 Basic project skeleton.
bobaman@google.com authored
67
589d3e8 Updated READMEs to use Markdown format.
Bob Aman authored
68 $ sudo gem install google-api-client --development --force --no-rdoc --no-ri
Something went wrong with that request. Please try again.