BigW Consortium Gitlab

Commit 81eb5c7f by Grzegorz Bizon

Move serializers pagination class to separate module

This helps to avoid conflicts with `Paginator` class that seems to be used by some bundled libs.
parent 10c1a4d8
......@@ -8,7 +8,7 @@ class EnvironmentSerializer < BaseSerializer
end
def with_pagination(request, response)
tap { @paginator = Paginator.new(request, response) }
tap { @paginator = Gitlab::Serializer::Pagination.new(request, response) }
end
def itemized?
......
......@@ -4,7 +4,7 @@ class PipelineSerializer < BaseSerializer
entity PipelineEntity
def with_pagination(request, response)
tap { @paginator = Paginator.new(request, response) }
tap { @paginator = Gitlab::Serializer::Pagination.new(request, response) }
end
def paginated?
......
class Paginator
include API::Helpers::Pagination
module Gitlab
module Serializer
class Pagination
include ::API::Helpers::Pagination
def initialize(request, response)
@request = request
@response = response
end
def initialize(request, response)
@request = request
@response = response
end
private
private
# Methods needed by `API::Helpers::Pagination`
#
# Methods needed by `API::Helpers::Pagination`
#
attr_reader :request
attr_reader :request
def params
@request.query_parameters
end
def params
@request.query_parameters
end
def header(header, value)
@response.headers[header] = value
def header(header, value)
@response.headers[header] = value
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