google-api-client 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/CHANGELOG +10 -0
- data/README.md +69 -0
- data/Rakefile +3 -4
- data/bin/google-api +49 -27
- data/lib/google/api_client.rb +164 -134
- data/lib/google/api_client/discovery.rb +4 -562
- data/lib/google/api_client/discovery/api.rb +272 -0
- data/lib/google/api_client/discovery/method.rb +313 -0
- data/lib/google/api_client/discovery/resource.rb +149 -0
- data/lib/google/api_client/discovery/schema.rb +106 -0
- data/lib/google/api_client/environment.rb +5 -2
- data/lib/google/api_client/errors.rb +10 -0
- data/lib/google/api_client/parser.rb +59 -0
- data/lib/google/api_client/parsers/json/error_parser.rb +34 -0
- data/lib/google/api_client/parsers/json/pagination.rb +40 -0
- data/lib/google/api_client/parsers/json_parser.rb +90 -12
- data/lib/google/api_client/reference.rb +202 -0
- data/lib/google/api_client/result.rb +132 -0
- data/lib/google/api_client/version.rb +10 -7
- data/lib/google/inflection.rb +7 -2
- data/spec/google/api_client/discovery_spec.rb +162 -123
- data/spec/google/api_client/parsers/json_parser_spec.rb +27 -23
- data/spec/google/api_client_spec.rb +3 -29
- data/tasks/gem.rake +26 -9
- data/tasks/rdoc.rake +12 -5
- data/tasks/spec.rake +4 -1
- data/tasks/wiki.rake +41 -0
- data/tasks/yard.rake +1 -1
- metadata +48 -95
- data/README +0 -68
data/README
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
== APIClient
|
2
|
-
|
3
|
-
Homepage:: google-api-ruby-client[http://code.google.com/p/google-api-ruby-client/]
|
4
|
-
Authors:: Bob Aman (mailto:bobaman@google.com), Matt Pokrzywa (mailto:mattpok@google.com)
|
5
|
-
Copyright:: Copyright 2010 Google Inc.
|
6
|
-
License:: Apache 2.0
|
7
|
-
|
8
|
-
== Description
|
9
|
-
|
10
|
-
The Google API Ruby Client makes it trivial to discover and access supported
|
11
|
-
APIs.
|
12
|
-
|
13
|
-
== Example Usage
|
14
|
-
|
15
|
-
# Initialize the client
|
16
|
-
require 'google/api_client'
|
17
|
-
require 'signet/oauth_1/client'
|
18
|
-
client = Google::APIClient.new(
|
19
|
-
:service => 'buzz',
|
20
|
-
# Buzz has API-specific endpoints
|
21
|
-
:authorization => Signet::OAuth1::Client.new(
|
22
|
-
:temporary_credential_uri =>
|
23
|
-
'https://www.google.com/accounts/OAuthGetRequestToken',
|
24
|
-
:authorization_uri =>
|
25
|
-
'https://www.google.com/buzz/api/auth/OAuthAuthorizeToken',
|
26
|
-
:token_credential_uri =>
|
27
|
-
'https://www.google.com/accounts/OAuthGetAccessToken',
|
28
|
-
:client_credential_key => 'anonymous',
|
29
|
-
:client_credential_secret => 'anonymous'
|
30
|
-
)
|
31
|
-
)
|
32
|
-
client.authorization.fetch_temporary_credential!(
|
33
|
-
:additional_parameters => {
|
34
|
-
'scope' => 'https://www.googleapis.com/auth/buzz'
|
35
|
-
}
|
36
|
-
)
|
37
|
-
redirect_uri = client.authorization.authorization_uri(
|
38
|
-
:additional_parameters => {
|
39
|
-
'domain' => client.authorization.client_credential_key,
|
40
|
-
'scope' => 'https://www.googleapis.com/auth/buzz'
|
41
|
-
}
|
42
|
-
)
|
43
|
-
# Redirect user here
|
44
|
-
client.authorization.fetch_token_credential!(:verifier => '12345')
|
45
|
-
|
46
|
-
# Discover available methods
|
47
|
-
method_names = client.discovered_api('buzz').to_h.keys
|
48
|
-
|
49
|
-
# Make an API call
|
50
|
-
response = client.execute(
|
51
|
-
'chili.activities.list',
|
52
|
-
{'scope' => '@self', 'userId' => '@me', 'alt' => 'json'}
|
53
|
-
)
|
54
|
-
status, headers, body = response
|
55
|
-
|
56
|
-
== Install
|
57
|
-
|
58
|
-
Be sure both http://gems.github.com/ and http://rubygems.org/ are in your gem
|
59
|
-
sources.
|
60
|
-
|
61
|
-
For normal client usage, this is sufficient:
|
62
|
-
|
63
|
-
sudo gem install google-api-client
|
64
|
-
|
65
|
-
The command line interface, the example applications, and the test suite
|
66
|
-
require additional dependencies. These may be obtained with:
|
67
|
-
|
68
|
-
sudo gem install google-api-client --development --force --no-rdoc --no-ri
|