Commit 3f59d25d authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre Committed by Stan Hu

Add an endpoint to get a list of issue comments

parent 3dd15d3f
......@@ -11,6 +11,16 @@ module Bitbucket
Collection.new(paginator)
end
def issue_comments(repo, number)
relative_path = "/repositories/#{repo}/issues/#{number}/comments"
paginator = Paginator.new(connection, relative_path, :url)
Collection.new(paginator).map do |comment_url|
parsed_response = connection.get(comment_url.to_s)
Representation::Comment.new(parsed_response)
end
end
def repo(name)
parsed_response = connection.get("/repositories/#{name}")
......
module Bitbucket
module Representation
class Comment < Representation::Base
def author
user.fetch('username', 'Anonymous')
end
def note
raw.dig('content', 'raw')
end
def created_at
raw['created_on']
end
def updated_at
raw['updated_on'] || raw['created_on']
end
private
def user
raw.fetch('user', {})
end
end
end
end
module Bitbucket
module Representation
class Url < Representation::Base
def to_s
raw.dig('links', 'self', 'href')
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment