Class: Stacked::Question
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 ⇒ Object
Returns the value of attribute answers.
-
#body ⇒ Object
Returns the value of attribute body.
-
#bounty_closes_date ⇒ Object
Returns the value of attribute bounty_closes_date.
-
#community_owned ⇒ Object
Returns the value of attribute community_owned.
-
#creation_date ⇒ Object
(also: #created_at)
Returns the value of attribute creation_date.
-
#down_vote_count ⇒ Object
(also: #down_votes)
Returns the value of attribute down_vote_count.
-
#favorite_count ⇒ Object
(also: #favorites, #favourites)
Returns the value of attribute favorite_count.
-
#last_activity_date ⇒ Object
Returns the value of attribute last_activity_date.
-
#last_edit_date ⇒ Object
(also: #updated_at)
Returns the value of attribute last_edit_date.
-
#owner_display_name ⇒ Object
Returns the value of attribute owner_display_name.
-
#owner_user_id ⇒ Object
Returns the value of attribute owner_user_id.
-
#question_id ⇒ Object
(also: #id)
Returns the value of attribute question_id.
-
#score ⇒ Object
Returns the value of attribute score.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#title ⇒ Object
Returns the value of attribute title.
-
#up_vote_count ⇒ Object
(also: #up_votes)
Returns the value of attribute up_vote_count.
-
#view_count ⇒ Object
(also: #views)
Returns the value of attribute view_count.
Class Method Summary collapse
-
.tagged(options = {}) ⇒ Object
All questions tagged with the given tags.
-
.unanswered_by_votes(options = {}) ⇒ Object
All unanswered questions ordered by votes.
Instance Method Summary collapse
-
#accepted_answer ⇒ Object
The Stacked::Answer representing the accepted answer.
-
#owner ⇒ Object
(also: #user)
The Stacked::User representation of the owner.
-
#timeline(options = {}) ⇒ Object
A timeline of the question.
Methods inherited from Base
all, association, collection, find, #initialize, #parse_answers, #parse_badges, #parse_comments, #parse_post_timeline, #parse_questions, #parse_reputations, #parse_tags, #parse_type, #parse_user_timeline, #post, records, request, singular, stats
Constructor Details
This class inherits a constructor from Stacked::Base
Instance Attribute Details
#accepted_answer_id ⇒ Object
Returns the value of attribute accepted_answer_id.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def accepted_answer_id @accepted_answer_id end |
#answer_count ⇒ Object
Returns the value of attribute answer_count.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def answer_count @answer_count end |
#answers ⇒ Object
Returns the value of attribute answers.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def answers @answers end |
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def body @body end |
#bounty_closes_date ⇒ Object
Returns the value of attribute bounty_closes_date.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def bounty_closes_date @bounty_closes_date end |
#community_owned ⇒ Object
Returns the value of attribute community_owned.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def community_owned @community_owned end |
#creation_date ⇒ Object Also known as: created_at
Returns the value of attribute creation_date.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def creation_date @creation_date end |
#down_vote_count ⇒ Object Also known as: down_votes
Returns the value of attribute down_vote_count.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def down_vote_count @down_vote_count end |
#favorite_count ⇒ Object Also known as: favorites, favourites
Returns the value of attribute favorite_count.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def favorite_count @favorite_count end |
#last_activity_date ⇒ Object
Returns the value of attribute last_activity_date.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def last_activity_date @last_activity_date end |
#last_edit_date ⇒ Object Also known as: updated_at
Returns the value of attribute last_edit_date.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def last_edit_date @last_edit_date end |
#owner_display_name ⇒ Object
Returns the value of attribute owner_display_name.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def owner_display_name @owner_display_name end |
#owner_user_id ⇒ Object
Returns the value of attribute owner_user_id.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def owner_user_id @owner_user_id end |
#question_id ⇒ Object Also known as: id
Returns the value of attribute question_id.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def question_id @question_id end |
#score ⇒ Object
Returns the value of attribute score.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def score @score end |
#tags ⇒ Object
Returns the value of attribute tags.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def @tags end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def title @title end |
#up_vote_count ⇒ Object Also known as: up_votes
Returns the value of attribute up_vote_count.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def up_vote_count @up_vote_count end |
#view_count ⇒ Object Also known as: views
Returns the value of attribute view_count.
3 4 5 |
# File 'lib/stacked/question.rb', line 3 def view_count @view_count end |
Class Method Details
.tagged(options = {}) ⇒ Object
All questions tagged with the given tags. Accepts tags as either :tags
or :tagged
Must be an Array of tags.
78 79 80 81 82 |
# File 'lib/stacked/question.rb', line 78 def tagged(={}) [:tagged] ||= [] [:tagged] = ([:tagged] << [:tags]).join(", ") records(path + "tagged", ) end |
.unanswered_by_votes(options = {}) ⇒ Object
All unanswered questions ordered by votes.
71 72 73 |
# File 'lib/stacked/question.rb', line 71 def unanswered_by_votes(={}) records(path + "unanswered/votes", ) end |
Instance Method Details
#accepted_answer ⇒ Object
The Stacked::Answer representing the accepted answer. nil if none accepted
38 39 40 |
# File 'lib/stacked/question.rb', line 38 def accepted_answer Answer.find(accepted_answer_id) if accepted_answer_id end |
#owner ⇒ Object Also known as: user
The Stacked::User representation of the owner.
43 44 45 |
# File 'lib/stacked/question.rb', line 43 def owner @owner ||= User.find(owner_user_id) end |
#timeline(options = {}) ⇒ Object
A timeline of the question.
48 49 50 |
# File 'lib/stacked/question.rb', line 48 def timeline(={}) parse_post_timeline(request(singular(id) + "timeline", )) end |