module OnlyofficeBugzillaHelper::Comments

Working with comments

Public Instance Methods

add_comment(bug_id, comment) click to toggle source

Add comment to bug @param bug_id [Integer] id of bug @param comment [String] comment to add

# File lib/onlyoffice_bugzilla_helper/comments.rb, line 17
def add_comment(bug_id, comment)
  req = Net::HTTP::Post.new(bug_url(bug_id, '/comment'))
  req.body = { comment: comment }.to_json
  req.add_field('Content-Type', 'text/plain')
  perform_request(req)
end
comments(bug_id) click to toggle source

@return [Hash] list of bug comments

# File lib/onlyoffice_bugzilla_helper/comments.rb, line 7
def comments(bug_id)
  res = Net::HTTP.start(@url.host, @url.port, use_ssl: use_ssl?) do |http|
    http.get(bug_url(bug_id, '/comment'))
  end
  JSON.parse(res.body)['bugs'][bug_id.to_s]['comments']
end