Class: PostHaste::Comment
- Inherits:
-
Object
- Object
- PostHaste::Comment
- Defined in:
- lib/post_haste/comment.rb
Instance Attribute Summary collapse
-
#article_url ⇒ Object
readonly
Represents a comment on a Washington Post story.
-
#author ⇒ Object
readonly
Represents a comment on a Washington Post story.
-
#content ⇒ Object
readonly
Represents a comment on a Washington Post story.
-
#id ⇒ Object
readonly
Represents a comment on a Washington Post story.
-
#permalink(article) ⇒ Object
readonly
Represents a comment on a Washington Post story.
-
#published ⇒ Object
readonly
Represents a comment on a Washington Post story.
-
#status ⇒ Object
readonly
Represents a comment on a Washington Post story.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Comment
constructor
A new instance of Comment.
Constructor Details
#initialize(params = {}) ⇒ Comment
Returns a new instance of Comment.
7 8 9 10 11 |
# File 'lib/post_haste/comment.rb', line 7 def initialize(params={}) params.each_pair do |k,v| instance_variable_set("@#{k}", v) end end |
Instance Attribute Details
#article_url ⇒ Object (readonly)
Represents a comment on a Washington Post story
5 6 7 |
# File 'lib/post_haste/comment.rb', line 5 def article_url @article_url end |
#author ⇒ Object (readonly)
Represents a comment on a Washington Post story
5 6 7 |
# File 'lib/post_haste/comment.rb', line 5 def @author end |
#content ⇒ Object (readonly)
Represents a comment on a Washington Post story
5 6 7 |
# File 'lib/post_haste/comment.rb', line 5 def content @content end |
#id ⇒ Object (readonly)
Represents a comment on a Washington Post story
5 6 7 |
# File 'lib/post_haste/comment.rb', line 5 def id @id end |
#permalink(article) ⇒ Object (readonly)
Represents a comment on a Washington Post story
5 6 7 |
# File 'lib/post_haste/comment.rb', line 5 def permalink @permalink end |
#published ⇒ Object (readonly)
Represents a comment on a Washington Post story
5 6 7 |
# File 'lib/post_haste/comment.rb', line 5 def published @published end |
#status ⇒ Object (readonly)
Represents a comment on a Washington Post story
5 6 7 |
# File 'lib/post_haste/comment.rb', line 5 def status @status end |
Class Method Details
.create_comments_from_objects(article_url, comments) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/post_haste/comment.rb', line 13 def self.create_comments_from_objects(article_url, comments) results = [] comments.each do |comment| c = Comment.new({:id => comment['object']['id'], :article_url => article_url, :author => comment['actor']['title'], :content => comment['object']['content'], :status => comment['object']['status'], :published => DateTime.parse(comment['object']['published'])}) results << c end results end |