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.
11 12 13 14 15 |
# File 'lib/post_haste/comment.rb', line 11 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
9 10 11 |
# File 'lib/post_haste/comment.rb', line 9 def article_url @article_url end |
#author ⇒ Object (readonly)
Represents a comment on a Washington Post story
9 10 11 |
# File 'lib/post_haste/comment.rb', line 9 def end |
#content ⇒ Object (readonly)
Represents a comment on a Washington Post story
9 10 11 |
# File 'lib/post_haste/comment.rb', line 9 def content @content end |
#id ⇒ Object (readonly)
Represents a comment on a Washington Post story
9 10 11 |
# File 'lib/post_haste/comment.rb', line 9 def id @id end |
#permalink(article) ⇒ Object (readonly)
Represents a comment on a Washington Post story
9 10 11 |
# File 'lib/post_haste/comment.rb', line 9 def permalink @permalink end |
#published ⇒ Object (readonly)
Represents a comment on a Washington Post story
9 10 11 |
# File 'lib/post_haste/comment.rb', line 9 def published @published end |
#status ⇒ Object (readonly)
Represents a comment on a Washington Post story
9 10 11 |
# File 'lib/post_haste/comment.rb', line 9 def status @status end |
Class Method Details
.create_comments_from_objects(article_url, comments) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/post_haste/comment.rb', line 17 def self.create_comments_from_objects(article_url, comments) results = [] comments.each do |comment| c = Comment.new({:id => comment['object']['id'].gsub('http://',''), :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 |