Extra indentation removed.
git-svn-id: https://google-api-ruby-client.googlecode.com/svn/trunk@50 c1d61fac-ed7f-fcc1-18f7-ff78120a04ef
This commit is contained in:
parent
35d35f49ed
commit
638f8a810c
74
README
74
README
|
@ -12,46 +12,46 @@ APIs.
|
||||||
|
|
||||||
== Example Usage
|
== Example Usage
|
||||||
|
|
||||||
# Initialize the client
|
# Initialize the client
|
||||||
require 'google/api_client'
|
require 'google/api_client'
|
||||||
require 'signet/oauth_1/client'
|
require 'signet/oauth_1/client'
|
||||||
client = Google::APIClient.new(
|
client = Google::APIClient.new(
|
||||||
:service => 'buzz',
|
:service => 'buzz',
|
||||||
:authorization => Signet::OAuth1::Client.new(
|
:authorization => Signet::OAuth1::Client.new(
|
||||||
:temporary_credential_uri =>
|
:temporary_credential_uri =>
|
||||||
'https://www.google.com/accounts/OAuthGetRequestToken',
|
'https://www.google.com/accounts/OAuthGetRequestToken',
|
||||||
:authorization_uri =>
|
:authorization_uri =>
|
||||||
'https://www.google.com/buzz/api/auth/OAuthAuthorizeToken',
|
'https://www.google.com/buzz/api/auth/OAuthAuthorizeToken',
|
||||||
:token_credential_uri =>
|
:token_credential_uri =>
|
||||||
'https://www.google.com/accounts/OAuthGetAccessToken',
|
'https://www.google.com/accounts/OAuthGetAccessToken',
|
||||||
:client_credential_key => 'anonymous',
|
:client_credential_key => 'anonymous',
|
||||||
:client_credential_secret => 'anonymous'
|
:client_credential_secret => 'anonymous'
|
||||||
)
|
|
||||||
)
|
)
|
||||||
client.authorization.fetch_temporary_credential!(
|
)
|
||||||
:additional_parameters => {
|
client.authorization.fetch_temporary_credential!(
|
||||||
'scope' => 'https://www.googleapis.com/auth/buzz'
|
:additional_parameters => {
|
||||||
}
|
'scope' => 'https://www.googleapis.com/auth/buzz'
|
||||||
)
|
}
|
||||||
redirect_uri = client.authorization.authorization_uri(
|
)
|
||||||
:additional_parameters => {
|
redirect_uri = client.authorization.authorization_uri(
|
||||||
'domain' => client.authorization.client_credential_key,
|
:additional_parameters => {
|
||||||
'scope' => 'https://www.googleapis.com/auth/buzz'
|
'domain' => client.authorization.client_credential_key,
|
||||||
}
|
'scope' => 'https://www.googleapis.com/auth/buzz'
|
||||||
)
|
}
|
||||||
# Redirect user here
|
)
|
||||||
client.authorization.fetch_token_credential!(:verifier => '12345')
|
# Redirect user here
|
||||||
|
client.authorization.fetch_token_credential!(:verifier => '12345')
|
||||||
|
|
||||||
# Discover available methods
|
# Discover available methods
|
||||||
method_names = client.discovered_service('buzz').to_h.keys
|
method_names = client.discovered_service('buzz').to_h.keys
|
||||||
|
|
||||||
# Make an API call
|
# Make an API call
|
||||||
response = client.execute(
|
response = client.execute(
|
||||||
'chili.activities.list',
|
'chili.activities.list',
|
||||||
{'scope' => '@self', 'userId' => '@me', 'alt' => 'json'},
|
{'scope' => '@self', 'userId' => '@me', 'alt' => 'json'},
|
||||||
'', [], {:signed => true}
|
'', [], {:signed => true}
|
||||||
)
|
)
|
||||||
status, headers, body = response
|
status, headers, body = response
|
||||||
|
|
||||||
== Requirements
|
== Requirements
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue