Class: Rubyoverflow::Question
Instance Attribute Summary collapse
-
#accepted_answer_id ⇒ Object
readonly
Returns the value of attribute accepted_answer_id.
-
#answer_count ⇒ Object
readonly
Returns the value of attribute answer_count.
-
#answers ⇒ Object
readonly
Returns the value of attribute answers.
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#bounty_amount ⇒ Object
readonly
Returns the value of attribute bounty_amount.
-
#bounty_closes_date ⇒ Object
readonly
Returns the value of attribute bounty_closes_date.
-
#closed_date ⇒ Object
readonly
Returns the value of attribute closed_date.
-
#closed_reason ⇒ Object
readonly
Returns the value of attribute closed_reason.
-
#comments ⇒ Object
readonly
Returns the value of attribute comments.
-
#community_owned ⇒ Object
readonly
Returns the value of attribute community_owned.
-
#creation_date ⇒ Object
readonly
Returns the value of attribute creation_date.
-
#down_vote_count ⇒ Object
readonly
Returns the value of attribute down_vote_count.
-
#favorite_count ⇒ Object
readonly
Returns the value of attribute favorite_count.
-
#last_activity_date ⇒ Object
readonly
Returns the value of attribute last_activity_date.
-
#last_edit_date ⇒ Object
readonly
Returns the value of attribute last_edit_date.
-
#locked_date ⇒ Object
readonly
Returns the value of attribute locked_date.
-
#migrated ⇒ Object
readonly
Returns the value of attribute migrated.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
-
#protected_date ⇒ Object
readonly
Returns the value of attribute protected_date.
-
#question_answers_url ⇒ Object
readonly
Returns the value of attribute question_answers_url.
-
#question_comments_url ⇒ Object
readonly
Returns the value of attribute question_comments_url.
-
#question_id ⇒ Object
readonly
Returns the value of attribute question_id.
-
#question_timeline_url ⇒ Object
readonly
Returns the value of attribute question_timeline_url.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#up_vote_count ⇒ Object
readonly
Returns the value of attribute up_vote_count.
-
#view_count ⇒ Object
readonly
Returns the value of attribute view_count.
Instance Method Summary collapse
-
#get_answers(parameters = {}) ⇒ Object
Gets the answers posted to the question.
-
#get_comments(parameters = {}) ⇒ Object
Gets the comments made on the question.
-
#get_timeline(parameters = {}) ⇒ Object
Gets the timeline for the question.
-
#initialize(hash, request_path = '') ⇒ Question
constructor
A new instance of Question.
Methods inherited from Base
change_end_point, client, convert_if_array, convert_to_id_list, #find_parse_querystring, request, #request
Constructor Details
#initialize(hash, request_path = '') ⇒ Question
Returns a new instance of Question.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/rubyoverflow/question.rb', line 9 def initialize(hash, request_path = '') dash = QuestionDash.new hash @tags = Array.new @comments = Array.new @answers = Array.new dash..each {|tag| @tags.push(tag)} if dash. dash.comments.each {|commentHash| @comment.push(Comment.new commentHash)} if dash.comments dash.answers.each {|answerHash| @comment.push(Answer.new answerHash)} if dash.answers @migrated = dash.migrated @answer_count = dash.answer_count @accepted_answer_id = dash.accepted_answer_id @favorite_count = dash.favorite_count @bounty_closes_date = dash.bounty_closes_date @bounty_amount = dash.bounty_amount @closed_date = dash.closed_date @closed_reason = dash.closed_reason @question_timeline_url = dash.question_timeline_url @question_comments_url = dash.question_comments_url @question_answers_url = dash.question_answers_url @question_id = dash.question_id @locked_date = dash.locked_date @owner = User.new dash.owner if dash.owner @creation_date = dash.creation_date @last_edit_date = dash.last_edit_date @last_activity_date = dash.last_activity_date @up_vote_count = dash.up_vote_count @down_vote_count = dash.down_vote_count @view_count = dash.view_count @score = dash.score @community_owned = dash.community_owned @title = dash.title @body = dash.body @protected_date = dash.protected_date end |
Instance Attribute Details
#accepted_answer_id ⇒ Object (readonly)
Returns the value of attribute accepted_answer_id.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def accepted_answer_id @accepted_answer_id end |
#answer_count ⇒ Object (readonly)
Returns the value of attribute answer_count.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def answer_count @answer_count end |
#answers ⇒ Object (readonly)
Returns the value of attribute answers.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def answers @answers end |
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def body @body end |
#bounty_amount ⇒ Object (readonly)
Returns the value of attribute bounty_amount.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def bounty_amount @bounty_amount end |
#bounty_closes_date ⇒ Object (readonly)
Returns the value of attribute bounty_closes_date.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def bounty_closes_date @bounty_closes_date end |
#closed_date ⇒ Object (readonly)
Returns the value of attribute closed_date.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def closed_date @closed_date end |
#closed_reason ⇒ Object (readonly)
Returns the value of attribute closed_reason.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def closed_reason @closed_reason end |
#comments ⇒ Object (readonly)
Returns the value of attribute comments.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def comments @comments end |
#community_owned ⇒ Object (readonly)
Returns the value of attribute community_owned.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def community_owned @community_owned end |
#creation_date ⇒ Object (readonly)
Returns the value of attribute creation_date.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def creation_date @creation_date end |
#down_vote_count ⇒ Object (readonly)
Returns the value of attribute down_vote_count.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def down_vote_count @down_vote_count end |
#favorite_count ⇒ Object (readonly)
Returns the value of attribute favorite_count.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def favorite_count @favorite_count end |
#last_activity_date ⇒ Object (readonly)
Returns the value of attribute last_activity_date.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def last_activity_date @last_activity_date end |
#last_edit_date ⇒ Object (readonly)
Returns the value of attribute last_edit_date.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def last_edit_date @last_edit_date end |
#locked_date ⇒ Object (readonly)
Returns the value of attribute locked_date.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def locked_date @locked_date end |
#migrated ⇒ Object (readonly)
Returns the value of attribute migrated.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def migrated @migrated end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def owner @owner end |
#protected_date ⇒ Object (readonly)
Returns the value of attribute protected_date.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def protected_date @protected_date end |
#question_answers_url ⇒ Object (readonly)
Returns the value of attribute question_answers_url.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def question_answers_url @question_answers_url end |
#question_comments_url ⇒ Object (readonly)
Returns the value of attribute question_comments_url.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def question_comments_url @question_comments_url end |
#question_id ⇒ Object (readonly)
Returns the value of attribute question_id.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def question_id @question_id end |
#question_timeline_url ⇒ Object (readonly)
Returns the value of attribute question_timeline_url.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def question_timeline_url @question_timeline_url end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def score @score end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def @tags end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def title @title end |
#up_vote_count ⇒ Object (readonly)
Returns the value of attribute up_vote_count.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def up_vote_count @up_vote_count end |
#view_count ⇒ Object (readonly)
Returns the value of attribute view_count.
3 4 5 |
# File 'lib/rubyoverflow/question.rb', line 3 def view_count @view_count end |
Instance Method Details
#get_answers(parameters = {}) ⇒ Object
Gets the answers posted to the question
58 59 60 61 62 63 64 65 |
# File 'lib/rubyoverflow/question.rb', line 58 def get_answers(parameters = {}) if @question_answers_url hash,url =request(@question_answers_url, parameters) Answers.new hash, url else nil end end |
#get_comments(parameters = {}) ⇒ Object
Gets the comments made on the question
48 49 50 51 52 53 54 55 |
# File 'lib/rubyoverflow/question.rb', line 48 def get_comments(parameters = {}) if @question_comments_url hash,url =request(@question_comments_url, parameters) Comments.new hash, url else nil end end |
#get_timeline(parameters = {}) ⇒ Object
Gets the timeline for the question
68 69 70 71 72 73 74 75 |
# File 'lib/rubyoverflow/question.rb', line 68 def get_timeline(parameters = {}) if @question_timeline_url hash,url =request(@question_timeline_url, parameters) PostTimelineEvents.new hash, url else nil end end |