X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/cd37e4bfeace8790e7f25c0172c2657cb4cb685c..1601c616fe494b50de98cec4c4bfdb0713ce7246:/README.md
diff --git a/README.md b/README.md
index 0ae51b4045..048723fb04 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
- Homepage
- http://code.google.com/p/google-api-ruby-client
- - Author
- Bob Aman
+ - Authoris
- Bob Aman, Steven Bazyl
- Copyright
- Copyright © 2011 Google, Inc.
- License
- Apache 2.0
@@ -80,16 +80,19 @@ Most interactions with Google APIs require users to authorize applications via O
Credentials can be managed at the connection level, as shown, or supplied on a per-request basis when calling `execute`.
-For server-to-server interactions, like those between a web application and Google Cloud Storage, Prediction, or BigQuery APIs, use service accounts. Assertions for service accounts are made with `Google::APIClient::JWTAsserter`.
-
- client = Google::APIClient.new
- key = Google::APIClient::PKCS12.load_key('client.p12', 'notasecret')
- service_account = Google::APIClient::JWTAsserter(
- '123456-abcdef@developer.gserviceaccount.com',
- 'https://www.googleapis.com/auth/prediction',
- key)
- client.authorization = service_account.authorize
-
+For server-to-server interactions, like those between a web application and Google Cloud Storage, Prediction, or BigQuery APIs, use service accounts.
+
+ key = Google::APIClient::KeyUtils.load_from_pkcs12('client.p12', 'notasecret')
+ client.authorization = Signet::OAuth2::Client.new(
+ :token_credential_uri => 'https://accounts.google.com/o/oauth2/token',
+ :audience => 'https://accounts.google.com/o/oauth2/token',
+ :scope => 'https://www.googleapis.com/auth/prediction',
+ :issuer => '123456-abcdef@developer.gserviceaccount.com',
+ :signing_key => key)
+ client.authorization.fetch_access_token!
+ client.execute(...)
+
+
### Batching Requests
Some Google APIs support batching requests into a single HTTP request. Use `Google::APIClient::BatchRequest`
@@ -104,9 +107,9 @@ Example:
puts result.data
end
- batch.add(:api_method=>urlshortener.url.insert,
+ batch.add(:api_method => urlshortener.url.insert,
:body_object => { 'longUrl' => 'http://example.com/foo' })
- batch.add(:api_method=>urlshortener.url.insert,
+ batch.add(:api_method => urlshortener.url.insert,
:body_object => { 'longUrl' => 'http://example.com/bar' })
client.execute(batch)
@@ -146,4 +149,33 @@ and continue if necessary, check `result.resumable_upload`.
if upload.resumable?
client.execute(upload)
end
-
+
+## Command Line
+
+Included with the gem is a command line interface for working with Google APIs.
+
+ # Log in
+ google-api oauth-2-login --client-id='...' --client-secret='...' --scope="https://www.googleapis.com/auth/plus.me"
+
+ # List the signed-in user's activities
+ google-api execute plus.activities.list --api=plus -- userId="me" collection="public"
+
+ # Start an interactive API session
+ google-api irb
+ >> plus = $client.discovered_api('plus')
+ >> $client.execute(plus.activities.list, {'userId' => 'me', 'collection' => 'public'})
+ => # returns a response from the API
+
+For more information, use `google-api --help`
+
+## Samples
+
+See the full list of [samples on Google Code](http://code.google.com/p/google-api-ruby-client/source/browse?repo=samples).
+
+
+## Support
+
+Please [report bugs at the project on Google Code](http://code.google.com/p/google-api-ruby-client/issues/entry). Don't hesitate to [ask questions](http://stackoverflow.com/questions/tagged/google-api-ruby-client) about the client or APIs on [StackOverflow](http://stackoverflow.com).
+
+
+