google_plus 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/google_plus.rb CHANGED
@@ -5,6 +5,7 @@ require File.dirname(__FILE__) + '/google_plus/cursor'
5
5
  module GooglePlus
6
6
 
7
7
  autoload :Activity, File.dirname(__FILE__) + '/google_plus/activity'
8
+ autoload :Comment, File.dirname(__FILE__) + '/google_plus/comment'
8
9
  autoload :Person, File.dirname(__FILE__) + '/google_plus/person'
9
10
 
10
11
  class << self
@@ -19,6 +19,10 @@ module GooglePlus
19
19
  GooglePlus::Cursor.new(self, :get, resource, params)
20
20
  end
21
21
 
22
+ def list_comments
23
+ GooglePlus::Comment.for_activity(id)
24
+ end
25
+
22
26
  def person
23
27
  @person ||= GooglePlus::Person.get(actor.id)
24
28
  end
@@ -0,0 +1,27 @@
1
+ require 'json'
2
+ require File.dirname(__FILE__) + '/entity'
3
+
4
+ module GooglePlus
5
+
6
+ class Comment
7
+
8
+ extend GooglePlus::Resource
9
+ include GooglePlus::Entity
10
+
11
+ def self.get(comment_id)
12
+ data = make_request(:get, "comments/#{comment_id}")
13
+ Comment.new(JSON.parse(data)) if data
14
+ end
15
+
16
+ def self.for_activity(activity_id, params = {})
17
+ resource = "activities/#{activity_id}/comments"
18
+ GooglePlus::Cursor.new(self, :get, resource, params)
19
+ end
20
+
21
+ def initialize(hash)
22
+ load_hash(hash)
23
+ end
24
+
25
+ end
26
+
27
+ end
@@ -11,7 +11,7 @@ module GooglePlus
11
11
 
12
12
  # Make a request to an external resource
13
13
  def make_request(method, resource, params = {})
14
- params[:key] = GooglePlus.api_key unless GooglePlus.api_key.nil?
14
+ params[:key] ||= GooglePlus.api_key unless GooglePlus.api_key.nil?
15
15
  params[:userIp] = params.delete(:user_ip) if params.has_key?(:user_ip)
16
16
  params[:pp] = '0' # google documentation is incorrect, it says 'prettyPrint'
17
17
  begin
@@ -1,5 +1,5 @@
1
1
  module GooglePlus
2
2
 
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,12 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-19 00:00:00.000000000Z
12
+ date: 2011-10-04 00:00:00.000000000 -04:00
13
+ default_executable:
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rspec
16
- requirement: &70185441073180 !ruby/object:Gem::Requirement
17
+ requirement: &70279600675640 !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
20
  - - ~>
@@ -21,10 +22,10 @@ dependencies:
21
22
  version: 2.6.0
22
23
  type: :development
23
24
  prerelease: false
24
- version_requirements: *70185441073180
25
+ version_requirements: *70279600675640
25
26
  - !ruby/object:Gem::Dependency
26
27
  name: rest-client
27
- requirement: &70185441072400 !ruby/object:Gem::Requirement
28
+ requirement: &70279600675140 !ruby/object:Gem::Requirement
28
29
  none: false
29
30
  requirements:
30
31
  - - ~>
@@ -32,7 +33,7 @@ dependencies:
32
33
  version: 1.6.1
33
34
  type: :runtime
34
35
  prerelease: false
35
- version_requirements: *70185441072400
36
+ version_requirements: *70279600675140
36
37
  description: Google+ Ruby Gem
37
38
  email: john.crepezzi@gmail.com
38
39
  executables: []
@@ -40,6 +41,7 @@ extensions: []
40
41
  extra_rdoc_files: []
41
42
  files:
42
43
  - lib/google_plus/activity.rb
44
+ - lib/google_plus/comment.rb
43
45
  - lib/google_plus/cursor.rb
44
46
  - lib/google_plus/entity.rb
45
47
  - lib/google_plus/errors/connection_error.rb
@@ -49,6 +51,7 @@ files:
49
51
  - lib/google_plus/version.rb
50
52
  - lib/google_plus.rb
51
53
  - spec/spec_helper.rb
54
+ has_rdoc: true
52
55
  homepage: http://github.com/seejohnrun/google_plus
53
56
  licenses: []
54
57
  post_install_message:
@@ -69,7 +72,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
69
72
  version: '0'
70
73
  requirements: []
71
74
  rubyforge_project: google_plus
72
- rubygems_version: 1.8.10
75
+ rubygems_version: 1.6.2
73
76
  signing_key:
74
77
  specification_version: 3
75
78
  summary: Ruby Gem for the Google+ API