class Quandora::Question

show

Public Instance Methods

answer(question_id, args) click to toggle source
# File lib/quandora/question.rb, line 19
def answer(question_id, args)
  body = {
    "type": "post-answer",
    "data": {
      "content": args["content"],
      "contentType": args["content_type"] || "markdown"
    }
  }
  resp = @conn.post("q/#{question_id}/answer") do |req|
    req.body = body.to_json
    req.headers['Content-Type'] = 'application/json'
  end
end
comment(question_id) click to toggle source
# File lib/quandora/question.rb, line 45
def comment(question_id)
  Quandora::Comment.new(@conn, "q", question_id)    
end
detail(question_id) click to toggle source
# File lib/quandora/question.rb, line 4
def detail(question_id)
  @api = "q/"
  show("#{question_id}")
end
mlt(question_id, args = {}) click to toggle source
# File lib/quandora/question.rb, line 14
def mlt(question_id, args = {})
  @api = "q/"
  show("#{question_id}/mlt")
end
tag(answer_id) click to toggle source
# File lib/quandora/question.rb, line 49
def tag(answer_id)
  Quandora::Tag.new(@conn, "q", answer_id)    
end
view(question_id, args = {}) click to toggle source
# File lib/quandora/question.rb, line 9
def view(question_id, args = {})
  @api = "q/"
  show("#{question_id}/view")
end
vote(question_id, args) click to toggle source
# File lib/quandora/question.rb, line 33
def vote(question_id, args)
  body = {
    "type": "boolean",
    "data": args["vote"]
  }

  resp = @conn.post("q/#{question_id}/vote") do |req|
    req.body = body.to_json
    req.headers['Content-Type'] = 'application/json'
  end
end