Class: Quandora::Answer

Inherits:
Request show all
Defined in:
lib/quandora/answer.rb

Instance Attribute Summary

Attributes inherited from Request

#api, #params

Instance Method Summary collapse

Methods inherited from Request

#index, #initialize, #show

Constructor Details

This class inherits a constructor from Quandora::Request

Instance Method Details

#accept(answer_id, args) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/quandora/answer.rb', line 16

def accept(answer_id, args)
  args = args.stringify_keys

  body = {
    "type": "boolean",
    "data": args["accept"]
  }

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

#comment(answer_id) ⇒ Object



30
31
32
# File 'lib/quandora/answer.rb', line 30

def comment(answer_id)
  Comment.new(@conn, "a", answer_id)
end

#vote(answer_id, args) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/quandora/answer.rb', line 2

def vote(answer_id, args)
  args = args.stringify_keys

  body = {
    "type": "boolean",
    "data": args["vote"]
  }

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