Fix pagination

This commit is contained in:
Stan Hu 2018-07-05 21:11:16 -07:00
parent 022a0c2fde
commit 12b031ce8f
2 changed files with 5 additions and 5 deletions

View file

@ -16,7 +16,7 @@ module BitbucketServer
def get(path, extra_query = {})
response = Gitlab::HTTP.get(build_url(path),
basic_auth: auth,
params: extra_query)
query: extra_query)
check_errors!(response)
response.parsed_response

View file

@ -1,6 +1,6 @@
module BitbucketServer
class Paginator
PAGE_LENGTH = 25 # The minimum length is 10 and the maximum is 100.
PAGE_LENGTH = 25
def initialize(connection, url, type)
@connection = connection
@ -24,12 +24,12 @@ module BitbucketServer
page.nil? || page.next?
end
def next_url
page.nil? ? url : page.next
def next_offset
page.nil? ? 0 : page.next
end
def fetch_next_page
parsed_response = connection.get(next_url, pagelen: PAGE_LENGTH, sort: :created_on)
parsed_response = connection.get(@url, start: next_offset, limit: PAGE_LENGTH)
Page.new(parsed_response, type)
end
end