Class: API::StackOverflow::Answer
- Inherits:
-
Object
- Object
- API::StackOverflow::Answer
- Defined in:
- lib/answer.rb
Instance Attribute Summary collapse
-
#accepted ⇒ Object
Returns the value of attribute accepted.
-
#comments_url ⇒ Object
Returns the value of attribute comments_url.
-
#community_owned ⇒ Object
Returns the value of attribute community_owned.
-
#creation_date ⇒ Object
Returns the value of attribute creation_date.
-
#down_vote_count ⇒ Object
Returns the value of attribute down_vote_count.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_activity_date ⇒ Object
Returns the value of attribute last_activity_date.
-
#question_id ⇒ Object
Returns the value of attribute question_id.
-
#score ⇒ Object
Returns the value of attribute score.
-
#title ⇒ Object
Returns the value of attribute title.
-
#up_vote_count ⇒ Object
Returns the value of attribute up_vote_count.
-
#view_count ⇒ Object
Returns the value of attribute view_count.
Instance Method Summary collapse
-
#initialize(so_answer) ⇒ Answer
constructor
A new instance of Answer.
- #vote_count ⇒ Object
Constructor Details
#initialize(so_answer) ⇒ Answer
Returns a new instance of Answer.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/answer.rb', line 8 def initialize(so_answer) @id = so_answer["answer_id"] @title = so_answer["title"] @accepted = so_answer["accepted"] @comments_url = so_answer["answer_comments_url"] @question_id = so_answer["question_id"] @creation_date = Time.at(so_answer["creation_date"]) if so_answer["creation_date"] @last_activity_date = Time.at(so_answer["last_activity_date"]) if so_answer["last_activity_date"] @up_vote_count = so_answer["up_vote_count"] @down_vote_count = so_answer["down_vote_count"] @view_count = so_answer["view_count"] @score = so_answer["score"] @community_owned = so_answer["community_owned"] end |
Instance Attribute Details
#accepted ⇒ Object
Returns the value of attribute accepted.
4 5 6 |
# File 'lib/answer.rb', line 4 def accepted @accepted end |
#comments_url ⇒ Object
Returns the value of attribute comments_url.
4 5 6 |
# File 'lib/answer.rb', line 4 def comments_url @comments_url end |
#community_owned ⇒ Object
Returns the value of attribute community_owned.
6 7 8 |
# File 'lib/answer.rb', line 6 def community_owned @community_owned end |
#creation_date ⇒ Object
Returns the value of attribute creation_date.
5 6 7 |
# File 'lib/answer.rb', line 5 def creation_date @creation_date end |
#down_vote_count ⇒ Object
Returns the value of attribute down_vote_count.
6 7 8 |
# File 'lib/answer.rb', line 6 def down_vote_count @down_vote_count end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/answer.rb', line 4 def id @id end |
#last_activity_date ⇒ Object
Returns the value of attribute last_activity_date.
5 6 7 |
# File 'lib/answer.rb', line 5 def last_activity_date @last_activity_date end |
#question_id ⇒ Object
Returns the value of attribute question_id.
4 5 6 |
# File 'lib/answer.rb', line 4 def question_id @question_id end |
#score ⇒ Object
Returns the value of attribute score.
6 7 8 |
# File 'lib/answer.rb', line 6 def score @score end |
#title ⇒ Object
Returns the value of attribute title.
4 5 6 |
# File 'lib/answer.rb', line 4 def title @title end |
#up_vote_count ⇒ Object
Returns the value of attribute up_vote_count.
6 7 8 |
# File 'lib/answer.rb', line 6 def up_vote_count @up_vote_count end |
#view_count ⇒ Object
Returns the value of attribute view_count.
6 7 8 |
# File 'lib/answer.rb', line 6 def view_count @view_count end |
Instance Method Details
#vote_count ⇒ Object
23 24 25 |
# File 'lib/answer.rb', line 23 def vote_count @up_vote_count - @down_vote_count end |