gplus 0.4.0 → 0.5.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.md +34 -0
- data/README.md +42 -7
- data/Rakefile +4 -0
- data/gplus.gemspec +1 -0
- data/lib/gplus/comment.rb +23 -0
- data/lib/gplus/version.rb +1 -1
- data/spec/gplus/activity_spec.rb +9 -0
- data/spec/gplus/client_spec.rb +25 -0
- data/spec/gplus/comment_spec.rb +9 -0
- data/spec/gplus/person_spec.rb +5 -0
- data/spec/gplus_spec.rb +1 -0
- data/spec/spec_helper.rb +2 -0
- metadata +25 -6
data/CHANGELOG.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## v0.5.0: 2011/09/18
|
4
|
+
|
5
|
+
* Add support for the Comments API
|
6
|
+
|
7
|
+
## v0.4.0: 2011/09/18
|
8
|
+
|
9
|
+
* Handle refreshing of OAuth tokens
|
10
|
+
|
11
|
+
## v0.3.1: 2011/09/17
|
12
|
+
|
13
|
+
* Add YARD documentation for all public methods
|
14
|
+
|
15
|
+
## v0.3.0: 2011/09/17
|
16
|
+
|
17
|
+
* API key based requests for public data
|
18
|
+
|
19
|
+
## v0.2.2: 2011/09/16
|
20
|
+
|
21
|
+
* Bug fixes
|
22
|
+
|
23
|
+
## v0.2.1: 2011/09/16
|
24
|
+
|
25
|
+
* Bug fixes
|
26
|
+
|
27
|
+
## v0.2.0: 2011/09/16
|
28
|
+
|
29
|
+
* Add support for the Activities API
|
30
|
+
|
31
|
+
## v0.1.0: 2011/09/16
|
32
|
+
|
33
|
+
* Add support for OAuth authorization for non-public data
|
34
|
+
* Add support for the People API
|
data/README.md
CHANGED
@@ -10,12 +10,13 @@ It currently has full support for the People and Activities APIs, using either O
|
|
10
10
|
|
11
11
|
* [Documentation](http://rubydoc.info/github/nfm/gplus/master/frames)
|
12
12
|
* [Issues](https://github.com/nfm/gplus/issues)
|
13
|
+
* [Changelog](https://github.com/nfm/gplus/blob/master/CHANGELOG.md)
|
13
14
|
|
14
15
|
## Installation
|
15
16
|
|
16
|
-
Add gplus to your Gemfile, then run `bundle install`.
|
17
|
+
Add the current version of gplus to your Gemfile, then run `bundle install`.
|
17
18
|
|
18
|
-
gem "gplus"
|
19
|
+
gem "gplus"
|
19
20
|
|
20
21
|
## Creating and configuring your application
|
21
22
|
|
@@ -122,7 +123,7 @@ The activity will be returned as a nested hash:
|
|
122
123
|
|
123
124
|
activity[:actor][:displayName]
|
124
125
|
activity[:object][:replies][:totalItems]
|
125
|
-
activity[:attachments].each do { |
|
126
|
+
activity[:attachments].each do { |attachment| attachment[:url] }
|
126
127
|
|
127
128
|
List a person's activities with `client.list_activities`:
|
128
129
|
|
@@ -132,20 +133,54 @@ The list will be returned as a nested hash. The actual activities are in the `:i
|
|
132
133
|
|
133
134
|
activities[:title]
|
134
135
|
activities[:updated]
|
135
|
-
activities[:items].each { |
|
136
|
+
activities[:items].each { |activity| activity[:title] }
|
136
137
|
|
137
138
|
By default, this will fetch 20 activities. You can fetch between 1 and 100 by passing a `:results` argument:
|
138
139
|
|
139
140
|
# Get 80 results
|
140
|
-
client.list_activities(
|
141
|
+
client.list_activities(person_id, :results => 80)
|
141
142
|
|
142
143
|
If you want more than 100 results, take the `:nextPageToken` returned from your first request, and pass it as a `:page` argument:
|
143
144
|
|
144
|
-
activities = client.list_activities(
|
145
|
-
more_activities = client.list_activities(
|
145
|
+
activities = client.list_activities(person_id, :results => 100)
|
146
|
+
more_activities = client.list_activities(person_id, :results => 100, :page => activities[:nextPageToken])
|
146
147
|
|
147
148
|
See the Google+ API documentation for [Activities](http://developers.google.com/+/api/latest/activities), [Activities: get](http://developers.google.com/+/api/latest/activities/get) and [Activities: list](http://developers.google.com/+/api/latest/activities/list).
|
148
149
|
|
150
|
+
## [Comments](http://developers.google.com/+/api/latest/comments)
|
151
|
+
|
152
|
+
Get an activity with `client.get_comment`:
|
153
|
+
|
154
|
+
comment = client.get_comment(id)
|
155
|
+
|
156
|
+
The activity will be returned as a nested hash:
|
157
|
+
|
158
|
+
comment[:actor][:displayName]
|
159
|
+
comment[:object][:content][:totalItems]
|
160
|
+
comment[:inReplyTo][:id]
|
161
|
+
|
162
|
+
List an activity's comments with `client.list_comments`:
|
163
|
+
|
164
|
+
comments = client.list_comments(activity_id)
|
165
|
+
|
166
|
+
The list will be returned as a nested hash. The actual comments are in the `:items` array:
|
167
|
+
|
168
|
+
comments[:title]
|
169
|
+
comments[:updated]
|
170
|
+
comments[:items].each { |comment| comment[:object][:content] }
|
171
|
+
|
172
|
+
By default, this will fetch 20 comments. You can fetch between 1 and 100 by passing a `:results` argument:
|
173
|
+
|
174
|
+
# Get 80 results
|
175
|
+
client.list_comments(activity_id, :results => 80)
|
176
|
+
|
177
|
+
If you want more than 100 results, take the `:nextPageToken` returned from your first request, and pass it as a `:page` argument:
|
178
|
+
|
179
|
+
comments = client.list_comments(activity_id, :results => 100)
|
180
|
+
more_comments = client.list_comments(activity_id, :results => 100, :page => comments[:nextPageToken])
|
181
|
+
|
182
|
+
See the Google+ API documentation for [Comments](http://developers.google.com/+/api/latest/comments), [Comments: get](http://developers.google.com/+/api/latest/comments/get) and [Comments: list](http://developers.google.com/+/api/latest/comments/list).
|
183
|
+
|
149
184
|
## Contributing to gplus
|
150
185
|
|
151
186
|
Please submit bug reports as [Github Issues](https://github.com/nfm/Gplus/issues).
|
data/Rakefile
CHANGED
data/gplus.gemspec
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module Gplus
|
2
|
+
class Client
|
3
|
+
# Get a Comment by its unique ID.
|
4
|
+
# See https://developers.google.com/+/api/latest/comments/get for more details.
|
5
|
+
#
|
6
|
+
# @param [String] id The unique ID of the comment you want to retrieve.
|
7
|
+
# @returb [Hash] A nested hash representation of a {https://developers.google.com/+/api/latest/comments Comment resource}.
|
8
|
+
def get_comment(id)
|
9
|
+
get("comments/#{id}")
|
10
|
+
end
|
11
|
+
|
12
|
+
# List an activity's comments.
|
13
|
+
# See http://developers.google.com/+/api/latest/comments/list for more details.
|
14
|
+
#
|
15
|
+
# @param [String] activity_id The unique ID of the activity whose comments you want to list.
|
16
|
+
# @param [Integer] results The number of comments, between 1 and 100, to return.
|
17
|
+
# @param [String] page The page of comments 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 a {http://developers.google.com/+/api/latest/comments/list list of comments}.
|
19
|
+
def list_comments(activity_id, results = 20, page = nil)
|
20
|
+
get("activities/#{activity_id}/comments", { :maxResults => results, :pageToken => page })
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/gplus/version.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
describe Gplus::Client do
|
2
|
+
describe '.initialize' do
|
3
|
+
pending
|
4
|
+
end
|
5
|
+
|
6
|
+
describe '.authorize_url' do
|
7
|
+
pending
|
8
|
+
end
|
9
|
+
|
10
|
+
describe '.authorize' do
|
11
|
+
pending
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '.access_token' do
|
15
|
+
pending
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '.access_token_refreshed?' do
|
19
|
+
pending
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '.get' do
|
23
|
+
pending
|
24
|
+
end
|
25
|
+
end
|
data/spec/gplus_spec.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'spec_helper'
|
data/spec/spec_helper.rb
ADDED
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.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-
|
12
|
+
date: 2011-10-15 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: multi_json
|
16
|
-
requirement: &
|
16
|
+
requirement: &23027300 !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: *
|
24
|
+
version_requirements: *23027300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: oauth2
|
27
|
-
requirement: &
|
27
|
+
requirement: &23026460 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,18 @@ dependencies:
|
|
32
32
|
version: '0.5'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *23026460
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: rspec
|
38
|
+
requirement: &23025000 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *23025000
|
36
47
|
description: A complete implementation of the Google plus API for Ruby
|
37
48
|
email:
|
38
49
|
- nicholas@2suggestions.com.au
|
@@ -41,6 +52,7 @@ extensions: []
|
|
41
52
|
extra_rdoc_files: []
|
42
53
|
files:
|
43
54
|
- .gitignore
|
55
|
+
- CHANGELOG.md
|
44
56
|
- Gemfile
|
45
57
|
- README.md
|
46
58
|
- Rakefile
|
@@ -48,8 +60,15 @@ files:
|
|
48
60
|
- lib/gplus.rb
|
49
61
|
- lib/gplus/activity.rb
|
50
62
|
- lib/gplus/client.rb
|
63
|
+
- lib/gplus/comment.rb
|
51
64
|
- lib/gplus/person.rb
|
52
65
|
- lib/gplus/version.rb
|
66
|
+
- spec/gplus/activity_spec.rb
|
67
|
+
- spec/gplus/client_spec.rb
|
68
|
+
- spec/gplus/comment_spec.rb
|
69
|
+
- spec/gplus/person_spec.rb
|
70
|
+
- spec/gplus_spec.rb
|
71
|
+
- spec/spec_helper.rb
|
53
72
|
homepage: https://github.com/nfm/gplus
|
54
73
|
licenses: []
|
55
74
|
post_install_message:
|