Class: API::StackOverflow::Question
- Inherits:
-
Object
- Object
- API::StackOverflow::Question
- Defined in:
- lib/question.rb
Instance Attribute Summary collapse
-
#accepted_answer_id ⇒ Object
Returns the value of attribute accepted_answer_id.
-
#answer_count ⇒ Object
Returns the value of attribute answer_count.
-
#answers_url ⇒ Object
Returns the value of attribute answers_url.
-
#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.
-
#favorite_count ⇒ Object
Returns the value of attribute favorite_count.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_activity_date ⇒ Object
Returns the value of attribute last_activity_date.
-
#last_edit_date ⇒ Object
Returns the value of attribute last_edit_date.
-
#score ⇒ Object
Returns the value of attribute score.
-
#timeline_url ⇒ Object
Returns the value of attribute timeline_url.
-
#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_question) ⇒ Question
constructor
A new instance of Question.
- #vote_count ⇒ Object
Constructor Details
#initialize(so_question) ⇒ Question
Returns a new instance of Question.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/question.rb', line 10 def initialize(so_question) @id = so_question["question_id"] @answer_count = so_question["answer_count"] @accepted_answer_id = so_question["accepted_answer_id"] @favorite_count = so_question["favorite_count"] @timeline_url = so_question["question_timeline_url"] @comments_url = so_question["question_comments_url"] @answers_url = so_question["question_answers_url"] @creation_date = Time.at(so_question["creation_date"]) if so_question["creation_date"] @last_edit_date = Time.at(so_question["last_edit_date"]) if so_question["last_edit_date"] @last_activity_date = Time.at(so_question["last_activity_date"]) if so_question["last_activity_date"] @up_vote_count = so_question["up_vote_count"] @down_vote_count = so_question["down_vote_count"] @view_count = so_question["view_count"] @score = so_question["score"] @community_owned = so_question["community_owned"] @title = so_question["title"] end |
Instance Attribute Details
#accepted_answer_id ⇒ Object
Returns the value of attribute accepted_answer_id.
4 5 6 |
# File 'lib/question.rb', line 4 def accepted_answer_id @accepted_answer_id end |
#answer_count ⇒ Object
Returns the value of attribute answer_count.
4 5 6 |
# File 'lib/question.rb', line 4 def answer_count @answer_count end |
#answers_url ⇒ Object
Returns the value of attribute answers_url.
5 6 7 |
# File 'lib/question.rb', line 5 def answers_url @answers_url end |
#comments_url ⇒ Object
Returns the value of attribute comments_url.
5 6 7 |
# File 'lib/question.rb', line 5 def comments_url @comments_url end |
#community_owned ⇒ Object
Returns the value of attribute community_owned.
8 9 10 |
# File 'lib/question.rb', line 8 def community_owned @community_owned end |
#creation_date ⇒ Object
Returns the value of attribute creation_date.
6 7 8 |
# File 'lib/question.rb', line 6 def creation_date @creation_date end |
#down_vote_count ⇒ Object
Returns the value of attribute down_vote_count.
7 8 9 |
# File 'lib/question.rb', line 7 def down_vote_count @down_vote_count end |
#favorite_count ⇒ Object
Returns the value of attribute favorite_count.
4 5 6 |
# File 'lib/question.rb', line 4 def favorite_count @favorite_count end |
#id ⇒ Object
Returns the value of attribute id.
5 6 7 |
# File 'lib/question.rb', line 5 def id @id end |
#last_activity_date ⇒ Object
Returns the value of attribute last_activity_date.
6 7 8 |
# File 'lib/question.rb', line 6 def last_activity_date @last_activity_date end |
#last_edit_date ⇒ Object
Returns the value of attribute last_edit_date.
6 7 8 |
# File 'lib/question.rb', line 6 def last_edit_date @last_edit_date end |
#score ⇒ Object
Returns the value of attribute score.
7 8 9 |
# File 'lib/question.rb', line 7 def score @score end |
#timeline_url ⇒ Object
Returns the value of attribute timeline_url.
4 5 6 |
# File 'lib/question.rb', line 4 def timeline_url @timeline_url end |
#title ⇒ Object
Returns the value of attribute title.
8 9 10 |
# File 'lib/question.rb', line 8 def title @title end |
#up_vote_count ⇒ Object
Returns the value of attribute up_vote_count.
7 8 9 |
# File 'lib/question.rb', line 7 def up_vote_count @up_vote_count end |
#view_count ⇒ Object
Returns the value of attribute view_count.
7 8 9 |
# File 'lib/question.rb', line 7 def view_count @view_count end |
Instance Method Details
#vote_count ⇒ Object
29 30 31 |
# File 'lib/question.rb', line 29 def vote_count @up_vote_count - @down_vote_count end |