google_plus 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +7 -7
- data/lib/google_plus.rb +1 -0
- data/lib/google_plus/access_token.rb +11 -0
- data/lib/google_plus/person.rb +20 -2
- data/lib/google_plus/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- metadata +31 -23
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8ff4cb11b0ea9f184b1e42febde397340dc41151
|
4
|
+
data.tar.gz: 2088580a6cac70dfbd6aca62629ef85496d1a936
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1bfe64b3d5a539195abd77042c34a24576b8204bc3e035cacfccb0b8df99c2d159ce481b82fc5dd3bd55f73ae77daa5ffbbcf49b1683135e0a406cf9aada1189
|
7
|
+
data.tar.gz: 076528176556fa9ee640952032103f2368e9e7c906b3355642c35b49c2776458c2ac3926f8f3ddc8e60aebef16817dfb1a06a3badf466e9f47c2911dd79ee190
|
data/README.md
CHANGED
@@ -58,19 +58,19 @@ Lastly, you can get a list of activities for a person, which is returned as a `G
|
|
58
58
|
|
59
59
|
person = GooglePlus::Person.new(123)
|
60
60
|
cursor = person.list_activities
|
61
|
-
|
62
|
-
|
61
|
+
cursor.each do |item|
|
62
|
+
item # an item
|
63
63
|
end
|
64
64
|
|
65
65
|
Or if you just want one page, you can have it:
|
66
66
|
|
67
67
|
person = GooglePlus::Person.new(123)
|
68
|
-
activites = person.
|
68
|
+
activites = person.list_activities.items
|
69
69
|
|
70
70
|
You can also set the cursor size at any time using any of these variations:
|
71
71
|
|
72
72
|
# on the cursor
|
73
|
-
cursor = person.
|
73
|
+
cursor = person.list_activities(:max_results => 10)
|
74
74
|
# or on the page
|
75
75
|
items = cursor.next_page(:max_results => 5)
|
76
76
|
|
@@ -90,8 +90,8 @@ Getting comments for an activity is done just like getting activities for a pers
|
|
90
90
|
|
91
91
|
activity = GooglePlus::Activity.get(123)
|
92
92
|
cursor = activity.list_comments
|
93
|
-
|
94
|
-
|
93
|
+
cursor.each do |item|
|
94
|
+
# a comment
|
95
95
|
end
|
96
96
|
|
97
97
|
## Searching
|
@@ -100,7 +100,7 @@ You can search for [people](https://developers.google.com/+/api/latest/people/se
|
|
100
100
|
|
101
101
|
search = GooglePlus::Person.search('john crepezzi')
|
102
102
|
search.each do |p|
|
103
|
-
|
103
|
+
puts p.display_name
|
104
104
|
end
|
105
105
|
|
106
106
|
## Setting options
|
data/lib/google_plus.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
module GooglePlus
|
2
|
+
class AccessToken
|
3
|
+
BASE_URI = 'https://accounts.google.com/o/oauth2/token'
|
4
|
+
|
5
|
+
def self.get(params)
|
6
|
+
params.merge!(grant_type: 'refresh_token')
|
7
|
+
response = RestClient.post(BASE_URI, params)
|
8
|
+
JSON.parse(response)["access_token"]
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/lib/google_plus/person.rb
CHANGED
@@ -17,6 +17,18 @@ module GooglePlus
|
|
17
17
|
Person.new(JSON.parse(data)) if data
|
18
18
|
end
|
19
19
|
|
20
|
+
# Get a list of people for a collection
|
21
|
+
# @params [String] user_id the id of the user to look up
|
22
|
+
# @params [String] collection to retrieve ('visible' only currently)
|
23
|
+
# @option params [Symbol] :key A different API key to use for this request
|
24
|
+
# @option params [Symbol] :user_ip The IP of the user on who's behalf this request is made
|
25
|
+
# @return [GooglePlus::Cursor] a cursor for the people found
|
26
|
+
def self.list(user_id = 'me', collection = 'visible', params = {})
|
27
|
+
path_segments = ['people', user_id, 'people', collection]
|
28
|
+
path = path_segments.map { |ps| URI.escape(ps) }.join('/')
|
29
|
+
GooglePlus::Cursor.new(self, :get, path, params)
|
30
|
+
end
|
31
|
+
|
20
32
|
# Search for a person
|
21
33
|
# @param [String] query The query string to search for
|
22
34
|
# @option params [Symbol] :key A different API key to use for this request
|
@@ -30,8 +42,14 @@ module GooglePlus
|
|
30
42
|
|
31
43
|
# List the activities for this person
|
32
44
|
# @return [GooglePlus::Cursor] a cursor of activities for this person
|
33
|
-
def list_activities
|
34
|
-
GooglePlus::Activity.for_person(id)
|
45
|
+
def list_activities(params = {})
|
46
|
+
GooglePlus::Activity.for_person(id, params)
|
47
|
+
end
|
48
|
+
|
49
|
+
# List visible people for the user
|
50
|
+
# @return [GooglePlus::Cursor] cursor of people
|
51
|
+
def list_visible_people(params = {})
|
52
|
+
GooglePlus::Person.list('me', 'visible', params)
|
35
53
|
end
|
36
54
|
|
37
55
|
# Load a new instance from an attributes hash
|
data/lib/google_plus/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,66 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- John Crepezzi
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-07-19 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: rspec
|
16
|
-
requirement:
|
17
|
-
none: false
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ">="
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
|
-
version_requirements:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
25
27
|
- !ruby/object:Gem::Dependency
|
26
28
|
name: rest-client
|
27
|
-
requirement:
|
28
|
-
none: false
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
29
30
|
requirements:
|
30
|
-
- - ~>
|
31
|
+
- - "~>"
|
31
32
|
- !ruby/object:Gem::Version
|
32
33
|
version: 1.6.1
|
33
34
|
type: :runtime
|
34
35
|
prerelease: false
|
35
|
-
version_requirements:
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.6.1
|
36
41
|
- !ruby/object:Gem::Dependency
|
37
42
|
name: json
|
38
|
-
requirement:
|
39
|
-
none: false
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
40
44
|
requirements:
|
41
|
-
- -
|
45
|
+
- - ">="
|
42
46
|
- !ruby/object:Gem::Version
|
43
47
|
version: '0'
|
44
48
|
type: :runtime
|
45
49
|
prerelease: false
|
46
|
-
version_requirements:
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
47
55
|
description: Google+ Ruby Gem
|
48
56
|
email: john.crepezzi@gmail.com
|
49
57
|
executables: []
|
50
58
|
extensions: []
|
51
59
|
extra_rdoc_files: []
|
52
60
|
files:
|
61
|
+
- README.md
|
62
|
+
- lib/google_plus.rb
|
63
|
+
- lib/google_plus/access_token.rb
|
53
64
|
- lib/google_plus/activity.rb
|
54
65
|
- lib/google_plus/comment.rb
|
55
66
|
- lib/google_plus/cursor.rb
|
@@ -59,32 +70,29 @@ files:
|
|
59
70
|
- lib/google_plus/person.rb
|
60
71
|
- lib/google_plus/resource.rb
|
61
72
|
- lib/google_plus/version.rb
|
62
|
-
- lib/google_plus.rb
|
63
|
-
- README.md
|
64
73
|
- spec/spec_helper.rb
|
65
74
|
homepage: http://github.com/seejohnrun/google_plus
|
66
75
|
licenses: []
|
76
|
+
metadata: {}
|
67
77
|
post_install_message:
|
68
78
|
rdoc_options: []
|
69
79
|
require_paths:
|
70
80
|
- lib
|
71
81
|
required_ruby_version: !ruby/object:Gem::Requirement
|
72
|
-
none: false
|
73
82
|
requirements:
|
74
|
-
- -
|
83
|
+
- - ">="
|
75
84
|
- !ruby/object:Gem::Version
|
76
85
|
version: '0'
|
77
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
78
|
-
none: false
|
79
87
|
requirements:
|
80
|
-
- -
|
88
|
+
- - ">="
|
81
89
|
- !ruby/object:Gem::Version
|
82
90
|
version: '0'
|
83
91
|
requirements: []
|
84
92
|
rubyforge_project: google_plus
|
85
|
-
rubygems_version:
|
93
|
+
rubygems_version: 2.2.2
|
86
94
|
signing_key:
|
87
|
-
specification_version:
|
95
|
+
specification_version: 4
|
88
96
|
summary: Ruby Gem for the Google+ API
|
89
97
|
test_files:
|
90
98
|
- spec/spec_helper.rb
|