class Quandora::Comment

Public Class Methods

new(conn, api, id) click to toggle source
# File lib/quandora/comment.rb, line 2
def initialize(conn, api, id)
  @conn = conn
  @api = api
  @id = id
end

Public Instance Methods

create(args) click to toggle source
# File lib/quandora/comment.rb, line 8
def create(args)
  body = {
    "type": "post-comment",
    "data": {
      "content": args["comment"]
    }
  }

  resp = @conn.post("#{@api}/#{@id}/comment") do |req|
    req.body = body.to_s
    req.headers['Content-Type'] = 'application/json'
  end
end
delete(hash) click to toggle source
# File lib/quandora/comment.rb, line 37
def delete(hash)
  resp = @conn.delete("#{@api}/#{@id}/comment/#{hash}")
end
update(args) click to toggle source
# File lib/quandora/comment.rb, line 22
def update(args)
  body = {
    "type": "post-comment",
    "data": {
      "content": args["comment"],
      "hash": args["hash"]
    }
  }

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