gplus 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,11 +8,14 @@ I'm aiming to produce something light-weight, well documented, and thoroughly te
8
8
 
9
9
  It currently has full support for the People and Activities APIs, using either OAuth requests for private data or API key requests for public data.
10
10
 
11
+ * [Documentation](http://rubydoc.info/gems/gplus/frames)
12
+ * [Issues](https://github.com/nfm/gplus/issues)
13
+
11
14
  ## Installation
12
15
 
13
16
  Add GPlus to your Gemfile, then run `bundle install`.
14
17
 
15
- gem "gplus", "~> 0.2.0"
18
+ gem "gplus", "~> 0.3.1"
16
19
 
17
20
  ## Creating and configuring your application
18
21
 
@@ -22,6 +25,8 @@ Next, [create an OAuth 2.0 client ID](http://code.google.com/apis/console#access
22
25
 
23
26
  You can then specify additional redirect URIs and allowed javascript origins.
24
27
 
28
+ Currently, the Google+ API limits applications to 1,000 API requests per day. You can request an increase to this limit by visiting the [developer console](https://code.google.com/apis/console/) under the 'Quotas' section for your application.
29
+
25
30
  ## Unauthorized requests (for public data)
26
31
 
27
32
  Create an API client using your API key:
@@ -1,9 +1,21 @@
1
1
  module Gplus
2
2
  class Client
3
+ # Get an Activity by its unique ID.
4
+ # See http://developers.google.com/+/api/latest/activities/get for more details.
5
+ #
6
+ # @param [String] id The unique ID of the activity you want to retrieve.
7
+ # @return [Hash] A nested hash representation of an {http://developers.google.com/+/api/latest/activities Activity resource}.
3
8
  def get_activity(id)
4
9
  get("activities/#{id}")
5
10
  end
6
11
 
12
+ # List a Person's Google+ activities.
13
+ # See http://developers.google.com/+/api/latest/activities/list for more details.
14
+ #
15
+ # @param [String] person_id The unique ID of the person whose activities you want to list. Pass the string 'me' to list the activities for the person that the API client is authorized as.
16
+ # @param [Integer] results The number of activities, between 1 and 100, to return.
17
+ # @param [String] page The page of activities to fetch. Pass the value of :nextPageToken from the previous result set to get the next page of results.
18
+ # @return [Hash] A nested hash representation of {http://developers.google.com/+/api/latest/activities/list list of activities}.
7
19
  def list_activities(person_id, results = 20, page = nil)
8
20
  get("people/#{person_id}/activities/public", { :maxResults => results, :pageToken => page })
9
21
  end
data/lib/gplus/client.rb CHANGED
@@ -3,6 +3,15 @@ require 'gplus/person'
3
3
 
4
4
  module Gplus
5
5
  class Client
6
+ # Create a Google+ API client. Read the {file:README.md README} to find learn about the different ways of initializing a client.
7
+ #
8
+ # @param [Hash] options
9
+ # @option options [String] :api_key Your application's API key, used for non-authenticated requests (for public data).
10
+ # @option options [String] :token The OAuth token to authorize the API client for authenticated requests (for non-public data). This can be supplied after initialization by calling {#authorize}.
11
+ # @option options [String] :client_id Your application's Client ID. Required to generate an authorization URL with {#authorize_url}.
12
+ # @option options [String] :client_secret Your application's Client Secret. Required to generate an authorization URL with {#authorize_url}.
13
+ # @option options [String] :redirect_uri The default URI to redirect to after authorization. You can override this in many other methods. It must be specified as an authorized URI in your application's console. Required to generate an authorization URL with #authorize_url.
14
+ # @return [Gplus::Client] A Google+ API client.
6
15
  def initialize(options = {})
7
16
  @api_key = options[:api_key]
8
17
  @client_id = options[:client_id]
@@ -19,10 +28,18 @@ module Gplus
19
28
  )
20
29
  end
21
30
 
31
+ # Generate an authorization URL where a user can authorize your application to access their Google+ data.
32
+ #
33
+ # @param [String] redirect_uri An optional over-ride for the redirect_uri you initialized the API client with.
34
+ # @return [String] A Google account authorization URL for your application.
22
35
  def authorize_url(redirect_uri = @redirect_uri)
23
36
  @oauth_client.auth_code.authorize_url(:redirect_uri => redirect_uri, :scope => 'https://www.googleapis.com/auth/plus.me')
24
37
  end
25
38
 
39
+ # Authorize an API client instance to access the user's private data.
40
+ # @param [String] auth_code The code returned to your redirect_uri after the user authorized your application to access their Google+ data.
41
+ # @param [String] redirect_uri An optional over-ride for the redirect_uri you initialized the API client with.
42
+ # @return [OAuth2::AccessToken] An OAuth access token. Store access_token[:token] and access_token[:refresh_token] to get persistent access to the user's data until access_token[:expires_at].
26
43
  def authorize(auth_code, redirect_uri = @redirect_uri)
27
44
  @access_token = @oauth_client.auth_code.get_token(auth_code, :redirect_uri => redirect_uri)
28
45
  end
data/lib/gplus/person.rb CHANGED
@@ -1,5 +1,10 @@
1
1
  module Gplus
2
2
  class Client
3
+ # Get a person's Google+ profile.
4
+ # See http://developers.google.com/+/api/latest/people/get for more details.
5
+ #
6
+ # @param [String] id The unique ID of the person whose profile you want to retrieve. Pass the string 'me' to fetch the profile for the person that the API client is authorized as.
7
+ # @return [Hash] A nested hash representation of a {http://developers.google.com/+/api/latest/people/get Person resource}
3
8
  def get_person(id)
4
9
  get("people/#{id}")
5
10
  end
data/lib/gplus/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Gplus
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gplus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-09-17 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multi_json
16
- requirement: &17792180 !ruby/object:Gem::Requirement
16
+ requirement: &11450460 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *17792180
24
+ version_requirements: *11450460
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: oauth2
27
- requirement: &17784300 !ruby/object:Gem::Requirement
27
+ requirement: &11449420 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0.5'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *17784300
35
+ version_requirements: *11449420
36
36
  description: A complete implementation of the Google plus API for Ruby
37
37
  email:
38
38
  - nicholas@2suggestions.com.au