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

Add an endpoint to get a list of issues for a repo

parent 267e27b0
......@@ -4,6 +4,13 @@ module Bitbucket
@connection = options.fetch(:connection, Connection.new(options))
end
def issues(repo)
relative_path = "/repositories/#{repo}/issues"
paginator = Paginator.new(connection, relative_path, :issue)
Collection.new(paginator)
end
def repo(name)
parsed_response = connection.get("/repositories/#{name}")
......
module Bitbucket
module Representation
class Issue < Representation::Base
CLOSED_STATUS = %w(resolved invalid duplicate wontfix closed).freeze
def iid
raw['id']
end
def author
reporter.fetch('username', 'Anonymous')
end
def description
raw.dig('content', 'raw')
end
def state
closed? ? 'closed' : 'opened'
end
def title
raw['title']
end
def created_at
raw['created_on']
end
def updated_at
raw['edited_on']
end
def to_s
iid
end
private
def closed?
CLOSED_STATUS.include?(raw['state'])
end
def reporter
raw.fetch('reporter', {})
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