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 ...@@ -8,7 +8,7 @@ class EnvironmentSerializer < BaseSerializer
end end
def with_pagination(request, response) def with_pagination(request, response)
tap { @paginator = Paginator.new(request, response) } tap { @paginator = Gitlab::Serializer::Pagination.new(request, response) }
end end
def itemized? def itemized?
......
...@@ -4,7 +4,7 @@ class PipelineSerializer < BaseSerializer ...@@ -4,7 +4,7 @@ class PipelineSerializer < BaseSerializer
entity PipelineEntity entity PipelineEntity
def with_pagination(request, response) def with_pagination(request, response)
tap { @paginator = Paginator.new(request, response) } tap { @paginator = Gitlab::Serializer::Pagination.new(request, response) }
end end
def paginated? def paginated?
......
class Paginator module Gitlab
include API::Helpers::Pagination module Serializer
class Pagination
include ::API::Helpers::Pagination
def initialize(request, response) def initialize(request, response)
@request = request @request = request
...@@ -20,4 +22,6 @@ class Paginator ...@@ -20,4 +22,6 @@ class Paginator
def header(header, value) def header(header, value)
@response.headers[header] = value @response.headers[header] = value
end end
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