Class: GooglePlus::Comment
- Inherits:
-
Object
- Object
- GooglePlus::Comment
- Extended by:
- Resource
- Includes:
- Entity
- Defined in:
- lib/google_plus/comment.rb
Overview
A Comment in Google Plus
Constant Summary
Constants included from Resource
Instance Attribute Summary
Attributes included from Entity
Class Method Summary collapse
-
.for_activity(activity_id, params = {}) ⇒ GooglePlus::Cursor
Get a cursor of comments for an activity.
-
.get(comment_id, params = {}) ⇒ GooglePlus::Comment
Get a comment by id.
Instance Method Summary collapse
-
#initialize(hash) ⇒ GooglePlus::Comment
constructor
Load a new instance from an attributes hash.
Methods included from Resource
Methods included from Entity
included, #method_missing, #respond_to?
Constructor Details
#initialize(hash) ⇒ GooglePlus::Comment
Load a new instance from an attributes hash. Useful if you have the underlying response data for an object - Generally, what you want is #get though
34 35 36 |
# File 'lib/google_plus/comment.rb', line 34 def initialize(hash) load_hash(hash) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class GooglePlus::Entity
Class Method Details
.for_activity(activity_id, params = {}) ⇒ GooglePlus::Cursor
Get a cursor of comments for an activity
25 26 27 28 |
# File 'lib/google_plus/comment.rb', line 25 def self.for_activity(activity_id, params = {}) resource = "activities/#{activity_id}/comments" GooglePlus::Cursor.new(self, :get, resource, params) end |
.get(comment_id, params = {}) ⇒ GooglePlus::Comment
Get a comment by id
15 16 17 18 |
# File 'lib/google_plus/comment.rb', line 15 def self.get(comment_id, params = {}) data = make_request(:get, "comments/#{comment_id}", params) Comment.new(JSON.parse(data)) if data end |